Revision 1428

trunk/scripts/admb/admb (revision 1428)
28 28
if [[ "$1" == "-help" ]]; then help; exit; fi
29 29
if [[ "$1" == "--help" ]]; then help; exit; fi
30 30

  
31
if [ ! -z "$ADMB_HOME" ]; then
32
unset ADMB_HOME
33
fi
34

  
35
FILE=$0
36
DIRECTORY=$(cd `dirname $FILE` && pwd)
37
while [ -h "${FILE}" ]; do
38
  pushd $DIRECTORY &> /dev/null
39
  FILE=$(readlink $DIRECTORY/admb)
40
  DIRECTORY=$(cd `dirname $FILE` && pwd)
31
if [ -z "$ADMB_HOME" ]; then
32
  FILE=$0
33
  DIRECTORY=$(cd `dirname "$FILE"` && pwd)
34
  while [ -h "${FILE}" ]; do
35
    pushd "$DIRECTORY" &> /dev/null
36
    FILE=$(readlink "$DIRECTORY"/admb)
37
    DIRECTORY=$(cd `dirname "$FILE"` && pwd)
38
    popd &> /dev/null
39
  done
40
  pushd "$DIRECTORY/.." &> /dev/null
41
  declare -rx ADMB_HOME=$PWD
41 42
  popd &> /dev/null
42
done
43
pushd "$DIRECTORY/.." &> /dev/null
44
declare -rx ADMB_HOME=$PWD
45
popd &> /dev/null
43
fi
46 44
PATH=$ADMB_HOME/bin:$PATH
47 45

  
48 46
# Pop args until model=$1
......
148 146
else
149 147
  CXXFLAGS="$CXXFLAGS -DSAFE_ALL"
150 148
fi
151
CXXFLAGS="$CXXFLAGS -D__GNUDOS__ -Dlinux -DUSE_LAPLACE -I. -I$ADMB_HOME/include -I$ADMB_HOME/contrib/include"
149
CXXFLAGS="$CXXFLAGS -D__GNUDOS__ -Dlinux -DUSE_LAPLACE -I. -I\"$ADMB_HOME/include\" -I\"$ADMB_HOME/contrib/include\""
152 150
if [ "$CXX" == "adcomp-x86_64-w64-mingw32" ]; then
153 151
  LDFLAGS="--static $LDFLAGS"
154 152
fi
......
240 238
  fi
241 239
  CMD="$CMD $file $objs"
242 240
  if [[ "$library" == "opt" ]]; then
243
    CMD="$CMD $ADMB_HOME/contrib/lib/libcontribo.a $ADMB_HOME/lib/libadmbo.a"
241
    CMD="$CMD \"$ADMB_HOME/contrib/lib/libcontribo.a\" \"$ADMB_HOME/lib/libadmbo.a\""
244 242
  else
245
    CMD="$CMD $ADMB_HOME/contrib/lib/libcontrib.a $ADMB_HOME/lib/libadmb.a"
243
    CMD="$CMD \"$ADMB_HOME/contrib/lib/libcontrib.a\" \"$ADMB_HOME/lib/libadmb.a\""
246 244
  fi
247 245
  echo -e \\n\*\*\* Linking $file $objs:\\n$CMD
248 246
  eval $CMD
......
285 283
  fi
286 284
  CMD="$CMD $listobjs"
287 285
  if [[ "$library" == "opt" ]]; then
288
    CMD="$CMD $ADMB_HOME/contrib/lib/libcontribo.a $ADMB_HOME/lib/libadmbo.a"
286
    CMD="$CMD \"$ADMB_HOME/contrib/lib/libcontribo.a\" \"$ADMB_HOME/lib/libadmbo.a\""
289 287
  else
290
    CMD="$CMD $ADMB_HOME/contrib/lib/libcontrib.a $ADMB_HOME/lib/libadmb.a"
288
    CMD="$CMD \"$ADMB_HOME/contrib/lib/libcontrib.a\" \"$ADMB_HOME/lib/libadmb.a\""
291 289
  fi
292 290
  echo -e \\n\*\*\* Linking $listobjs:\\n$CMD
293 291
  eval $CMD

Also available in: Unified diff