-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
compile.bat
254 lines (205 loc) · 9.15 KB
/
compile.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@echo off
rem
rem $Id: compile.bat $
rem
:COMPILE_IDE
pushd "%~dp0"
set HG_START_DP_IDE_COMPILE_BAT=%CD%
popd
if /I not "%1%" == "/NOCLS" cls
if /I "%1%" == "/NOCLS" shift
if not exist mgide.rc goto ERROR1
if /I not "%1" == "/C" goto VERBOSE
shift
set HG_ROOT=
set HG_HRB=
set HG_BCC=
set HG_CCOMP=
set LIB_GUI=
set LIB_HRB=
set BIN_HRB=
:VERBOSE
set HG_SILENT=^> nul
if /I not "%1" == "/V" goto ROOT
shift
set HG_SILENT=
:ROOT
if not "%HG_ROOT%" == "" goto TEST
pushd "%HG_START_DP_IDE_COMPILE_BAT%\.."
set HG_ROOT=%CD%
popd
:TEST
if /I "%1"=="XB55" ( shift & goto COMPILE_XB )
if /I "%1"=="XB58" ( shift & goto COMPILE_XB )
if /I "%1"=="XM" ( shift & goto COMPILE_XM )
:DETECT_XB
if not exist "%HG_ROOT%\compileXB.bat" goto DETECT_XM
if exist "%HG_ROOT%\compileXM.bat" goto SYNTAX
goto COMPILE_XB
:DETECT_XM
if exist "%HG_ROOT%\compileXM.bat" goto COMPILE_XM
:SYNTAX
echo Syntax:
echo To build with xHarbour and BCC 5.5.1
echo compile [/C] XB55 file [options]
echo To build with xHarbour and BCC 5.8.2
echo compile [/C] XB58 file [options]
echo To build with xHarbour and MinGW
echo compile [/C] XM file [options]
echo.
goto END
:COMPILE_XB
if "%HG_HRB%" == "" set HG_HRB=%HG_ROOT%\xhbcc
if "%HG_BCC%" == "" set HG_BCC=%HG_CCOMP%
if "%HG_BCC%" == "" if /I "%1"=="XB58" set HG_BCC=C:\BORLAND\BCC58
if "%HG_BCC%" == "" set HG_BCC=C:\BORLAND\BCC55
set HG_CCOMP=%HG_BCC%
if "%LIB_GUI%" == "" set LIB_GUI=lib\xhb\bcc
if "%LIB_HRB%" == "" set LIB_HRB=lib
if "%BIN_HRB%" == "" set BIN_HRB=bin
if exist oide.exe del oide.exe
if exist oide.exe goto ERROR2
echo xHarbour: Compiling sources...
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\mgide -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\dbucvc -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\formedit -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\menued -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\toolbed -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
echo BCC32: Compiling sources...
"%HG_BCC%\bin\bcc32.exe" -c -O2 -tW -tWM -M -d -a8 -OS -5 -6 -w -I%HG_HRB%\include;%HG_BCC%\include;%HG_ROOT%\include; -L%HG_HRB%\%LIB_HRB%;%HG_BCC%\lib; -D__XHARBOUR__ mgide.c %HG_SILENT%
if errorlevel 1 goto ERROR3
"%HG_BCC%\bin\bcc32.exe" -c -O2 -tW -tWM -M -d -a8 -OS -5 -6 -w -I%HG_HRB%\include;%HG_BCC%\include;%HG_ROOT%\include; -L%HG_HRB%\%LIB_HRB%;%HG_BCC%\lib; -D__XHARBOUR__ dbucvc.c %HG_SILENT%
if errorlevel 1 goto ERROR3
"%HG_BCC%\bin\bcc32.exe" -c -O2 -tW -tWM -M -d -a8 -OS -5 -6 -w -I%HG_HRB%\include;%HG_BCC%\include;%HG_ROOT%\include; -L%HG_HRB%\%LIB_HRB%;%HG_BCC%\lib; -D__XHARBOUR__ formedit.c %HG_SILENT%
if errorlevel 1 goto ERROR3
"%HG_BCC%\bin\bcc32.exe" -c -O2 -tW -tWM -M -d -a8 -OS -5 -6 -w -I%HG_HRB%\include;%HG_BCC%\include;%HG_ROOT%\include; -L%HG_HRB%\%LIB_HRB%;%HG_BCC%\lib; -D__XHARBOUR__ menued.c %HG_SILENT%
if errorlevel 1 goto ERROR3
"%HG_BCC%\bin\bcc32.exe" -c -O2 -tW -tWM -M -d -a8 -OS -5 -6 -w -I%HG_HRB%\include;%HG_BCC%\include;%HG_ROOT%\include; -L%HG_HRB%\%LIB_HRB%;%HG_BCC%\lib; -D__XHARBOUR__ toolbed.c %HG_SILENT%
if errorlevel 1 goto ERROR3
echo BRC32: Compiling resources...
echo #define oohgpath %HG_ROOT%\RESOURCES > _oohg_resconfig.h
echo. > %HG_ROOT%\resources\filler
copy /b mgide.rc + %HG_ROOT%\resources\filler + %HG_ROOT%\resources\oohg_bcc.rc _temp.rc /y %HG_SILENT%
"%HG_BCC%\bin\brc32.exe" -i%HG_ROOT%\include -i%HG_ROOT%\resources -i%HG_BCC%\include -r _temp.rc %HG_SILENT%
if errorlevel 1 goto ERROR3
echo ILINK32: Linking...
echo c0w32.obj + > b32.bc
echo mgide.obj dbucvc.obj formedit.obj menued.obj toolbed.obj, + >> b32.bc
echo oide.exe, + >> b32.bc
echo oide.map, + >> b32.bc
echo %HG_ROOT%\%LIB_GUI%\oohg.lib + >> b32.bc
for %%a in ( gtgui rtl vmmt rdd common hbsix dbffpt dbfntx macro ct lang pcrepos ) do if exist %HG_HRB%\%LIB_HRB%\%%a.lib echo %HG_HRB%\%LIB_HRB%\%%a.lib + >> b32.bc
echo %HG_ROOT%\%LIB_GUI%\bostaurus.lib + >> b32.bc
echo %HG_ROOT%\%LIB_GUI%\hbprinter.lib + >> b32.bc
echo %HG_ROOT%\%LIB_GUI%\miniprint.lib + >> b32.bc
for %%a in ( cw32mt import32 user32 winspool gdi32 comctl32 comdlg32 shell32 ole32 oleaut32 uuid mpr wsock32 ws2_32 mapi32 winmm vfw32 msimg32 iphlpapi ) do echo %%a.lib + >> b32.bc
echo , , + >> b32.bc
echo _temp.res + >> b32.bc
"%HG_BCC%\bin\ilink32.exe" -Gn -Tpe -aa -L%HG_BCC%\lib;%HG_BCC%\lib\psdk; @b32.bc %HG_SILENT%
if exist oide.exe goto OK_XB
echo Build finished with ERROR !!!
goto CLEAN_XB
:ERROR1
echo This file must be executed from IDE folder !!!
goto END
:ERROR2
echo COMPILE ERROR: Is oide.exe running ?
goto END
:ERROR3
echo Build finished with ERROR !!!
goto END
:OK_XB
echo Build finished OK !!!
:CLEAN_XB
for %%a in ( *.tds ) do del %%a %HG_SILENT%
for %%a in ( *.c ) do del %%a %HG_SILENT%
for %%a in ( *.map ) do del %%a %HG_SILENT%
for %%a in ( *.obj ) do del %%a %HG_SILENT%
for %%a in ( b32.bc ) do del %%a %HG_SILENT%
for %%a in ( _temp.* ) do del %%a %HG_SILENT%
goto END
:COMPILE_XM
if "%HG_HRB%" == "" set HG_HRB=%HG_ROOT%\xhmingw
if "%HG_MINGW%" == "" set HG_MINGW=%HG_CCOMP%
if "%HG_MINGW%" == "" set HG_MINGW=%HG_HRB%\comp\mingw
set HG_CCOMP=%HG_MINGW%
if "%LIB_GUI%" == "" set LIB_GUI=lib\xhb\mingw
if "%LIB_HRB%" == "" set LIB_HRB=lib
if "%BIN_HRB%" == "" set BIN_HRB=bin
if exist oide.exe del oide.exe
if exist oide.exe goto ERROR2
set "HG_PATH=%PATH%"
set "PATH=%HG_MINGW%\bin;%HG_HRB%\%BIN_HRB%"
echo xHarbour: Compiling sources...
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\mgide -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\dbucvc -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\formedit -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\menued -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
"%HG_HRB%\%BIN_HRB%\harbour.exe" prgs\toolbed -i%HG_HRB%\include;%HG_ROOT%\include;fmgs -n -w3 -gc0 -es2 -q0
if errorlevel 1 goto ERROR3
echo GCC: Compiling...
gcc -I. -I%HG_HRB%\include -I%HG_ROOT%\include -Wall -c mgide.c -o mgide.o
if errorlevel 1 goto ERROR3
gcc -I. -I%HG_HRB%\include -I%HG_ROOT%\include -Wall -c dbucvc.c -o dbucvc.o
if errorlevel 1 goto ERROR3
gcc -I. -I%HG_HRB%\include -I%HG_ROOT%\include -Wall -c formedit.c -o formedit.o
if errorlevel 1 goto ERROR3
gcc -I. -I%HG_HRB%\include -I%HG_ROOT%\include -Wall -c menued.c -o menued.o
if errorlevel 1 goto ERROR3
gcc -I. -I%HG_HRB%\include -I%HG_ROOT%\include -Wall -c toolbed.c -o toolbed.o
if errorlevel 1 goto ERROR3
echo WindRes: Compiling resource file...
echo #define oohgpath %HG_ROOT%\RESOURCES > _oohg_resconfig.h
echo. > %HG_ROOT%\resources\filler
copy /b mgide.rc + %HG_ROOT%\resources\filler + %HG_ROOT%\resources\oohg.rc _temp.rc /y %HG_SILENT%
windres.exe -I %HG_ROOT%\INCLUDE -i _temp.rc -o _temp.o %HG_SILENT%
if errorlevel 1 goto ERROR3
echo GCC: Linking...
set HG_OBJS=%HG_HRB%\%LIB_HRB%\mainwin.o mgide.o dbucvc.o formedit.o menued.o toolbed.o _temp.o
set HG_LIBS=-lbostaurus -lhbprinter -lminiprint -looHG
set HG_CFLAGS=-Wall -mwindows -static -static-libgcc
set HG_XLIBS=-lrtl -lvmmt -lrdd -lcodepage -lcommon -lct -ldbfcdx -ldbffpt -ldbfntx -ldebug -lgtgui -lgtwin -lhbsix -lhsx -llang -lmacro -lpcrepos -lpp
set HG_WLIBS=-luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 -lole32 -loleaut32 -luuid -lmpr -lwsock32 -lws2_32 -lmapi32 -lwinmm -lvfw32 -lmsimg32 -liphlpapi
set HG_SEARCH=-L. -L%HG_MINGW%\lib -L%HG_HRB%\%LIB_HRB% -L%HG_ROOT%\%LIB_GUI%
gcc -o oide.exe %HG_OBJS% %HG_CFLAGS% %HG_SEARCH% -Wl,--start-group %HG_XLIBS% %HG_LIBS% %HG_WLIBS% -Wl,--end-group
if exist oide.exe goto OK_XM
echo Build finished with ERROR !!!
goto CLEAN_XM
:OK_XM
echo Build finished OK !!!
:CLEAN_XM
if exist _temp.o del _temp.o %HG_SILENT%
if exist _temp.rc del _temp.rc %HG_SILENT%
if exist _oohg_resconfig.h del _oohg_resconfig.h %HG_SILENT%
del mgide.o %HG_SILENT%
del mgide.c %HG_SILENT%
del dbucvc.o %HG_SILENT%
del dbucvc.c %HG_SILENT%
del formedit.o %HG_SILENT%
del formedit.c %HG_SILENT%
del menued.o %HG_SILENT%
del menued.c %HG_SILENT%
del toolbed.o %HG_SILENT%
del toolbed.c %HG_SILENT%
set "PATH=%HG_PATH%"
set HG_OBJS=
set HG_LIBS=
set HG_CFLAGS=
set HG_XLIBS=
set HG_WLIBS=
set HG_SEARCH=
set HG_PATH=
set HG_SILENT=
goto END
:END
set HG_START_DP_IDE_COMPILE_BAT=
echo.