Revision 1349

trunk/scripts/admb/admb2.bat (revision 1349)
1
@echo off
2

  
3
setlocal EnableExtensions EnableDelayedExpansion
4

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

  
9
if defined ADMB_HOME (
10
  set "ADMB_HOME="
11
)
12
for %%a in (%0.bat) do (
13
  set HAS_PATH=%%~$PATH:a
14
  if not "!HAS_PATH!"=="" (
15
    set ADMB_PATH="%%~dp$PATH:a"
16
  ) else (
17
    set ADMB_PATH="%%~dpa"
18
  )
19
  pushd !ADMB_PATH!\..
20
  set ADMB_HOME=!CD!
21
  popd
22
)
23
if not "!MINGW_HOME!"=="" (
24
  set PATH=!ADMB_HOME!\bin;!MINGW_HOME!\bin;!PATH!
25
) else (
26
  set PATH=!ADMB_HOME!\bin;!ADMB_HOME!\utilities\mingw\bin;!PATH!
27
)
28

  
29
set srcs=
30
set tpls=
31
set objs=
32
set bounds=-bounds
33
set debug=
34

  
35
for %%a in (%*) do (
36
  set arg=%%a
37
  if "!arg:~0,1!"=="-" (
38
    if "%%a"=="-d" (
39
      set d=-d
40
      set dll=-dll
41
    )
42
    if "%%a"=="-g" (
43
      set g=-g
44
      set debug=-debug
45
    )
46
    if "%%a"=="-r" (
47
      set r=-r
48
      set parser=tpl2rem
49
    )
50
    if "%%a"=="-s" (
51
      set bounds=-bounds
52
    )
53
    if "%%a"=="-f" (
54
      set bounds=
55
    )
56
  ) else (
57
    if "%%~xa"=="" (
58
      set tpls=!tpls! %%a
59
    ) else (
60
      if "%%~xa"==".c" (
61
        set srcs=!srcs! %%a
62
      )
63
      if "%%~xa"==".cpp" (
64
        set srcs=!srcs! %%a
65
      )
66
      if "%%~xa"==".o" (
67
        set objs=!objs! %%a
68
      )
69
      if "%%~xa"==".obj" (
70
        set objs=!objs! %%a
71
      )
72
      if "%%~xa"==".tpl" (
73
        set tpls=!tpls! %%a
74
      )
75
    )
76
  )
77
)
78
if not defined tpls (
79
  if not defined srcs (
80
    if not defined objs (
81
      echo.&echo Error: Nothing to build
82
      echo.
83
      goto HELP
84
    )
85
  )
86
)
87
if not defined tpls (
88
  goto compile
89
)
90
if not defined parser (
91
  set parser=tpl2cpp
92
)
93
for %%a in (!tpls!) do (
94
  set model=%%~na
95
  if not exist %%~na.tpl (
96
    echo.&echo Error: !model!.tpl not found
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff