-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.cfix
380 lines (306 loc) · 12.6 KB
/
makefile.cfix
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
#----------------------------------------------------------------------
#
# Purpose:
# Main makefile. Named makefile.cfix in order not to interfere with
# building process, which is driven by build.exe
#
# Copyright:
# 2007-2009, Johannes Passing (passing at users.sourceforge.net)
#
# This file is part of cfix.
#
# cfix is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cfix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with cfix. If not, see <http://www.gnu.org/licenses/>.
#
#----------------------------------------------------------------------
!IF [cscript /nologo buildnum.vbs > __buildnum.inc]
!ENDIF
!INCLUDE __buildnum.inc
VERSION=1.7.0.$(BUILDNUMBER)
CUSTOMSYMSTORE=D:\XSYMBOLS\Custom
CFIX_CLAGS=-f -z -kern
!if ( "$(DDKBUILDENV)" != "" )
!ERROR Build environment found. Execute this command in a normal shell, not in a WDK shell.
!endif
!if ( "$(SDKBASE)" == "" )
!MESSAGE WARNING: SDKBASE not set. Set to base directory of Windows SDK.
!MESSAGE WARNING: Note that the path must not contain any spaces - required by build.exe
!endif
#----------------------------------------------------------------------
#
# Binaries. Build process is driven by build.exe.
#
#----------------------------------------------------------------------
build: clean chk fre symadd
# N.B. Omitting vssample targets.
ci: clean i386chk amd64chk i386fre amd64fre
symadd:
symstore add /r /f bin\chk\i386\c*.pdb /s "$(CUSTOMSYMSTORE)" /t cfix /v $(VERSION)
symstore add /r /f bin\chk\amd64\c*.pdb /s "$(CUSTOMSYMSTORE)" /t cfix /v $(VERSION)
symstore add /r /f bin\fre\i386\c*.pdb /s "$(CUSTOMSYMSTORE)" /t cfix /v $(VERSION)
symstore add /r /f bin\fre\amd64\c*.pdb /s "$(CUSTOMSYMSTORE)" /t cfix /v $(VERSION)
version:
tools\rcstamp cfix\Cfix\cfix.rc $(VERSION)
tools\rcstamp cfix\cfixcmd\runtest.rc $(VERSION)
tools\rcstamp cfix\cfixemb\cfixemb.rc $(VERSION)
tools\rcstamp cfix\cfixemb\cfixcons.rc $(VERSION)
tools\rcstamp cdiag\cdiag\cdiag.rc $(VERSION)
tools\rcstamp cfixctl\cfixctl\cfixctl.rc $(VERSION)
tools\rcstamp cfixkern\Cfixkl\cfixkl.rc $(VERSION)
tools\rcstamp cfixkern\Cfixkr\cfixkr.rc $(VERSION)
i386chk: version
cmd /C tools\ddkbuild -WNETW2K checked . -cZ
i386fre: version
cmd /C tools\ddkbuild -WNETW2K free . -cZ
amd64chk: version
cmd /C tools\ddkbuild -WLHNETA64 checked . -cZ
amd64fre: version
cmd /C tools\ddkbuild -WLHNETA64 free . -cZ
vssamples_i386chk: version
devenv samples\UserC\ExampleVs2005.sln /rebuild "Debug|Win32"
devenv samples\UserCc\ExampleCcVs2005.sln /rebuild "Debug|Win32"
vssamples_i386fre: version
devenv samples\UserC\ExampleVs2005.sln /rebuild "Release|Win32"
devenv samples\UserCc\ExampleCcVs2005.sln /rebuild "Release|Win32"
chk: i386chk amd64chk vssamples_i386chk
fre: i386fre amd64fre vssamples_i386fre
i386: i386chk i386fre vssamples_i386chk vssamples_i386fre
amd64: amd64chk amd64fre
cleantemps:
-1 for /f "delims=" %%i in ('dir /ad/s/b obj*') do @rd /S /Q %%i
cd samples\userc
-1 for /f "delims=" %%i in ('dir /ad/s/b debug') do @rd /S /Q %%i
-1 for /f "delims=" %%i in ('dir /ad/s/b release') do @rd /S /Q %%i
del *.ncb
del *.suo
del *.user
cd ..\..
cd samples\usercc
-1 for /f "delims=" %%i in ('dir /ad/s/b debug') do @rd /S /Q %%i
-1 for /f "delims=" %%i in ('dir /ad/s/b release') do @rd /S /Q %%i
del *.ncb
del *.suo
del *.user
cd ..\..
-1 for /f "delims=" %%i in ('dir /s/b *.aps') do @del %%i
-1 for /f "delims=" %%i in ('dir /s/b *.log') do @del %%i
-1 for /f "delims=" %%i in ('dir /s/b *.err') do @del %%i
-1 for /f "delims=" %%i in ('dir /s/b *.wrn') do @del %%i
-1 for /f "delims=" %%i in ('dir /s/b BuildLog.htm') do @del %%i
clean: cleantemps
if exist samples\bin rd /S /Q samples\bin
if exist bin\chk rd /S /Q bin\chk
if exist bin\fre rd /S /Q bin\fre
#----------------------------------------------------------------------
#
# Unit tests on test machines.
#
#----------------------------------------------------------------------
COPYLOCAL_OPTIONS=/MIR /XF *.exp *.lib /XX /NJH /NJS
copylocal:
#
# Copy binaries.
#
#!if ( "$(ARCH)" == "AMD64" )
-3 robocopy bin\chk\amd64 c:\dev\cfix\bin\chk\amd64 $(COPYLOCAL_OPTIONS)
-3 robocopy bin\fre\amd64 c:\dev\cfix\bin\fre\amd64 $(COPYLOCAL_OPTIONS)
-3 robocopy samples\bin\chk\amd64 c:\dev\cfix\samples\bin\chk\amd64 $(COPYLOCAL_OPTIONS)
-3 robocopy samples\bin\fre\amd64 c:\dev\cfix\samples\bin\fre\amd64 $(COPYLOCAL_OPTIONS)
copy /Y compat\winunit\tests\reference\TestSampleLib\BinaryNumberTestData.txt c:\dev\cfix\bin\chk\amd64
copy /Y compat\winunit\tests\reference\TestSampleLib\BinaryNumberTestData.txt c:\dev\cfix\bin\fre\amd64
#!endif
-3 robocopy bin\chk\i386 c:\dev\cfix\bin\chk\i386 $(COPYLOCAL_OPTIONS)
-3 robocopy bin\fre\i386 c:\dev\cfix\bin\fre\i386 $(COPYLOCAL_OPTIONS)
-3 robocopy samples\bin\chk\i386 c:\dev\cfix\samples\bin\chk\i386 $(COPYLOCAL_OPTIONS)
-3 robocopy samples\bin\fre\i386 c:\dev\cfix\samples\bin\fre\i386 $(COPYLOCAL_OPTIONS)
-3 robocopy samples\vsbin c:\dev\cfix\samples\vsbin $(COPYLOCAL_OPTIONS)
copy /Y compat\winunit\tests\reference\TestSampleLib\BinaryNumberTestData.txt c:\dev\cfix\bin\chk\i386
copy /Y compat\winunit\tests\reference\TestSampleLib\BinaryNumberTestData.txt c:\dev\cfix\bin\fre\i386
#
# Copy redists once.
#
!if ( "$(ARCH)" == "AMD64" )
if not exist c:\dev\cfix\chk\amd64\symsrv.dll copy redist\amd64\*.dll c:\dev\cfix\bin\chk\amd64
if not exist c:\dev\cfix\fre\amd64\symsrv.dll copy redist\amd64\*.dll c:\dev\cfix\bin\fre\amd64
!endif
if not exist c:\dev\cfix\chk\i386\symsrv.dll copy redist\i386\*.dll c:\dev\cfix\bin\chk\i386
if not exist c:\dev\cfix\fre\i386\symsrv.dll copy redist\i386\*.dll c:\dev\cfix\bin\fre\i386
if not exist c:\dev\cfix\cfix md c:\dev\cfix\cfix
copy /Y makefile.cfix c:\dev\cfix\makefile.cfix
#
# For use on test machines only.
#
testlocal: copylocal
!if ( "$(UAC)" == "1" )
elevate cmd /K "cd /d c:\dev\cfix\ && $(MAKE) -f makefile.cfix ARCH=$(ARCH) test"
!else
$(COMSPEC) /C "cd /d c:\dev\cfix\ && $(MAKE) -f makefile.cfix ARCH=$(ARCH) test"
!endif
debug:
echo procArch: $(PROCESSOR_ARCHITECTURE)
echo Arch: $(ARCH)
echo UAC: $(UAC)
#----------------------------------------------------------------------
#
# Unit tests.
#
#----------------------------------------------------------------------
# helper target, invoked indirectly
__cfixtests:
-1100 sc stop cfixkr
-1100 sc delete cfixkr
-1100 sc delete cfixkr_cfixkr32
-1100 sc delete cfixkr_cfixkr64
-1100 sc delete cfixkr_testklib6
-1100 sc delete cfixkr_testkmsc
-1100 sc delete testklib1
-1100 sc delete testklib2
-1100 sc delete testklib7
$(CFIX_CMD) $(CFIX_FLAGS) testjpht.dll
$(CFIX_CMD) $(CFIX_FLAGS) testapi.dll
$(CFIX_CMD) $(CFIX_FLAGS) testcpp.dll
$(CFIX_CMD) $(CFIX_FLAGS) testtsx.dll
$(CFIX_CMD) -kern $(CFIX_FLAGS) ..\$(ARCH)\testkmsc.sys
$(CFIX_CMD) $(CFIX_FLAGS) testkr.dll
$(CFIX_CMD) $(CFIX_FLAGS) testdiag.dll
$(CFIX_CMD) $(CFIX_FLAGS) testwu.dll
$(CFIX_CMD) $(CFIX_FLAGS) testwusampleliba.dll
$(CFIX_CMD) $(CFIX_FLAGS) testwusamplelibw.dll
# helper target, invoked indirectly
__sampletests:
-1100 sc delete cfixkr
-1100 sc delete cfixkr_kern
$(CFIX_CMD) $(CFIX_FLAGS) userc.dll
$(CFIX_CMD) $(CFIX_FLAGS) usercc.dll
$(CFIX_CMD) -kern $(CFIX_FLAGS) ..\$(ARCH)\kern.sys
# helper target, invoked indirectly
__vssampletests:
-1100 sc delete cfixkr
-1100 sc delete cfixkr_kern
$(CFIX_CMD) $(CFIX_FLAGS) userc.dll
$(CFIX_CMD) $(CFIX_FLAGS) usercc.dll
testi386chk:
echo i386 checked
cd bin\chk\i386
$(MAKE) -f ..\..\..\makefile.cfix CFIX_CMD=cfix32 __cfixtests
cd ..\..\..
cd samples\bin\chk\i386
$(MAKE) -f ..\..\..\..\makefile.cfix CFIX_CMD=..\..\..\..\bin\chk\i386\cfix32 __sampletests
cd ..\..\..\..
cd samples\vsbin\debug
$(MAKE) -f ..\..\..\makefile.cfix CFIX_CMD=..\..\..\bin\chk\i386\cfix32 __vssampletests
cd ..\..\..
testi386fre:
echo i386 free
cd bin\fre\i386
$(MAKE) -f ..\..\..\makefile.cfix CFIX_CMD=cfix32 __cfixtests
cd ..\..\..
cd samples\bin\fre\i386
$(MAKE) -f ..\..\..\..\makefile.cfix CFIX_CMD=..\..\..\..\bin\fre\i386\cfix32 __sampletests
cd ..\..\..\..
cd samples\vsbin\release
$(MAKE) -f ..\..\..\makefile.cfix CFIX_CMD=..\..\..\bin\fre\i386\cfix32 __vssampletests
cd ..\..\..
testamd64chk:
echo amd64 checked
cd bin\chk\amd64
$(MAKE) -f ..\..\..\makefile.cfix CFIX_CMD=cfix64 __cfixtests
cd ..\..\..
cd samples\bin\chk\amd64
$(MAKE) -f ..\..\..\..\makefile.cfix CFIX_CMD=..\..\..\..\bin\chk\amd64\cfix64 __sampletests
cd ..\..\..\..
testamd64fre:
echo amd64 free
cd bin\fre\amd64
$(MAKE) -f ..\..\..\makefile.cfix CFIX_CMD=cfix64 __cfixtests
cd ..\..\..
cd samples\bin\fre\amd64
$(MAKE) -f ..\..\..\..\makefile.cfix CFIX_CMD=..\..\..\..\bin\fre\amd64\cfix64 __sampletests
cd ..\..\..\..
!if ( "$(ARCH)" == "AMD64" )
testchk: testi386chk testamd64chk
testfre: testi386fre testamd64fre
!else
testchk: testi386chk
testfre: testi386fre
!endif
test: testchk testfre
#----------------------------------------------------------------------
#
# Documentation.
#
#----------------------------------------------------------------------
docs:
cd doc
$(MAKE) $(MAKEFLAGS)
cd ..
#----------------------------------------------------------------------
#
# Installer.
#
#----------------------------------------------------------------------
signbinaries:
codesign.cmd cfix bin\fre\i386\cfix32.exe bin\fre\amd64\cfix64.exe
pad:
sed s/__VERSION__/$(VERSION)/ installer\pad.xml | sed s/__DAY__/$(NOW_DAY)/ | sed s/__MONTH__/$(NOW_MONTH)/ | sed s/__YEAR__/$(NOW_YEAR)/ > rtm\pad.xml
installer: signbinaries docs
cd installer
$(MAKE) clean cfix.msi
cd ..
#----------------------------------------------------------------------
#
# File releases.
#
#----------------------------------------------------------------------
release: build installer srcrelease pad
if not exist rtm md rtm
copy installer\cfix_$(VERSION).msi rtm\
codesign.cmd "cfix Installer" rtm\cfix_$(VERSION).msi
srcrelease: cleantemps
if exist rtm\cfix-src rd /S /Q rtm\cfix-src
if not exist rtm\cfix-src-$(VERSION)\cfix md rtm\cfix-src-$(VERSION)\cfix
if not exist rtm\cfix-src-$(VERSION)\cfix\cfix md rtm\cfix-src-$(VERSION)\cfix\cfix
if not exist rtm\cfix-src-$(VERSION)\cfix\cfixkern md rtm\cfix-src-$(VERSION)\cfix\cfixkern
if not exist rtm\cfix-src-$(VERSION)\cfix\cdiag md rtm\cfix-src-$(VERSION)\cfix\cdiag
if not exist rtm\cfix-src-$(VERSION)\cfix\compat md rtm\cfix-src-$(VERSION)\cfix\compat
if not exist rtm\cfix-src-$(VERSION)\doc md rtm\cfix-src-$(VERSION)\doc
if not exist rtm\cfix-src-$(VERSION)\samples md rtm\cfix-src-$(VERSION)\samples
xcopy /S /Y /I include rtm\cfix-src-$(VERSION)\cfix\include
xcopy /S /Y /I cfix rtm\cfix-src-$(VERSION)\cfix\cfix
xcopy /S /Y /I cfixkern rtm\cfix-src-$(VERSION)\cfix\cfixkern
xcopy /S /Y /I cdiag rtm\cfix-src-$(VERSION)\cfix\cdiag
xcopy /S /Y /I compat rtm\cfix-src-$(VERSION)\cfix\compat
xcopy /S /Y /I jpht rtm\cfix-src-$(VERSION)\cfix\jpht
copy /Y DIRS rtm\cfix-src-$(VERSION)\cfix
# copy /Y makefile.cfix rtm\cfix-src-$(VERSION)\cfix
copy /Y doc\docbook\cfix.chm rtm\cfix-src-$(VERSION)\doc
xcopy /S /Y /I samples rtm\cfix-src-$(VERSION)\samples
copy /Y COPYING rtm\cfix-src-$(VERSION)
copy /Y srcrel-readme.txt rtm\cfix-src-$(VERSION)\readme.txt
rd /S /Q rtm\cfix-src-$(VERSION)\samples\bin
rd /S /Q rtm\cfix-src-$(VERSION)\samples\vsbin
rd /S /Q rtm\cfix-src-$(VERSION)\samples\UserC\Debug
rd /S /Q rtm\cfix-src-$(VERSION)\samples\UserC\Release
rd /S /Q rtm\cfix-src-$(VERSION)\samples\UserC\x64
rd /S /Q rtm\cfix-src-$(VERSION)\samples\UserCc\Debug
rd /S /Q rtm\cfix-src-$(VERSION)\samples\UserCc\Release
rd /S /Q rtm\cfix-src-$(VERSION)\samples\UserCc\x64
cd rtm\cfix-src-$(VERSION)
-1 for /f "delims=" %%i in ('dir /s/b __*.txt') do @del %%i
-1 for /f "delims=" %%i in ('dir /s/b *.cmd') do @del %%i
cd ..\..
cd rtm\cfix-src-$(VERSION)\cfix
rd /S /Q compat\winunit\tests\reference
del /S *.ncb
del /S *.user
cd ..\..\..