Revision 1399 trunk/scripts/admb/adcomp.bat

adcomp.bat (revision 1399)
1 1
@echo off
2
@REM
3
@REM  Copyright 2013 (c) ADMB Foundation
4
@REM
2 5
setlocal EnableExtensions EnableDelayedExpansion
3
if [%1]==[] goto HELP
4
if [%1]==[-help] goto HELP
5
if [%1]==[--help] goto HELP
6

  
7
rem Pop args until model=%1
8
set dll=
9
set safopt=-DSAFE_ALL
10
set sym=-O3
11
set i=0
12
:STARTLOOP
13
if [%2]==[] goto ENDLOOP
14
if %1==-d set dll=-DBUILDING_DLL & shift
15
if %1==-g set sym=-g& shift
16
if %1==-r shift
17
if %1==-f set safopt=-DOPT_LIB& shift
18
set /a i=%i%+1
19
if %i%==100 shift & set i=0 & echo.&echo Warning: illegal option %1 (discarded)
20
goto STARTLOOP
21
:ENDLOOP
22

  
23
set model=%~n1
24

  
25
if exist "%ADMB_HOME%"\bin\admb-cfg.bat call "%ADMB_HOME%"\bin\admb-cfg.bat
26
if defined CXXFLAGS (
27
  set CXXFLAGS=%CXXFLAGS% %ADMB_CFG_CXXFLAGS%
28
) else (
29
  set CXXFLAGS=%ADMB_CFG_CXXFLAGS%
6
set args=
7
for %%a in (%*) do (
8
  set arg=%%a
9
  if "!arg:~0,1!"=="-" (
10
      set args=!args! !arg!
11
  ) else (
12
    if "%%~xa"=="" (
13
      set args=!args! !arg!.cpp
14
    ) else (
15
      set args=!args! !arg!
16
    )
17
  )
30 18
)
31

  
32
set CMD=g++ -c %CXXFLAGS% %sym% -D__GNUDOS__ %dll% -Dlinux %safopt% -DUSE_LAPLACE -fpermissive -I. -I"%ADMB_HOME%\include" -I"%ADMB_HOME%\contrib\include" -o %model%.obj %model%.cpp
33
echo %CMD%
34
%CMD%
35

  
36
goto EOF
37

  
38
:HELP
39
echo Usage: adcomp [-d] [-g] [-r] [-f] model
40
echo.
41
echo Compile AD Model Builder C++ to object code, using the MinGW GCC compiler.
42
echo.
43
echo   -d     Build a dynamic library (dll).
44
echo   -g     Build with debug symbols.
45
echo   -r     Build Random effects program (ADMB-RE).
46
echo   -f     Build with Fast optimized mode (no bounds checking).
47
echo          By default, admb script builds with bounds checking.
48
echo   model  TPL file (ie 'simple.tpl' or the filename 'simple' with no .tpl extension)
49
echo.
50

  
51
:EOF
52

  
53
REM r982 [2011-02-16] arnima  rewrite, fixed bug when user option is not
54
REM                           recognized, added CXXFLAGS, fixed spaces
55
REM r917 [2010-12-24] johnoel pruned 'mingw' dir
56
REM r914 [2010-12-24] johnoel changed \\include to \include and echo off to
57
REM                           @echo off, moved to 'g++' dir
58
REM r629 [2010-05-20] johnoel changed .o to .obj
59
REM r623 [2010-05-20] johnoel changed /include to \\include
60
REM r593 [2010-04-20] johnoel quoted ADMB_HOME
61
REM r563 [2010-04-15] johnoel simplified echo, added -DSAFE_ALL
62
REM r525 [2009-08-07] arnima  added support for filename extension like
63
REM                           simple.cpp, unquoted ADMB_HOME, enabled warnings
64
REM                   johnoel split -s option into separate -g and -s options,
65
REM                           if -g then not -O3
66
REM r244 [2009-05-28] arnima  created
19
call admb -c $args

Also available in: Unified diff