b23762c59050fd3af87c8ad3b5ab51ae2025b083
[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 !IF ("$(_RunOacr)" == "TRUE")
61 OACR = oacr
62 !ELSE
63 OACR = no_oacr
64 !ENDIF
65
66 $(OUT)\ddkbuild.cmd: NTMakefile
67         echo CALL "$(NTDDKDIR)\bin\setenv.bat" $(NTDDKDIR) $(DDK_ARCH) $(DDK_PLATFORM) $(DDK_BUILDTYPE) $(OACR) > $@
68         echo cd /d $(AFSROOT)\src\WINNT\afsrdr >> $@
69         echo cd kernel\fs >> $@
70         echo build.exe -M >> $@
71         echo if errorlevel neq 0 exit 1 >> $@
72         echo cd ..\..\kernel\lib >> $@
73         echo build.exe -M >> $@
74         echo if errorlevel neq 0 exit 1 >> $@
75         echo cd ..\..\npdll >> $@
76         echo build.exe -M >> $@
77         echo if errorlevel neq 0 exit 1 >> $@
78         echo cd ..\build\$(CPU) >> $@
79 !IFDEF CODESIGN_KERNEL
80         echo $(CODESIGN_KERNEL) AFSRedir.sys >> $@
81         echo $(CODESIGN_KERNEL) AFSRedirLib.sys >> $@
82         echo $(CODESIGN_KERNEL) AFSRDFSProvider.dll >> $@
83 !ENDIF
84         $(SYMSTORE_IMPORT)
85         echo exit 0 >> $@
86
87 $(OUT)\ddkclean.cmd: NTMakefile
88         echo CALL "$(NTDDKDIR)\bin\setenv.bat" $(NTDDKDIR) $(DDK_ARCH) $(DDK_PLATFORM) $(DDK_BUILDTYPE) $(OACR) > $@
89         echo cd /d $(AFSROOT)\src\WINNT\afsrdr >> $@
90         echo cd kernel\fs >> $@
91         echo build.exe -c -0 >> $@
92         echo cd ..\lib >> $@
93         echo build.exe -c -0 >> $@
94         echo cd ..\..\npdll >> $@
95         echo build.exe -c -0 >> $@
96         echo exit 0 >> $@
97
98 install: clean-build clean-kernel-fs clean-kernel-lib clean-npdll \
99          AFS_component_version_number.h $(OUT)\ddkbuild.cmd $(OUT)\ddkclean.cmd \
100          kernel\fs\AFSRedirInstall.inf \
101          kernel\lib\AFSRedirLibInstall.inf
102 !IF !EXIST(build\$(CPU))
103         $(MKDIR) build\$(CPU)
104 !ENDIF
105         cd tools\gettrace
106         $(MAKE) -f ntmakefile install
107         cd ..\settrace
108         $(MAKE) -f ntmakefile install
109         cd ..\crash
110         $(MAKE) -f ntmakefile install
111         cd ..\authgroup
112         $(MAKE) -f ntmakefile install
113         cd ..\objstatus
114         $(MAKE) -f ntmakefile install
115         cd ..\..
116         type $(OUT)\ddkbuild.cmd
117         -$(DEL) build\$(CPU)\AFSRedir.sys
118         -$(DEL) build\$(CPU)\AFSRedirLib.sys
119         -$(DEL) build\$(CPU)\AFSRDFSProvider.dll
120         cmd /c start /wait $(OUT)\ddkbuild.cmd
121         cmd /c if not exist build\$(CPU)\AFSRedir.sys exit 1
122         cmd /c if not exist build\$(CPU)\AFSRedirLib.sys exit 1
123         cmd /c if not exist build\$(CPU)\AFSRDFSProvider.dll exit 1
124         $(COPY) kernel\fs\AFSRedirInstall.inf build\$(CPU)\AFSRedirInstall.inf
125         $(COPY) kernel\lib\AFSRedirLibInstall.inf build\$(CPU)\AFSRedirLibInstall.inf
126         $(COPY) build\$(CPU)\* $(TARGETPATH)
127
128 clean-build:
129 !IF EXIST(build\$(CPU))
130         cd build\$(CPU)
131         -$(DEL) *.sys
132         -$(DEL) *.exe
133         -$(DEL) *.dll
134         -$(DEL) *.pdb
135         -$(DEL) *.inf
136         -$(DEL) *.manifest
137          cd ..\..
138 !ENDIF
139
140 clean-kernel-fs:
141         cd kernel\fs
142         -$(DEL) *.log
143         -$(DEL) *.wrn
144         -$(DEL) *.aps
145         -$(DEL) *.suo
146         cd ..\..
147
148 clean-kernel-lib:
149         cd kernel\lib
150         -$(DEL) *.log
151         -$(DEL) *.wrn
152         -$(DEL) *.aps
153         -$(DEL) *.suo
154         cd ..\..
155
156 clean-npdll:
157         cd npdll
158         -$(DEL) *.log
159         -$(DEL) *.wrn
160         -$(DEL) *.aps
161         -$(DEL) *.suo
162         cd ..
163
164 clean:: clean-build clean-kernel-fs clean-kernel-lib clean-npdll
165         -$(DEL) $(OUT)\ddkbuild.cmd
166         -type $(OUT)\ddkclean.cmd
167         if exist $(OUT)\ddkclean.cmd start /wait $(OUT)\ddkclean.cmd
168         -$(DEL) $(OUT)\ddkclean.cmd
169         -$(DEL) AFS_component_version_number.h
170         cd tools/gettrace
171         $(MAKE) -f ntmakefile clean
172         cd ../settrace
173         $(MAKE) -f ntmakefile clean
174         cd ../authgroup
175         $(MAKE) -f ntmakefile clean
176         cd ../objstatus
177         $(MAKE) -f ntmakefile clean
178         cd ../crash
179         $(MAKE) -f ntmakefile clean
180         cd ../..