Revision 1399 trunk/scripts/admb/adlink.bat

adlink.bat (revision 1399)
1 1
@echo off
2
@REM r244 [2009-05-28] arnima  created
3

  
2
@REM
3
@REM  Copyright 2013 (c) ADMB Foundation
4
@REM
4 5
setlocal EnableExtensions EnableDelayedExpansion
5

  
6
if [%1]==[] goto HELP
7
if [%1]==[-help] goto HELP
8
if [%1]==[--help] goto HELP
9

  
10
rem Pop args until model=%1
11
set objects=
12
set sym=-s & rem space
13
set linker=g++
6
set args=
14 7
for %%a in (%*) do (
15
if %%~xa==.obj (
16
set objects=!objects! %%a
17
if not defined model set model=%%~na
8
  set arg=%%a
9
  if "!arg:~0,1!"=="-" (
10
      set args=!args! !arg!
11
  ) else (
12
    if "%%~xa"=="" (
13
      set args=!args! !arg!.obj
14
    ) else (
15
      set args=!args! !arg!
16
    )
17
  )
18 18
)
19
if %%~xa==.o (
20
set objects=!objects! %%a
21
if not defined model set model=%%~na
22
)
23
if %%a==-d set linker=dllwrap
24
if %%a==-g set sym=
25
if %%a==-r set r=
26
if %%a==-f (
27
  set libs="%ADMB_HOME%\contrib\lib\libcontribo.a" "%ADMB_HOME%\lib\libadmbo.a" 
28
)
29
)
30
if not defined libs set libs="%ADMB_HOME%\contrib\lib\libcontrib.a" "%ADMB_HOME%\lib\libadmb.a" 
31

  
32
if %linker%==g++ (set out=-o %model%) else (set def=-def %model%.def^
33
 --driver-name g++ --output-lib %model%.dll & set out=--output-lib lib%model%.a -o %model%.dll)
34

  
35
if exist "%ADMB_HOME%"\bin\admb-cfg.bat call "%ADMB_HOME%"\bin\admb-cfg.bat
36
if defined LDFLAGS (
37
  set LDFLAGS=%LDFLAGS% %ADMB_CFG_LDFLAGS%
38
) else (
39
  set LDFLAGS=%ADMB_CFG_LDFLAGS%
40
)
41

  
42
set CMD=%linker% %LDFLAGS% %sym% -static %def% -o %model%.exe %objects% %libs%
43
echo %CMD%
44
%CMD%
45

  
46
goto EOF
47

  
48
:HELP
49
echo Usage: adlink [-d] [-g] [-r] [-f] model
50
echo.
51
echo Link AD Model Builder object code to executable, using the MinGW GCC^
52
 compiler.
53
echo.
54
echo   -d     Build a dynamic library (dll).
55
echo   -g     Build with debug symbols.
56
echo   -r     Build Random effects program (ADMB-RE).
57
echo   -f     Build with Fast optimized mode (no bounds checking).
58
echo          By default, admb script builds with bounds checking.
59
echo   model  TPL file (ie 'simple.tpl' or the filename 'simple' with no .tpl extension)
60
echo.
61

  
62
:EOF
19
call admb $args

Also available in: Unified diff