-
Notifications
You must be signed in to change notification settings - Fork 22
/
mgwmake.bat
77 lines (57 loc) · 1.71 KB
/
mgwmake.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@ECHO OFF
SETLOCAL
REM Do not forget to add C:\MinGW\bin to your %Path% environment variable,
REM otherwise this script will not work!
SET RCOMPILER=windres.exe
SET CCOMPILER=gcc.exe
SET STRIPCMD=strip.exe
SET CFLAGS=-std=c99 -pedantic -g -O3 -Wall -shared -static-libgcc -Wl,--no-undefined -Wl,-out-implib,libconfini.lib
SET DLLOUTPUT=libconfini.dll
SET RCFILE=src\winres.rc
REM The following variable may contain a space-delimited list of files
SET SRCFILES=src\confini.c
WHERE %CCOMPILER% >nul 2>nul
IF %ERRORLEVEL% NEQ 0 (
@ECHO Program %CCOMPILER% has not been found. Abort.
EXIT /B 1
)
WHERE %RCOMPILER% >nul 2>nul
SET /A __RCERR__=%ERRORLEVEL%
SET __TMP_RSO__=winres.o
IF %__RCERR__% NEQ 0 (
@ECHO Program %RCOMPILER% has not been found. Proceeding without resource file.
GOTO COMPILE_DLL
)
@ECHO Loading resource file...
%RCOMPILER% -i %RCFILE% -o %__TMP_RSO__%
SET /A __RCERR__=%ERRORLEVEL%
IF %__RCERR__% NEQ 0 (
@ECHO An error occured. Proceeding without resource file.
)
:COMPILE_DLL
@ECHO Compiling %DLLOUTPUT%...
IF %__RCERR__% EQU 0 (
%CCOMPILER% %CFLAGS% -o %DLLOUTPUT% %SRCFILES% %__TMP_RSO__%
) ELSE (
%CCOMPILER% %CFLAGS% -o %DLLOUTPUT% %SRCFILES%
)
SET /A __CCERR__=%ERRORLEVEL%
IF %__RCERR__% EQU 0 DEL %__TMP_RSO__%
IF %__CCERR__% NEQ 0 (
EXIT /B %__CCERR__%
)
WHERE %STRIPCMD% >nul 2>nul
SET /A __STRIPCMDERR__=%ERRORLEVEL%
IF %__STRIPCMDERR__% EQU 0 (
@ECHO Stripping %DLLOUTPUT%...
) ELSE (
@ECHO Program %STRIPCMD% has not been found. The dll has not been stripped.
EXIT /B 0
)
%STRIPCMD% %DLLOUTPUT%
SET /A __STRIPPROGERR__=%ERRORLEVEL%
IF %__STRIPPROGERR__% EQU 0 (
@ECHO Done.
)
EXIT /B %__STRIPPROGERR__%
ENDLOCAL