Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
# 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
# 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
# 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 <>.
!IF [cscript /nologo buildnum.vbs >]
CFIX_CLAGS=-f -z -kern
!if ( "$(DDKBUILDENV)" != "" )
!ERROR Build environment found. Execute this command in a normal shell, not in a WDK shell.
!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
# Binaries. Build process is driven by build.exe.
build: clean chk fre symadd
# N.B. Omitting vssample targets.
ci: clean i386chk amd64chk i386fre amd64fre
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)
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
-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.
# 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
-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
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"
$(COMSPEC) /C "cd /d c:\dev\cfix\ && $(MAKE) -f makefile.cfix ARCH=$(ARCH) test"
echo Arch: $(ARCH)
echo UAC: $(UAC)
# Unit tests.
# helper target, invoked indirectly
-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
-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
-1100 sc delete cfixkr
-1100 sc delete cfixkr_kern
$(CFIX_CMD) $(CFIX_FLAGS) userc.dll
$(CFIX_CMD) $(CFIX_FLAGS) usercc.dll
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 ..\..\..
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 ..\..\..
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 ..\..\..\..
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
testchk: testi386chk
testfre: testi386fre
test: testchk testfre
# Documentation.
cd doc
cd ..
# Installer.
codesign.cmd cfix bin\fre\i386\cfix32.exe bin\fre\amd64\cfix64.exe
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 ..\..\..