Windows: Build the AFS Redirector world
[openafs.git] / src / WINNT / afsrdr / NTMakefile
1 # Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
2 # Copyright (c) 2009, 2010, 2011 Your File System, Inc.
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 #
9 # - Redistributions of source code must retain the above copyright notice,
10 #   this list of conditions and the following disclaimer.
11 # - Redistributions in binary form must reproduce the above copyright
12 #   notice,
13 #   this list of conditions and the following disclaimer in the
14 #   documentation
15 #   and/or other materials provided with the distribution.
16 # - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
17 #   nor the names of their contributors may be used to endorse or promote
18 #   products derived from this software without specific prior written
19 #   permission from Kernel Drivers, LLC and Your File System, Inc.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25 # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33
34 # This file requires Microsoft Windows DDK/WDK 6001 or higher
35
36 !IF ("$(CPU)" == "x86")
37 CPU = i386
38 !ENDIF
39
40 RELDIR=WINNT\afsrdr
41 !INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
42 !INCLUDE ..\..\config\NTMakefile.version
43
44 TARGETPATH = $(DESTDIR)\root.client\usr\vice\etc
45
46 !IF ("$(CPU)" == "i386")
47 DDK_ARCH=X86
48 DDK_PLATFORM=WXP
49 !ELSE IF ("$(CPU)" == "AMD64")
50 DDK_ARCH=x64
51 DDK_PLATFORM=WNET
52 !ENDIF
53
54 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
55 DDK_BUILDTYPE=FRE
56 !ELSE
57 DDK_BUILDTYPE=CHK
58 !ENDIF
59
60 $(OUT)\ddkbuild.cmd: NTMakefile
61         echo CALL "$(NTDDKDIR)\bin\setenv.bat" $(NTDDKDIR) $(DDK_ARCH) $(DDK_PLATFORM) $(DDK_BUILDTYPE) > $@
62         echo cd /d $(AFSROOT)\src\WINNT\afsrdr >> $@
63         echo cd kernel\fs >> $@
64         echo build.exe -M >> $@
65         echo if errorlevel neq 0 exit 1 >> $@
66         echo cd ..\..\build\$(CPU) >> $@
67 !IFDEF CODESIGN_KERNEL
68         echo $(CODESIGN_KERNEL) AFSRedir.sys >> $@
69 !ENDIF
70         echo cd ..\..\kernel\lib >> $@
71         echo build.exe -M >> $@
72         echo if errorlevel neq 0 exit 1 >> $@
73         echo cd ..\..\build\$(CPU) >> $@
74 !IFDEF CODESIGN_KERNEL
75         echo $(CODESIGN_KERNEL) AFSRedirLib.sys >> $@
76 !ENDIF
77         echo cd ..\..\npdll >> $@
78         echo build.exe -M >> $@
79         echo if errorlevel neq 0 exit 1 >> $@
80         echo cd ..\build\$(CPU) >> $@
81 !IFDEF CODESIGN_KERNEL
82         echo $(CODESIGN_KERNEL) AFSRDFSProvider.dll >> $@
83 !ENDIF
84         echo exit 0 >> $@
85
86 $(OUT)\ddkclean.cmd: NTMakefile
87         echo CALL "$(NTDDKDIR)\bin\setenv.bat" $(NTDDKDIR) $(DDK_ARCH) $(DDK_PLATFORM) $(DDK_BUILDTYPE) > $@
88         echo cd /d $(AFSROOT)\src\WINNT\afsrdr >> $@
89         echo cd kernel\fs >> $@
90         echo build.exe -c -0 >> $@
91         echo cd ..\lib >> $@
92         echo build.exe -c -0 >> $@
93         echo cd ..\..\npdll >> $@
94         echo build.exe -c -0 >> $@
95         echo exit 0 >> $@
96
97 install: clean-build clean-kernel-fs clean-kernel-lib clean-npdll \
98          AFS_component_version_number.h $(OUT)\ddkbuild.cmd $(OUT)\ddkclean.cmd \
99          kernel\fs\AFSRedirInstall.inf \
100          kernel\lib\AFSRedirLibInstall.inf
101 !IF !EXIST(build\$(CPU))
102         $(MKDIR) build\$(CPU)
103 !ENDIF
104         cd tools\gettrace
105         $(MAKE) -f ntmakefile install
106         cd ..\settrace
107         $(MAKE) -f ntmakefile install
108         cd ..\crash
109         $(MAKE) -f ntmakefile install
110         cd ..\authgroup
111         $(MAKE) -f ntmakefile install
112         cd ..\objstatus
113         $(MAKE) -f ntmakefile install
114         cd ..\..
115         type $(OUT)\ddkbuild.cmd
116         -$(DEL) build\$(CPU)\AFSRedir.sys
117         -$(DEL) build\$(CPU)\AFSRedirLib.sys
118         -$(DEL) build\$(CPU)\AFSRDFSProvider.dll
119         cmd /c start /wait $(OUT)\ddkbuild.cmd
120         cmd /c if not exist build\$(CPU)\AFSRedir.sys exit 1
121         cmd /c if not exist build\$(CPU)\AFSRedirLib.sys exit 1
122         cmd /c if not exist build\$(CPU)\AFSRDFSProvider.dll exit 1
123         $(COPY) kernel\fs\AFSRedirInstall.inf build\$(CPU)\AFSRedirInstall.inf
124         $(COPY) kernel\lib\AFSRedirLibInstall.inf build\$(CPU)\AFSRedirLibInstall.inf
125         $(COPY) build\$(CPU)\* $(TARGETPATH)
126
127 clean-build:
128 !IF EXIST(build\$(CPU))
129         cd build\$(CPU)
130         -$(DEL) *.sys
131         -$(DEL) *.exe
132         -$(DEL) *.dll
133         -$(DEL) *.pdb
134         -$(DEL) *.inf
135         -$(DEL) *.manifest
136          cd ..\..
137 !ENDIF
138
139 clean-kernel-fs:
140         cd kernel\fs
141         -$(DEL) *.log
142         -$(DEL) *.wrn
143         -$(DEL) *.aps
144         -$(DEL) *.suo
145         cd ..\..
146
147 clean-kernel-lib:
148         cd kernel\lib
149         -$(DEL) *.log
150         -$(DEL) *.wrn
151         -$(DEL) *.aps
152         -$(DEL) *.suo
153         cd ..\..
154
155 clean-npdll:
156         cd npdll
157         -$(DEL) *.log
158         -$(DEL) *.wrn
159         -$(DEL) *.aps
160         -$(DEL) *.suo
161         cd ..
162
163 clean:: clean-build clean-kernel-fs clean-kernel-lib clean-npdll
164         -$(DEL) $(OUT)\ddkbuild.cmd
165         -type $(OUT)\ddkclean.cmd
166         if exist $(OUT)\ddkclean.cmd start /wait $(OUT)\ddkclean.cmd
167         -$(DEL) $(OUT)\ddkclean.cmd
168         -$(DEL) AFS_component_version_number.h
169         cd tools/gettrace
170         $(MAKE) -f ntmakefile clean
171         cd ../settrace
172         $(MAKE) -f ntmakefile clean
173         cd ../authgroup
174         $(MAKE) -f ntmakefile clean
175         cd ../objstatus
176         $(MAKE) -f ntmakefile clean
177         cd ../crash
178         $(MAKE) -f ntmakefile clean
179         cd ../..