Revision 1255 trunk/scripts/admb/admb

admb (revision 1255)
1 1
#!/bin/bash
2
#
3
# Created by: Arni Magnusson [2009-05-27] revision 243
4
#
5
# Copyright (c) 2008-2013 ADMB Foundation
6
#
2 7
shopt -s expand_aliases
3
alias help='echo -e "Usage: admb [-d] [-g] [-r] [-s] model\n
4
Build AD Model Builder executable from TPL.\n
5
  -d     Create DLL
6
  -g     Insert debugging symbols
7
  -r     Create ADMB-RE
8
  -s     Enforce safe bounds (default)
9
  -O     Use optimized mode
10
  model  Filename prefix, e.g. simple\n"'
8
alias help='echo -e "
9
Builds AD Model Builder application or library.\n
10
Usage: 
11
admb [-c] [-d] [-g] [-r] [-f] model [srcs]\n
12
Options:
13
 -c     Build object file only.
14
 -d     Build a shared library.
15
 -g     Build with debug symbols.
16
 -r     Build Random effects (ADMB-RE).
17
 -f     Build with Fast optimized mode (no bounds checking).
18
        By default, admb script builds with bounds checking.
19
 model  TPL file (ie 'simple.tpl' or the filename 'simple' with no .tpl extension)
20
 srcs   One or more C++ source files with functions that are used in the model.\n
21
Examples:
22

  
23
Build a random effects model,
24
[admb/examples/admb-re/bcb]$ admb -r bcb.tpl
25
The program file is bcb.
26

  
27
Build a shared library,
28
[admb/examples/admb/simple]$ admb -d simple.tpl
29
The program file is simple.
30

  
31
Build with srcs and debug symbols,
32
[admb/contrib/ad2csv]$ admb -g ad2csv.cpp main.cpp
33
The program file is ad2csv.
34
"'
35

  
11 36
if [[ "$1" == "" ]]; then help; exit; fi
37
if [[ "$1" == "-h" ]]; then help; exit; fi
12 38
if [[ "$1" == "-help" ]]; then help; exit; fi
13 39
if [[ "$1" == "--help" ]]; then help; exit; fi
14 40

  
......
38 64
unset r
39 65
unset s
40 66
unset c
41
tpl2cpp=tpl2cpp
67
tpl2lex=tpl2cpp
42 68
s=-s
43
bounds=-bounds
69
bounds=
70
library=safe
44 71
while getopts "dgrscO" A; do
45 72
  case $A in
46 73
    d) d=-d; dll=-dll
47 74
       ;;
48 75
    g) g=-g; debug=-debug
49 76
       ;;
50
    r) r=-r; tpl2cpp=tpl2rem
77
    r) r=-r; tpl2lex=tpl2rem
51 78
       ;;
52
    s) s=-s; bounds=-bounds
79
    s) s=-s;
53 80
       ;;
54
    O) s=; bounds=
81
    f) s=; library=opt; bounds=
55 82
       ;;
56 83
    c) c=1
57 84
       ;;
......
83 110
    nontpls="$nontpls $file"
84 111
  fi
85 112
done
86

  
113
if [ -f "$ADMB_HOME/bin/admb-cfg.sh" ]; then
114
  source "$ADMB_HOME/bin/admb-cfg.sh"
115
  CXX=$ADMB_CFG_CXX
116
  CXXFLAGS="$CXXFLAGS $ADMB_CFG_CXXFLAGS"
117
  LDFLAGS="$LDFLAGS $ADMB_CFG_LDFLAGS"
118
else
119
  CXX=c++
120
  CXXFLAGS="$CXXFLAGS"
121
  LDFLAGS="$LDFLAGS"
122
fi
123
if [ ! -z "$dll" ]; then
124
  CXXFLAGS="-fPIC -DBUILDING_DLL $CXXFLAGSS"
125
  LDFLAGS="-shared $LDFLAGS"
126
fi
127
if [ ! -z "$debug" ]; then
128
  CXXFLAGS="-g $CXXFLAGS"
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff