NTMakefile.w32 revision 1.1.1.5 1 1.1 elric ########################################################################
2 1.1 elric #
3 1.1.1.2 pettai # Copyright (c) 2009-2011, Secure Endpoints Inc.
4 1.1 elric # All rights reserved.
5 1.1 elric #
6 1.1 elric # Redistribution and use in source and binary forms, with or without
7 1.1 elric # modification, are permitted provided that the following conditions
8 1.1 elric # are met:
9 1.1 elric #
10 1.1 elric # - Redistributions of source code must retain the above copyright
11 1.1 elric # notice, this list of conditions and the following disclaimer.
12 1.1 elric #
13 1.1 elric # - Redistributions in binary form must reproduce the above copyright
14 1.1 elric # notice, this list of conditions and the following disclaimer in
15 1.1 elric # the documentation and/or other materials provided with the
16 1.1 elric # distribution.
17 1.1 elric #
18 1.1 elric # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 1.1 elric # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 1.1 elric # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 1.1 elric # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 1.1 elric # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 1.1 elric # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 1.1 elric # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 1.1 elric # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 1.1 elric # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 elric # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 1.1 elric # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 elric # POSSIBILITY OF SUCH DAMAGE.
30 1.1 elric #
31 1.1 elric
32 1.1 elric all::
33 1.1 elric
34 1.1 elric clean::
35 1.1 elric
36 1.1 elric test::
37 1.1 elric
38 1.1 elric prep::
39 1.1 elric
40 1.1 elric all:: prep
41 1.1 elric
42 1.1.1.5 christos !include "NTMakefile.sdk"
43 1.1 elric
44 1.1 elric !ifdef NODEBUG
45 1.1 elric BUILD=rel
46 1.1 elric !else
47 1.1 elric BUILD=dbg
48 1.1 elric !endif
49 1.1 elric
50 1.1 elric !if exist($(MAKEDIR)\windows\NTMakefile.w32)
51 1.1 elric SRC=$(MAKEDIR)
52 1.1 elric !elseif exist($(MAKEDIR)\..\windows\NTMakefile.w32)
53 1.1 elric SRC=$(MAKEDIR)\..
54 1.1 elric !elseif exist($(MAKEDIR)\..\..\windows\NTMakefile.w32)
55 1.1 elric SRC=$(MAKEDIR)\..\..
56 1.1 elric !elseif exist($(MAKEDIR)\..\..\..\windows\NTMakefile.w32)
57 1.1 elric SRC=$(MAKEDIR)\..\..\..
58 1.1.1.2 pettai !elseif exist($(MAKEDIR)\..\..\..\..\windows\NTMakefile.w32)
59 1.1.1.2 pettai SRC=$(MAKEDIR)\..\..\..\..
60 1.1 elric !else
61 1.1 elric ! error Cant determine source directory
62 1.1 elric !endif
63 1.1 elric
64 1.1 elric ! if "$(CPU)"=="i386" || "$(CPU)"=="x86"
65 1.1 elric MCPU=x86
66 1.1 elric ! elseif "$(CPU)"=="AMD64"
67 1.1 elric MCPU=amd64
68 1.1 elric ! else
69 1.1 elric ! error Unknown CPU
70 1.1 elric ! endif
71 1.1 elric
72 1.1 elric !include "NTMakefile.config"
73 1.1 elric
74 1.1 elric #----------------------------------------------------------------
75 1.1 elric # Directory macros
76 1.1 elric
77 1.1 elric DESTDIR =$(SRC)\out\dest_$(CPU)
78 1.1 elric OBJDIR =$(SRC)\out\obj_$(CPU)
79 1.1 elric
80 1.1 elric INCDIR =$(DESTDIR)\inc
81 1.1 elric LIBDIR =$(DESTDIR)\lib
82 1.1 elric BINDIR =$(DESTDIR)\bin
83 1.1.1.3 christos PLUGINDIR =$(BINDIR)
84 1.1 elric DOCDIR =$(DESTDIR)\doc
85 1.1 elric SBINDIR =$(BINDIR)
86 1.1 elric LIBEXECDIR =$(BINDIR)
87 1.1 elric ASMDIR =$(BINDIR)
88 1.1 elric INSTDIR =$(DESTDIR)\install
89 1.1 elric SDKDIR =$(SRC)\out\sdk
90 1.1 elric SDKINCDIR =$(SDKDIR)\inc
91 1.1 elric SDKLIBDIR =$(SDKDIR)\lib\$(CPU)
92 1.1 elric SDKSRCDIR =$(SDKDIR)\src
93 1.1 elric SDKREDISTDIR =$(SDKDIR)\redist\$(CPU)
94 1.1 elric
95 1.1 elric !ifdef RELDIR
96 1.1 elric SRCDIR =$(SRC)\$(RELDIR)
97 1.1 elric OBJ =$(OBJDIR)\$(RELDIR)
98 1.1 elric !else
99 1.1 elric OBJ =$(OBJDIR)
100 1.1 elric !endif
101 1.1 elric
102 1.1 elric # For tests:
103 1.1 elric PATH=$(PATH);$(BINDIR)
104 1.1 elric
105 1.1 elric #----------------------------------------------------------------
106 1.1 elric # Command macros
107 1.1 elric
108 1.1 elric RMAKE=nmake /nologo /f NTMakefile RECURSE=1
109 1.1 elric MKDIR=md
110 1.1 elric CP=copy /Y
111 1.1 elric LINK=link
112 1.1 elric LM=lib
113 1.1 elric RM=del /q
114 1.1 elric ECHO=echo
115 1.1 elric RC=rc
116 1.1 elric
117 1.1 elric #----------------------------------------------------------------
118 1.1 elric # Program macros
119 1.1 elric
120 1.1 elric AWK_CMD=gawk.exe
121 1.1 elric YACC_CMD=bison.exe
122 1.1 elric LEX_CMD=flex.exe
123 1.1 elric PYTHON=python.exe
124 1.1 elric PERL=perl.exe
125 1.1 elric CMP=cmp.exe
126 1.1 elric MAKECAT=makecat.exe
127 1.1 elric HHC=hhc.exe
128 1.1 elric MAKEINFO=makeinfo.exe
129 1.1 elric SED=sed.exe
130 1.1 elric
131 1.1 elric CANDLE_CMD=candle.exe
132 1.1 elric LIGHT_CMD=light.exe
133 1.1 elric
134 1.1 elric # Only used for tests
135 1.1 elric SH=sh.exe
136 1.1 elric
137 1.1 elric # Commands
138 1.1 elric AWK=$(AWK_CMD)
139 1.1 elric YACC=$(YACC_CMD) -y
140 1.1 elric LEX=$(LEX_CMD)
141 1.1 elric CANDLE=$(CANDLE_CMD) -nologo
142 1.1 elric LIGHT=$(LIGHT_CMD) -nologo
143 1.1 elric
144 1.1 elric #----------------------------------------------------------------
145 1.1 elric # External dependencies
146 1.1 elric
147 1.1 elric # For pthread support to be enabled, both PTHREAD_INC and PTHREAD_LIB
148 1.1 elric # should be defined. PTHREAD_INC should be the include directory
149 1.1 elric # where pthread.h is to be found (i.e. $(PTHREAD_INC)\pthread.h should
150 1.1 elric # exist), and PTHREAD_LIB is the full path to the pthread import
151 1.1 elric # library.
152 1.1 elric #
153 1.1 elric # Note that both paths should not contain any whitespace.
154 1.1 elric
155 1.1 elric !ifdef PTHREAD_INC
156 1.1 elric pthreadinc= -I$(PTHREAD_INC)
157 1.1 elric !endif
158 1.1 elric
159 1.1 elric #----------------------------------------------------------------
160 1.1 elric # Build options
161 1.1 elric
162 1.1 elric cincdirs=$(cincdirs) -I$(INCDIR) -I$(INCDIR)\krb5 $(pthreadinc)
163 1.1 elric cdefines=$(cdefines) -DHAVE_CONFIG_H
164 1.1.1.3 christos # Windows CNG provider
165 1.1.1.3 christos cdefines=$(cdefines) -DHCRYPTO_DEF_PROVIDER=w32crypto
166 1.1 elric cdebug=$(cdebug) /Zi
167 1.1 elric ldebug=$(ldebug) /DEBUG
168 1.1.1.3 christos localcflags=$(localcflags) /Oy-
169 1.1 elric
170 1.1 elric # Disable warnings:
171 1.1 elric #
172 1.1 elric # C4996: 'function' was declared deprecated
173 1.1 elric # C4127: Conditional expression is constant
174 1.1 elric # C4244: Conversion from 'type1' to 'type2', possible loss of data
175 1.1 elric # C4100: 'identifier': unreferenced formal parameter
176 1.1 elric # C4706: Assignment within conditional expression
177 1.1 elric # C4214: Nonstandard extension used
178 1.1 elric # C4267: '': Conversion from 'type1' to 'type2', possible loss of data
179 1.1 elric # C4018: '': Signed/unsigned mismatch
180 1.1 elric # C4204: Nonstandard extension used: non-constant aggregate initializer
181 1.1 elric # C4221: Nonstandard extension used: 'v1': cannot be initialized using address of automatic variable 'v2'
182 1.1 elric # C4295: '': Array is too small to include a terminating null character
183 1.1 elric # C4146: Unary minus operator applied to unsigned type, result still unsigned.
184 1.1 elric #
185 1.1 elric cwarn=$(cwarn) -D_CRT_SECURE_NO_WARNINGS -wd4996 -wd4127 -wd4244 -wd4100 -wd4706
186 1.1 elric cwarn=$(cwarn) -wd4214 -wd4267 -wd4018 -wd4389 -wd4204 -wd4221 -wd4295 -wd4146
187 1.1 elric
188 1.1 elric !if "$(CPU)"=="i386"
189 1.1 elric libmach=/machine:X86
190 1.1 elric !elseif "$(CPU)"=="AMD64"
191 1.1 elric libmach=/machine:X64
192 1.1 elric !else
193 1.1 elric ! error Unknown CPU value
194 1.1 elric !endif
195 1.1 elric
196 1.1 elric !ifdef NO_MP
197 1.1 elric MPOPT=
198 1.1 elric !else
199 1.1 elric MPOPT=/MP
200 1.1 elric !endif
201 1.1 elric
202 1.1 elric !ifndef STATICRUNTIME
203 1.1 elric
204 1.1 elric C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsdll) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn)
205 1.1 elric EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsdll) $(libmach)
206 1.1 elric EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsdll) $(libmach)
207 1.1 elric DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsdll) $(libmach)
208 1.1 elric DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsdll) $(libmach)
209 1.1 elric
210 1.1 elric !else # STATICRUNTIME
211 1.1 elric
212 1.1 elric C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn)
213 1.1 elric EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsmt) $(libmach)
214 1.1 elric EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsmt) $(libmach)
215 1.1 elric DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsmt) $(libmach)
216 1.1 elric DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsmt) $(libmach)
217 1.1 elric
218 1.1 elric !endif
219 1.1 elric
220 1.1 elric LIBGUI_C = $(LM) /nologo $(libmach) /SUBSYSTEM:WINDOWS
221 1.1 elric LIBCON_C = $(LM) /nologo $(libmach) /SUBSYSTEM:CONSOLE
222 1.1 elric
223 1.1 elric C2OBJ = $(C2OBJ_C) -Fo$@ -Fd$(@D)\ $**
224 1.1 elric C2OBJ_NP = $(C2OBJ_C) $(MPOPT) $<
225 1.1 elric C2OBJ_P = $(C2OBJ_NP) -Fo$(OBJ)\ -Fd$(OBJ)\ #
226 1.1 elric EXECONLINK = $(EXECONLINK_C) -OUT:$@ $**
227 1.1 elric EXEGUILINK = $(EXEGUILINK_C) -OUT:$@ $**
228 1.1 elric DLLCONLINK = $(DLLCONLINK_C) -OUT:$@ $**
229 1.1 elric DLLGUILINK = $(DLLGUILINK_C) -OUT:$@ $**
230 1.1 elric LIBGUI = $(LIBGUI_C) /OUT:$@ $**
231 1.1 elric LIBCON = $(LIBCON_C) /OUT:$@ $**
232 1.1 elric
233 1.1 elric # Preprocess files to stdout using config.h
234 1.1 elric CPREPROCESSOUT = $(CC) /EP /FI$(INCDIR)\config.h /TC /DCPP_ONLY=1
235 1.1 elric
236 1.1 elric # Resources
237 1.1 elric
238 1.1 elric RC2RES_C = $(RC) $(cincdirs) $(AUXRCFLAGS)
239 1.1 elric RC2RES = $(RC2RES_C) -fo $@ $**
240 1.1 elric
241 1.1 elric #----------------------------------------------------------------------
242 1.1 elric # If this is the initial invocation, we check if all the build
243 1.1 elric # utilities are there. Also show the commands macros.
244 1.1 elric
245 1.1 elric !ifndef RECURSE
246 1.1 elric
247 1.1 elric REQUIRED_TOOLS= \
248 1.1 elric "$(AWK_CMD)" "$(YACC_CMD)" "$(LEX_CMD)" "$(PYTHON)" "$(PERL)" \
249 1.1.1.3 christos "$(CMP)" "$(SED)" "$(MAKECAT)" "$(MAKEINFO)" "$(HHC)"
250 1.1 elric
251 1.1 elric !ifdef BUILD_INSTALLERS
252 1.1 elric REQUIRED_TOOLS=$(REQUIRED_TOOLS) "$(CANDLE_CMD)" "$(LIGHT_CMD)"
253 1.1 elric !endif
254 1.1 elric
255 1.1 elric OPTIONAL_TOOLS="$(SH)"
256 1.1 elric
257 1.1 elric check-utils:
258 1.1 elric @for %%g in ( $(REQUIRED_TOOLS) ) do @( \
259 1.1 elric for /f %%f in ( "%%g" ) do @( \
260 1.1 elric if exist %%f @( \
261 1.1 elric echo Found %%f \
262 1.1 elric ) else if "%%~$$PATH:f"=="" @( \
263 1.1 elric echo Could not find %%f in PATH && \
264 1.1 elric exit /b 1 \
265 1.1 elric ) else @( \
266 1.1 elric echo Found %%~$$PATH:f \
267 1.1 elric ) \
268 1.1 elric ) \
269 1.1 elric )
270 1.1 elric @for %%g in ( $(OPTIONAL_TOOLS) ) do @( \
271 1.1 elric for /f %%f in ( "%%g" ) do @( \
272 1.1 elric if exist %%f @( \
273 1.1 elric echo Found %%f \
274 1.1 elric ) else if "%%~$$PATH:f"=="" @( \
275 1.1 elric echo Could not find %%f in PATH && \
276 1.1 elric echo Optional targets may fail. \
277 1.1 elric ) else @( \
278 1.1 elric echo Found %%~$$PATH:f \
279 1.1 elric ) \
280 1.1 elric ) \
281 1.1 elric )
282 1.1 elric
283 1.1 elric
284 1.1 elric prep:: check-utils
285 1.1 elric
286 1.1 elric show-cmds:
287 1.1 elric @$(ECHO) C2OBJ=$(C2OBJ_C:\=\\)
288 1.1 elric @$(ECHO).
289 1.1 elric @$(ECHO) EXECONLINK=$(EXECONLINK_C)
290 1.1 elric @$(ECHO).
291 1.1 elric @$(ECHO) EXEGUILINK=$(EXEGUILINK_C)
292 1.1 elric @$(ECHO).
293 1.1 elric @$(ECHO) DLLCONLINK=$(DLLCONLINK_C)
294 1.1 elric @$(ECHO).
295 1.1 elric @$(ECHO) DLLGUILINK=$(DLLGUILINK_C)
296 1.1 elric @$(ECHO).
297 1.1 elric @$(ECHO) LIBGUI=$(LIBGUI_C)
298 1.1 elric @$(ECHO).
299 1.1 elric @$(ECHO) LIBCON=$(LIBCON_C)
300 1.1 elric
301 1.1 elric prep:: show-cmds
302 1.1 elric
303 1.1 elric !endif # RECURSE
304 1.1 elric
305 1.1 elric {}.c{$(OBJ)}.obj::
306 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(localcflags) $(MPOPT) @<<
307 1.1 elric $<
308 1.1 elric <<
309 1.1 elric
310 1.1 elric {$(OBJ)}.c{$(OBJ)}.obj::
311 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(extcflags) $(MPOPT) @<<
312 1.1 elric $<
313 1.1 elric <<
314 1.1 elric
315 1.1 elric {}.cpp{$(OBJ)}.obj::
316 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(localcflags) $(MPOPT) @<<
317 1.1 elric $<
318 1.1 elric <<
319 1.1 elric
320 1.1 elric {$(OBJ)}.cpp{$(OBJ)}.obj::
321 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(extcflags) $(MPOPT) @<<
322 1.1 elric $<
323 1.1 elric <<
324 1.1 elric
325 1.1 elric {}.hin{$(INCDIR)}.h:
326 1.1 elric $(CP) $< $@
327 1.1 elric
328 1.1 elric {}.h{$(INCDIR)}.h:
329 1.1 elric $(CP) $< $@
330 1.1 elric
331 1.1 elric {}.h{$(INCDIR)\krb5}.h:
332 1.1 elric $(CP) $< $@
333 1.1 elric
334 1.1 elric {$(OBJ)}.h{$(INCDIR)}.h:
335 1.1 elric $(CP) $< $@
336 1.1 elric
337 1.1 elric {$(OBJ)}.x{$(OBJ)}.c:
338 1.1 elric $(CP) $< $@
339 1.1 elric
340 1.1 elric {$(OBJ)}.hx{$(INCDIR)}.h:
341 1.1 elric $(CP) $< $@
342 1.1 elric
343 1.1 elric {$(OBJ)}.hx{$(OBJ)}.h:
344 1.1 elric $(CP) $< $@
345 1.1 elric
346 1.1 elric {}.rc{$(OBJ)}.res:
347 1.1 elric $(RC2RES)
348 1.1 elric
349 1.1 elric #----------------------------------------------------------------------
350 1.1 elric # Announce the build directory
351 1.1 elric
352 1.1 elric !ifdef RELDIR
353 1.1 elric all:: announce
354 1.1 elric
355 1.1 elric all-tools:: announce-tools
356 1.1 elric
357 1.1 elric test:: announce
358 1.1 elric
359 1.1 elric clean:: announce
360 1.1 elric
361 1.1 elric announce:
362 1.1 elric @echo.
363 1.1 elric @echo --------- Entering $(RELDIR:\= ):
364 1.1 elric
365 1.1 elric announce-tools:
366 1.1 elric @echo.
367 1.1 elric @echo --------- Entering $(RELDIR:\= ) tools:
368 1.1 elric !endif
369 1.1 elric
370 1.1 elric #----------------------------------------------------------------------
371 1.1 elric # Create any required directories if they don't already exist
372 1.1 elric
373 1.1 elric prep:: mkdirs
374 1.1 elric
375 1.1 elric mkdirs:
376 1.1.1.3 christos ! if !exist("$(OBJ)")
377 1.1.1.3 christos -$(MKDIR) "$(OBJ)"
378 1.1 elric ! endif
379 1.1.1.3 christos ! if !exist("$(DESTDIR)")
380 1.1.1.3 christos -$(MKDIR) "$(DESTDIR)"
381 1.1 elric ! endif
382 1.1.1.3 christos ! if !exist("$(LIBDIR)")
383 1.1.1.3 christos -$(MKDIR) "$(LIBDIR)"
384 1.1 elric ! endif
385 1.1.1.3 christos ! if !exist("$(BINDIR)")
386 1.1.1.3 christos -$(MKDIR) "$(BINDIR)"
387 1.1 elric ! endif
388 1.1.1.3 christos ! if !exist("$(PLUGINDIR)")
389 1.1.1.3 christos -$(MKDIR) "$(PLUGINDIR)"
390 1.1 elric ! endif
391 1.1.1.3 christos ! if !exist("$(INCDIR)")
392 1.1.1.3 christos -$(MKDIR) "$(INCDIR)"
393 1.1 elric ! endif
394 1.1.1.3 christos ! if !exist("$(DOCDIR)")
395 1.1.1.3 christos -$(MKDIR) "$(DOCDIR)"
396 1.1 elric ! endif
397 1.1.1.3 christos ! if !exist("$(INCDIR)\gssapi")
398 1.1.1.3 christos -$(MKDIR) "$(INCDIR)\gssapi"
399 1.1 elric ! endif
400 1.1.1.3 christos ! if !exist("$(INCDIR)\hcrypto")
401 1.1.1.3 christos -$(MKDIR) "$(INCDIR)\hcrypto"
402 1.1 elric ! endif
403 1.1.1.3 christos ! if !exist("$(INCDIR)\kadm5")
404 1.1.1.3 christos -$(MKDIR) "$(INCDIR)\kadm5"
405 1.1 elric ! endif
406 1.1.1.3 christos ! if !exist("$(INCDIR)\krb5")
407 1.1.1.3 christos -$(MKDIR) "$(INCDIR)\krb5"
408 1.1 elric ! endif
409 1.1 elric
410 1.1 elric #----------------------------------------------------------------------
411 1.1 elric # If SUBDIRS is defined, we should recurse into the subdirectories
412 1.1 elric
413 1.1 elric !ifdef SUBDIRS
414 1.1 elric subdirs:
415 1.1 elric @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) && popd) || exit /b 1
416 1.1 elric
417 1.1 elric clean-subdirs:
418 1.1 elric @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) clean && popd) || exit /b 1
419 1.1 elric
420 1.1 elric test-subdirs:
421 1.1 elric @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) test && popd) || exit /b 1
422 1.1 elric
423 1.1 elric all:: subdirs
424 1.1 elric
425 1.1 elric clean:: clean-subdirs
426 1.1 elric
427 1.1 elric test:: test-subdirs
428 1.1 elric
429 1.1 elric !endif
430 1.1 elric
431 1.1 elric #----------------------------------------------------------------------
432 1.1 elric # Clean targets
433 1.1 elric
434 1.1 elric !ifdef CLEANFILES
435 1.1 elric clean::
436 1.1 elric -$(RM) $(CLEANFILES)
437 1.1 elric !endif
438 1.1 elric !ifdef RELDIR
439 1.1 elric clean::
440 1.1 elric -$(RM) $(OBJ)\*.*
441 1.1 elric !endif
442 1.1 elric
443 1.1 elric .SUFFIXES: .c .cpp .hin .h .x .hx
444 1.1 elric
445 1.1 elric #----------------------------------------------------------------------
446 1.1 elric # Manifest handling
447 1.1 elric #
448 1.1 elric # Starting with Visual Studio 8, the C compiler and the linker
449 1.1 elric # generate manifests so that the applications will link with the
450 1.1 elric # correct side-by-side DLLs at run-time. These are required for
451 1.1 elric # correct operation under Windows XP and later. We also have custom
452 1.1 elric # manifests which need to be merged with the manifests that VS
453 1.1 elric # creates.
454 1.1 elric #
455 1.1 elric # The syntax for invoking the _VC_MANIFEST_EMBED_FOO macro is:
456 1.1 elric # $(_VC_MANIFEST_EMBED_???) <additional manifests>
457 1.1 elric #
458 1.1 elric
459 1.1 elric MT=mt.exe -nologo
460 1.1 elric
461 1.1 elric _VC_MANIFEST_EMBED_EXE= \
462 1.1 elric ( if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest $(APPMANIFEST) )
463 1.1 elric
464 1.1 elric _VC_MANIFEST_EMBED_EXE_NOHEIM= \
465 1.1 elric ( if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest )
466 1.1 elric
467 1.1 elric _VC_MANIFEST_EMBED_DLL= \
468 1.1 elric ( if exist $@.manifest $(MT) -outputresource:$@;2 -manifest $@.manifest )
469 1.1 elric
470 1.1 elric _MERGE_MANIFEST_DLL= \
471 1.1 elric ( $(MT) -inputresource:$@;2 -manifest $(APPMANIFEST) -outputresource:$@;2 )
472 1.1 elric
473 1.1 elric _INSERT_APPMANIFEST_DLL= \
474 1.1 elric ( $(MT) -manifest $(APPMANIFEST) -outputresource:$@;2 )
475 1.1 elric
476 1.1 elric # Note that if you are merging manifests, then the VS generated
477 1.1 elric # manifest should be cleaned up after calling _VC_MANIFEST_EMBED_???.
478 1.1 elric # This ensures that even if the DLL or EXE is executed in-place, the
479 1.1 elric # embedded manifest will be used. Otherwise the $@.manifest file will
480 1.1 elric # be used.
481 1.1 elric
482 1.1 elric _VC_MANIFEST_CLEAN= \
483 1.1 elric ( if exist $@.manifest $(RM) $@.manifest )
484 1.1 elric
485 1.1 elric # End of manifest handling
486 1.1 elric
487 1.1 elric #----------------------------------------------------------------------
488 1.1 elric # Code and assembly signing
489 1.1 elric #
490 1.1.1.3 christos #
491 1.1.1.3 christos # SIGNTOOL is fullpath to signtool.exe from Windows v8.1 or later SDK
492 1.1.1.3 christos # (earlier versions do not support SHA-2 signatures)
493 1.1.1.3 christos #
494 1.1 elric # SIGNTOOL_C is any set of options required for certificate/private
495 1.1 elric # key selection for code signging.
496 1.1 elric #
497 1.1 elric # SIGNTOOL_O is any set of additional options to signtool.exe
498 1.1 elric #
499 1.1 elric # SIGNTOOL_T is the timestamp option
500 1.1 elric
501 1.1 elric !ifdef CODESIGN
502 1.1 elric _CODESIGN=( $(CODESIGN) $@ )
503 1.1.1.3 christos _CODESIGN_SHA256=( $(CODESIGN_SHA256) $@ )
504 1.1 elric !else
505 1.1 elric
506 1.1.1.3 christos !ifndef SIGNTOOL
507 1.1.1.3 christos SIGNTOOL=signtool.exe
508 1.1.1.3 christos !endif
509 1.1.1.3 christos
510 1.1 elric !ifdef SIGNTOOL_C
511 1.1 elric
512 1.1 elric !ifndef SIGNTOOL_T
513 1.1.1.3 christos SIGNTOOL_T=http://timestamp.verisign.com/scripts/timstamp.dll
514 1.1.1.3 christos !endif
515 1.1.1.3 christos !ifndef SIGNTOOL_T_SHA256
516 1.1.1.4 christos SIGNTOOL_T_SHA256=http://sha256timestamp.ws.symantec.com/sha256/timestamp
517 1.1 elric !endif
518 1.1 elric
519 1.1.1.3 christos _CODESIGN=( $(SIGNTOOL) sign /fd sha1 $(SIGNTOOL_O) /t $(SIGNTOOL_T) $(SIGNTOOL_C) /v $@ )
520 1.1.1.5 christos _CODESIGN_SHA256=( $(SIGNTOOL) sign /as /fd sha256 /td sha256 $(SIGNTOOL_O) /tr $(SIGNTOOL_T_SHA256) $(SIGNTOOL_C) /v $@ )
521 1.1 elric !else
522 1.1 elric _CODESIGN=( echo Skipping code sign )
523 1.1.1.3 christos _CODESIGN_SHA256=( echo Skipping sha256 code sign )
524 1.1 elric !endif
525 1.1 elric
526 1.1 elric !endif
527 1.1 elric
528 1.1 elric #----------------------------------------------------------------------
529 1.1.1.3 christos # Symbol Store Support
530 1.1.1.3 christos #
531 1.1.1.3 christos # SYMSTORE_EXE is full path to symstore.exe
532 1.1.1.3 christos #
533 1.1.1.3 christos # SYMSTORE_ROOT is full path to root directory of symbol store
534 1.1.1.3 christos #
535 1.1.1.3 christos # SYMSTORE_COMMENT is optional comment to include in symbol store catalog entry
536 1.1.1.3 christos #
537 1.1.1.3 christos
538 1.1.1.3 christos !IF DEFINED(SYMSTORE_EXE) && DEFINED(SYMSTORE_ROOT)
539 1.1.1.3 christos !IF "$(SYMSTORE_COMMENT)" != ""
540 1.1.1.3 christos SYMSTORE_COMMENT = |$(SYMSTORE_COMMENT)
541 1.1.1.3 christos !ENDIF
542 1.1.1.3 christos SYMSTORE_IMPORT= \
543 1.1.1.3 christos $(SYMSTORE_EXE) add /s $(SYMSTORE_ROOT) /t "Heimdal" /v "$(BUILD)-$(CPU)-$(VER_PACKAGE_VERSION)" /c "$(@F)$(SYMSTORE_COMMENT)" /f $*.*
544 1.1.1.3 christos !ELSE
545 1.1.1.3 christos SYMSTORE_IMPORT=@echo No symbol store
546 1.1.1.3 christos !ENDIF
547 1.1.1.3 christos
548 1.1.1.3 christos #----------------------------------------------------------------------
549 1.1 elric # Convenience macros for preparing EXEs and DLLs. These are multiline
550 1.1 elric # macros that deal with manifests and code signing. Unless we need to
551 1.1 elric # include custom manifests, these are what we should be using to
552 1.1 elric # prepare binaries.
553 1.1 elric
554 1.1 elric EXEPREP=\
555 1.1.1.3 christos ( $(_VC_MANIFEST_EMBED_EXE) && $(_VC_MANIFEST_CLEAN) && $(SYMSTORE_IMPORT) && $(_CODESIGN) && $(_CODESIGN_SHA256) ) || ( $(RM) $@ && exit /b 1 )
556 1.1 elric
557 1.1 elric EXEPREP_NOHEIM=\
558 1.1.1.3 christos ( $(_VC_MANIFEST_EMBED_EXE_NOHEIM) && $(_VC_MANIFEST_CLEAN) && $(SYMSTORE_IMPORT) && $(_CODESIGN) && $(_CODESIGN_SHA256) ) || ( $(RM) $@ && exit /b 1 )
559 1.1 elric
560 1.1 elric EXEPREP_NODIST=\
561 1.1.1.3 christos ( $(_VC_MANIFEST_EMBED_EXE_NOHEIM) && $(_VC_MANIFEST_CLEAN) && $(SYMSTORE_IMPORT) ) || ( $(RM) $@ && exit /b 1 )
562 1.1 elric
563 1.1 elric DLLPREP=\
564 1.1.1.3 christos ( $(_VC_MANIFEST_EMBED_DLL) && $(_VC_MANIFEST_CLEAN) && $(SYMSTORE_IMPORT) && $(_CODESIGN) && $(_CODESIGN_SHA256) ) || ( $(RM) $@ && exit /b 1 )
565 1.1 elric
566 1.1 elric DLLPREP_NODIST=\
567 1.1.1.3 christos ( $(_VC_MANIFEST_EMBED_DLL) && $(_VC_MANIFEST_CLEAN) && $(SYMSTORE_IMPORT) ) || ( $(RM) $@ && exit /b 1 )
568 1.1 elric
569 1.1 elric DLLPREP_MERGE=\
570 1.1.1.3 christos ( ( $(_MERGE_MANIFEST_DLL) || $(_INSERT_APPMANIFEST_DLL) && $(SYMSTORE_IMPORT) ) && $(_CODESIGN) && $(_CODESIGN_SHA256) ) || ( $(RM) $@ && exit /b 1 )
571 1.1 elric
572 1.1 elric #----------------------------------------------------------------------
573 1.1 elric # Convenience macros for import libraries and assemblies
574 1.1 elric #
575 1.1 elric
576 1.1 elric LIBASN1 =$(LIBDIR)\libasn1.lib
577 1.1 elric LIBCOMERR =$(LIBDIR)\libcom_err.lib
578 1.1 elric LIBEDITLINE =$(LIBDIR)\libeditline.lib
579 1.1 elric LIBGSSAPI =$(LIBDIR)\libgssapi.lib
580 1.1 elric LIBHCRYPTO =$(LIBDIR)\libhcrypto.lib
581 1.1 elric LIBHDB =$(LIBDIR)\libhdb.lib
582 1.1 elric LIBHEIMBASE =$(LIBDIR)\libheimbase.lib
583 1.1 elric LIBHEIMDAL =$(LIBDIR)\heimdal.lib
584 1.1 elric LIBHEIMIPCC =$(LIBDIR)\libheim-ipcc.lib
585 1.1 elric LIBHEIMIPCS =$(LIBDIR)\libheim-ipcs.lib
586 1.1 elric LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib
587 1.1 elric LIBHX509 =$(LIBDIR)\libhx509.lib
588 1.1 elric LIBKADM5CLNT=$(LIBDIR)\libkadm5clnt.lib
589 1.1 elric LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib
590 1.1 elric LIBKDC =$(LIBDIR)\libkdc.lib
591 1.1 elric LIBLTM =$(LIBDIR)\libltm.lib
592 1.1 elric LIBKRB5 =$(LIBDIR)\libkrb5.lib
593 1.1 elric LIBRFC3961 =$(LIBDIR)\librfc3961.lib
594 1.1 elric LIBROKEN =$(LIBDIR)\libroken.lib
595 1.1 elric LIBSL =$(LIBDIR)\libsl.lib
596 1.1 elric LIBSQLITE =$(LIBDIR)\libsqlite.lib
597 1.1 elric LIBVERS =$(LIBDIR)\libvers.lib
598 1.1 elric LIBWIND =$(LIBDIR)\libwind.lib
599 1.1 elric
600 1.1.1.3 christos !ifdef VER_DEBUG
601 1.1.1.3 christos ASM_DBG=.Debug
602 1.1.1.3 christos !endif
603 1.1.1.3 christos !ifdef VER_PRERELEASE
604 1.1.1.3 christos ASM_PRE=.Pre
605 1.1.1.3 christos !endif
606 1.1.1.3 christos !ifdef VER_PRIVATE
607 1.1.1.3 christos ASM_PVT=.Private
608 1.1.1.3 christos !endif
609 1.1.1.3 christos !ifdef VER_SPECIAL
610 1.1.1.3 christos ASM_SPC=.Special
611 1.1.1.3 christos !endif
612 1.1.1.3 christos
613 1.1.1.3 christos ASMKRBNAME =Heimdal.Kerberos$(ASM_SPC)$(ASM_PVT)$(ASM_PRE)$(ASM_DBG)
614 1.1 elric APPMANIFEST =$(INCDIR)\Heimdal.Application.$(MCPU).manifest
615 1.1 elric
616