Skip to content

Commit

Permalink
Allow static library files with .lib or .a extension to be used with …
Browse files Browse the repository at this point in the history
…the admb script.
  • Loading branch information
johnoel committed Sep 10, 2021
1 parent bf571e2 commit 3fbfd6e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
9 changes: 9 additions & 0 deletions scripts/admb/admb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ shift $((OPTIND-1))
tpls=
srcs=
objs=
libs=
nontpls=

for file in $*
Expand All @@ -111,6 +112,8 @@ do
elif [ "${file: -2}" = ".o" -o "${file: -4}" = ".obj" ]; then
objs="$objs $file"
nontpls="$nontpls $file"
elif [ "${file: -2}" = ".a" ]; then
libs="$libs $file"
else
tpls="$tpls $file"
fi
Expand Down Expand Up @@ -524,6 +527,9 @@ do
fi
fi
fi
if [ ! -z "$libs" ]; then
CMD="$CMD $libs"
fi
echo -e \*\*\* Linking: $file $objs\\n$CMD\\n
eval $CMD
if [[ -z $dll ]]; then
Expand Down Expand Up @@ -634,6 +640,9 @@ if [[ "$tplobjs" == "" ]]; then
fi
fi
fi
if [ ! -z "$libs" ]; then
CMD="$CMD $libs"
fi
echo -e \*\*\* Linking: $listobjs\\n$CMD\\n
eval $CMD
if [ ! -z "$output" ]; then
Expand Down
29 changes: 26 additions & 3 deletions scripts/admb/admb.bat
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@ for %%a in (%*) do (
)
)
)
if "!CXX!"=="cl" (
if "%%~xa"==".lib" (
if not defined option_libs (
set option_libs=!arg!
) else (
option_libs=!option_libs! !arg!
)
)
) else (
if "%%~xa"==".a" (
if defined option_libs (
set option_libs=!arg!
) else (
option_libs=!option_libs! !arg!
)
)
)
if "%%~xa"==".exe" (
if defined option_o (
set output=!arg!
Expand Down Expand Up @@ -657,7 +674,10 @@ if not defined tpls (
)
)
)
echo.&echo *** Linking: !objs!
if defined option_libs (
CMD=!CMD! !option_libs!
)
echo.&echo *** Linking: !objs! !option_libs!
echo !CMD!
call !CMD! || goto ERROR
if defined d (
Expand Down Expand Up @@ -734,10 +754,13 @@ if not defined tpls (
)
)
)
if defined option_libs (
CMD=!CMD! !option_libs!
)
if defined objs (
echo.&echo *** Linking: !tpl!.obj !objs!
echo.&echo *** Linking: !tpl!.obj !objs! !option_libs!
) else (
echo.&echo *** Linking: !tpl!.obj
echo.&echo *** Linking: !tpl!.obj !option_libs!
)
echo !CMD!
call !CMD! || goto ERROR
Expand Down
8 changes: 8 additions & 0 deletions scripts/admb/admb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ do
elif [ "${file: -2}" = ".o" -o "${file: -4}" = ".obj" ]; then
objs="$objs $file"
nontpls="$nontpls $file"
elif [ "${file: -2}" = ".a" ]; then
libs="$libs $file"
else
tpls="$tpls $file"
fi
Expand Down Expand Up @@ -526,6 +528,9 @@ do
fi
fi
fi
if [ ! -z "$libs" ]; then
CMD="$CMD $libs"
fi
echo -e \*\*\* Linking: $file $objs\\n$CMD\\n
eval $CMD
if [[ -z $dll ]]; then
Expand Down Expand Up @@ -636,6 +641,9 @@ if [[ "$tplobjs" == "" ]]; then
fi
fi
fi
if [ ! -z "$libs" ]; then
CMD="$CMD $libs"
fi
echo -e \*\*\* Linking: $listobjs\\n$CMD\\n
eval $CMD
if [ ! -z "$output" ]; then
Expand Down

0 comments on commit 3fbfd6e

Please sign in to comment.