Add the possibility to use noname functions by ordinal
[tinycc.git] / win32 / _parseLibs.bat
blob19e8e64800ff063f3b549ccbb1e794d2994b0164
1 @echo off
2 setlocal enabledelayedexpansion
4 pushd %~dp0
6 ::Define as main parameters
7 set _Args_=
8 set _LIBs_=
9 set LIBi=
11 set ARGSO=-IExt\include -LExt\lib %*
13 ::This is for the .def file also have a similar name .c file
14 ::.a file will be larger than .def + .c
15 ::*-uuid.c files are suitable to form libuuid.a
16 ::w32api-3.17.2
17 :GetRLib
18 for %%i in (%ARGSO%) do (
19   set ARG=%%i
20   set OPT=!ARG:~0,2!
21   if "!OPT!"=="-l" (
22     set LIB=!ARG:~2!
23     set LIBi=
24     if "!LIB!"=="uuid" (
25       set LIBi= lib\*uid.c
26     ) else (
27       if "!LIB!"=="vfw32" (
28         set LIBi= lib\msvfw32.def lib\avifil32.def lib\avicap32.def
29       ) else (
30         call :GetLibS
31       )
32     )
33     if "!LIBi!"=="" (
34       set _Args_=!_Args_! %%i
35     ) else (
36       set LIBi=!LIBi:%~dp0=!
37       set _LIBs_=!_LIBs_! !LIBi!
38       echo For lib !LIB! will use:
39       echo !LIBi!
40       echo.
41     )
42   ) else (
43     set _Args_=!_Args_! %%i
44   )
47 ::GetRLib End
48 popd
50 tcc.exe !_Args_! !_LIBs_!
52 exit /b
54 ::::::::::
56 :GetLibS
57 for %%D in (-Llib %ARGSO%) do (
58   set ARG_=%%D
59   set OPT_=!ARG_:~0,2!
60   set LIBD=
61   if "!OPT_!"=="-L" (
62     set LIBD=!ARG_:~2!
63     if exist "!LIBD!" call :GetDLib
64   )
66 set LIBD=
67 set OPT_=
68 set ARG_=
69 exit /b
70 ::GetLibD End
72 :GetDLib
73 pushd !LIBD!
74 for /f "usebackq delims=" %%I in (`"dir /b /s !LIB!.c !LIB!_*.c !LIB!.def !LIB!_*.def 2>nul"`) do (
75   set LIBi=!LIBi! "%%I"
77 popd
78 exit /b
79 ::GetDLib End