NTMakefile.w32 revision 1.1 1 1.1 elric ########################################################################
2 1.1 elric #
3 1.1 elric # Copyright (c) 2009, 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 elric !include <Win32.Mak>
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 elric !else
59 1.1 elric ! error Cant determine source directory
60 1.1 elric !endif
61 1.1 elric
62 1.1 elric ! if "$(CPU)"=="i386" || "$(CPU)"=="x86"
63 1.1 elric MCPU=x86
64 1.1 elric ! elseif "$(CPU)"=="AMD64"
65 1.1 elric MCPU=amd64
66 1.1 elric ! else
67 1.1 elric ! error Unknown CPU
68 1.1 elric ! endif
69 1.1 elric
70 1.1 elric !include "NTMakefile.config"
71 1.1 elric
72 1.1 elric #----------------------------------------------------------------
73 1.1 elric # Directory macros
74 1.1 elric
75 1.1 elric DESTDIR =$(SRC)\out\dest_$(CPU)
76 1.1 elric OBJDIR =$(SRC)\out\obj_$(CPU)
77 1.1 elric
78 1.1 elric INCDIR =$(DESTDIR)\inc
79 1.1 elric LIBDIR =$(DESTDIR)\lib
80 1.1 elric BINDIR =$(DESTDIR)\bin
81 1.1 elric PLUGINDIR =$(BINDIR)\plugin\krb5
82 1.1 elric DOCDIR =$(DESTDIR)\doc
83 1.1 elric SBINDIR =$(BINDIR)
84 1.1 elric LIBEXECDIR =$(BINDIR)
85 1.1 elric ASMDIR =$(BINDIR)
86 1.1 elric INSTDIR =$(DESTDIR)\install
87 1.1 elric SDKDIR =$(SRC)\out\sdk
88 1.1 elric SDKINCDIR =$(SDKDIR)\inc
89 1.1 elric SDKLIBDIR =$(SDKDIR)\lib\$(CPU)
90 1.1 elric SDKSRCDIR =$(SDKDIR)\src
91 1.1 elric SDKREDISTDIR =$(SDKDIR)\redist\$(CPU)
92 1.1 elric
93 1.1 elric !ifdef RELDIR
94 1.1 elric SRCDIR =$(SRC)\$(RELDIR)
95 1.1 elric OBJ =$(OBJDIR)\$(RELDIR)
96 1.1 elric !else
97 1.1 elric OBJ =$(OBJDIR)
98 1.1 elric !endif
99 1.1 elric
100 1.1 elric # For tests:
101 1.1 elric PATH=$(PATH);$(BINDIR)
102 1.1 elric
103 1.1 elric #----------------------------------------------------------------
104 1.1 elric # Command macros
105 1.1 elric
106 1.1 elric RMAKE=nmake /nologo /f NTMakefile RECURSE=1
107 1.1 elric MKDIR=md
108 1.1 elric CP=copy /Y
109 1.1 elric LINK=link
110 1.1 elric LM=lib
111 1.1 elric RM=del /q
112 1.1 elric ECHO=echo
113 1.1 elric RC=rc
114 1.1 elric
115 1.1 elric #----------------------------------------------------------------
116 1.1 elric # Program macros
117 1.1 elric
118 1.1 elric AWK_CMD=gawk.exe
119 1.1 elric YACC_CMD=bison.exe
120 1.1 elric LEX_CMD=flex.exe
121 1.1 elric PYTHON=python.exe
122 1.1 elric PERL=perl.exe
123 1.1 elric CMP=cmp.exe
124 1.1 elric SIGNTOOL=signtool.exe
125 1.1 elric MAKECAT=makecat.exe
126 1.1 elric HHC=hhc.exe
127 1.1 elric MAKEINFO=makeinfo.exe
128 1.1 elric SED=sed.exe
129 1.1 elric
130 1.1 elric CANDLE_CMD=candle.exe
131 1.1 elric LIGHT_CMD=light.exe
132 1.1 elric
133 1.1 elric # Only used for tests
134 1.1 elric SH=sh.exe
135 1.1 elric
136 1.1 elric # Commands
137 1.1 elric AWK=$(AWK_CMD)
138 1.1 elric YACC=$(YACC_CMD) -y
139 1.1 elric LEX=$(LEX_CMD)
140 1.1 elric CANDLE=$(CANDLE_CMD) -nologo
141 1.1 elric LIGHT=$(LIGHT_CMD) -nologo
142 1.1 elric
143 1.1 elric #----------------------------------------------------------------
144 1.1 elric # External dependencies
145 1.1 elric
146 1.1 elric # For pthread support to be enabled, both PTHREAD_INC and PTHREAD_LIB
147 1.1 elric # should be defined. PTHREAD_INC should be the include directory
148 1.1 elric # where pthread.h is to be found (i.e. $(PTHREAD_INC)\pthread.h should
149 1.1 elric # exist), and PTHREAD_LIB is the full path to the pthread import
150 1.1 elric # library.
151 1.1 elric #
152 1.1 elric # Note that both paths should not contain any whitespace.
153 1.1 elric
154 1.1 elric !ifdef PTHREAD_INC
155 1.1 elric pthreadinc= -I$(PTHREAD_INC)
156 1.1 elric !endif
157 1.1 elric
158 1.1 elric #----------------------------------------------------------------
159 1.1 elric # Build options
160 1.1 elric
161 1.1 elric cincdirs=$(cincdirs) -I$(INCDIR) -I$(INCDIR)\krb5 $(pthreadinc)
162 1.1 elric cdefines=$(cdefines) -DHAVE_CONFIG_H
163 1.1 elric cdebug=$(cdebug) /Zi
164 1.1 elric ldebug=$(ldebug) /DEBUG
165 1.1 elric
166 1.1 elric # ---------------------------------------------------------------
167 1.1 elric # time_t issues
168 1.1 elric
169 1.1 elric !if "$(MCPU)"=="x86"
170 1.1 elric cdefines=$(cdefines) -D_USE_32BIT_TIME_T
171 1.1 elric !endif
172 1.1 elric
173 1.1 elric # Disable warnings:
174 1.1 elric #
175 1.1 elric # C4996: 'function' was declared deprecated
176 1.1 elric # C4127: Conditional expression is constant
177 1.1 elric # C4244: Conversion from 'type1' to 'type2', possible loss of data
178 1.1 elric # C4100: 'identifier': unreferenced formal parameter
179 1.1 elric # C4706: Assignment within conditional expression
180 1.1 elric # C4214: Nonstandard extension used
181 1.1 elric # C4267: '': Conversion from 'type1' to 'type2', possible loss of data
182 1.1 elric # C4018: '': Signed/unsigned mismatch
183 1.1 elric # C4204: Nonstandard extension used: non-constant aggregate initializer
184 1.1 elric # C4221: Nonstandard extension used: 'v1': cannot be initialized using address of automatic variable 'v2'
185 1.1 elric # C4295: '': Array is too small to include a terminating null character
186 1.1 elric # C4146: Unary minus operator applied to unsigned type, result still unsigned.
187 1.1 elric #
188 1.1 elric cwarn=$(cwarn) -D_CRT_SECURE_NO_WARNINGS -wd4996 -wd4127 -wd4244 -wd4100 -wd4706
189 1.1 elric cwarn=$(cwarn) -wd4214 -wd4267 -wd4018 -wd4389 -wd4204 -wd4221 -wd4295 -wd4146
190 1.1 elric
191 1.1 elric !if "$(CPU)"=="i386"
192 1.1 elric libmach=/machine:X86
193 1.1 elric !elseif "$(CPU)"=="AMD64"
194 1.1 elric libmach=/machine:X64
195 1.1 elric !else
196 1.1 elric ! error Unknown CPU value
197 1.1 elric !endif
198 1.1 elric
199 1.1 elric !ifdef NO_MP
200 1.1 elric MPOPT=
201 1.1 elric !else
202 1.1 elric MPOPT=/MP
203 1.1 elric !endif
204 1.1 elric
205 1.1 elric !ifndef STATICRUNTIME
206 1.1 elric
207 1.1 elric C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsdll) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn)
208 1.1 elric EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsdll) $(libmach)
209 1.1 elric EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsdll) $(libmach)
210 1.1 elric DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsdll) $(libmach)
211 1.1 elric DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsdll) $(libmach)
212 1.1 elric
213 1.1 elric !else # STATICRUNTIME
214 1.1 elric
215 1.1 elric C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn)
216 1.1 elric EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsmt) $(libmach)
217 1.1 elric EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsmt) $(libmach)
218 1.1 elric DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsmt) $(libmach)
219 1.1 elric DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsmt) $(libmach)
220 1.1 elric
221 1.1 elric !endif
222 1.1 elric
223 1.1 elric LIBGUI_C = $(LM) /nologo $(libmach) /SUBSYSTEM:WINDOWS
224 1.1 elric LIBCON_C = $(LM) /nologo $(libmach) /SUBSYSTEM:CONSOLE
225 1.1 elric
226 1.1 elric C2OBJ = $(C2OBJ_C) -Fo$@ -Fd$(@D)\ $**
227 1.1 elric C2OBJ_NP = $(C2OBJ_C) $(MPOPT) $<
228 1.1 elric C2OBJ_P = $(C2OBJ_NP) -Fo$(OBJ)\ -Fd$(OBJ)\ #
229 1.1 elric EXECONLINK = $(EXECONLINK_C) -OUT:$@ $**
230 1.1 elric EXEGUILINK = $(EXEGUILINK_C) -OUT:$@ $**
231 1.1 elric DLLCONLINK = $(DLLCONLINK_C) -OUT:$@ $**
232 1.1 elric DLLGUILINK = $(DLLGUILINK_C) -OUT:$@ $**
233 1.1 elric LIBGUI = $(LIBGUI_C) /OUT:$@ $**
234 1.1 elric LIBCON = $(LIBCON_C) /OUT:$@ $**
235 1.1 elric
236 1.1 elric # Preprocess files to stdout using config.h
237 1.1 elric CPREPROCESSOUT = $(CC) /EP /FI$(INCDIR)\config.h /TC /DCPP_ONLY=1
238 1.1 elric
239 1.1 elric # Resources
240 1.1 elric
241 1.1 elric RC2RES_C = $(RC) $(cincdirs) $(AUXRCFLAGS)
242 1.1 elric RC2RES = $(RC2RES_C) -fo $@ $**
243 1.1 elric
244 1.1 elric #----------------------------------------------------------------------
245 1.1 elric # If this is the initial invocation, we check if all the build
246 1.1 elric # utilities are there. Also show the commands macros.
247 1.1 elric
248 1.1 elric !ifndef RECURSE
249 1.1 elric
250 1.1 elric REQUIRED_TOOLS= \
251 1.1 elric "$(AWK_CMD)" "$(YACC_CMD)" "$(LEX_CMD)" "$(PYTHON)" "$(PERL)" \
252 1.1 elric "$(CMP)" "$(SED)" "$(SIGNTOOL)" "$(MAKECAT)" "$(MAKEINFO)" "$(HHC)"
253 1.1 elric
254 1.1 elric !ifdef BUILD_INSTALLERS
255 1.1 elric REQUIRED_TOOLS=$(REQUIRED_TOOLS) "$(CANDLE_CMD)" "$(LIGHT_CMD)"
256 1.1 elric !endif
257 1.1 elric
258 1.1 elric OPTIONAL_TOOLS="$(SH)"
259 1.1 elric
260 1.1 elric check-utils:
261 1.1 elric @for %%g in ( $(REQUIRED_TOOLS) ) do @( \
262 1.1 elric for /f %%f in ( "%%g" ) do @( \
263 1.1 elric if exist %%f @( \
264 1.1 elric echo Found %%f \
265 1.1 elric ) else if "%%~$$PATH:f"=="" @( \
266 1.1 elric echo Could not find %%f in PATH && \
267 1.1 elric exit /b 1 \
268 1.1 elric ) else @( \
269 1.1 elric echo Found %%~$$PATH:f \
270 1.1 elric ) \
271 1.1 elric ) \
272 1.1 elric )
273 1.1 elric @for %%g in ( $(OPTIONAL_TOOLS) ) do @( \
274 1.1 elric for /f %%f in ( "%%g" ) do @( \
275 1.1 elric if exist %%f @( \
276 1.1 elric echo Found %%f \
277 1.1 elric ) else if "%%~$$PATH:f"=="" @( \
278 1.1 elric echo Could not find %%f in PATH && \
279 1.1 elric echo Optional targets may fail. \
280 1.1 elric ) else @( \
281 1.1 elric echo Found %%~$$PATH:f \
282 1.1 elric ) \
283 1.1 elric ) \
284 1.1 elric )
285 1.1 elric
286 1.1 elric
287 1.1 elric prep:: check-utils
288 1.1 elric
289 1.1 elric show-cmds:
290 1.1 elric @$(ECHO) C2OBJ=$(C2OBJ_C:\=\\)
291 1.1 elric @$(ECHO).
292 1.1 elric @$(ECHO) EXECONLINK=$(EXECONLINK_C)
293 1.1 elric @$(ECHO).
294 1.1 elric @$(ECHO) EXEGUILINK=$(EXEGUILINK_C)
295 1.1 elric @$(ECHO).
296 1.1 elric @$(ECHO) DLLCONLINK=$(DLLCONLINK_C)
297 1.1 elric @$(ECHO).
298 1.1 elric @$(ECHO) DLLGUILINK=$(DLLGUILINK_C)
299 1.1 elric @$(ECHO).
300 1.1 elric @$(ECHO) LIBGUI=$(LIBGUI_C)
301 1.1 elric @$(ECHO).
302 1.1 elric @$(ECHO) LIBCON=$(LIBCON_C)
303 1.1 elric
304 1.1 elric prep:: show-cmds
305 1.1 elric
306 1.1 elric !endif # RECURSE
307 1.1 elric
308 1.1 elric {}.c{$(OBJ)}.obj::
309 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(localcflags) $(MPOPT) @<<
310 1.1 elric $<
311 1.1 elric <<
312 1.1 elric
313 1.1 elric {$(OBJ)}.c{$(OBJ)}.obj::
314 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(extcflags) $(MPOPT) @<<
315 1.1 elric $<
316 1.1 elric <<
317 1.1 elric
318 1.1 elric {}.cpp{$(OBJ)}.obj::
319 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(localcflags) $(MPOPT) @<<
320 1.1 elric $<
321 1.1 elric <<
322 1.1 elric
323 1.1 elric {$(OBJ)}.cpp{$(OBJ)}.obj::
324 1.1 elric $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ $(extcflags) $(MPOPT) @<<
325 1.1 elric $<
326 1.1 elric <<
327 1.1 elric
328 1.1 elric {}.hin{$(INCDIR)}.h:
329 1.1 elric $(CP) $< $@
330 1.1 elric
331 1.1 elric {}.h{$(INCDIR)}.h:
332 1.1 elric $(CP) $< $@
333 1.1 elric
334 1.1 elric {}.h{$(INCDIR)\krb5}.h:
335 1.1 elric $(CP) $< $@
336 1.1 elric
337 1.1 elric {$(OBJ)}.h{$(INCDIR)}.h:
338 1.1 elric $(CP) $< $@
339 1.1 elric
340 1.1 elric {$(OBJ)}.x{$(OBJ)}.c:
341 1.1 elric $(CP) $< $@
342 1.1 elric
343 1.1 elric {$(OBJ)}.hx{$(INCDIR)}.h:
344 1.1 elric $(CP) $< $@
345 1.1 elric
346 1.1 elric {$(OBJ)}.hx{$(OBJ)}.h:
347 1.1 elric $(CP) $< $@
348 1.1 elric
349 1.1 elric {}.rc{$(OBJ)}.res:
350 1.1 elric $(RC2RES)
351 1.1 elric
352 1.1 elric #----------------------------------------------------------------------
353 1.1 elric # Announce the build directory
354 1.1 elric
355 1.1 elric !ifdef RELDIR
356 1.1 elric all:: announce
357 1.1 elric
358 1.1 elric all-tools:: announce-tools
359 1.1 elric
360 1.1 elric test:: announce
361 1.1 elric
362 1.1 elric clean:: announce
363 1.1 elric
364 1.1 elric announce:
365 1.1 elric @echo.
366 1.1 elric @echo --------- Entering $(RELDIR:\= ):
367 1.1 elric
368 1.1 elric announce-tools:
369 1.1 elric @echo.
370 1.1 elric @echo --------- Entering $(RELDIR:\= ) tools:
371 1.1 elric !endif
372 1.1 elric
373 1.1 elric #----------------------------------------------------------------------
374 1.1 elric # Create any required directories if they don't already exist
375 1.1 elric
376 1.1 elric prep:: mkdirs
377 1.1 elric
378 1.1 elric mkdirs:
379 1.1 elric ! if !exist($(OBJ))
380 1.1 elric $(MKDIR) $(OBJ)
381 1.1 elric ! endif
382 1.1 elric ! if !exist($(DESTDIR))
383 1.1 elric $(MKDIR) $(DESTDIR)
384 1.1 elric ! endif
385 1.1 elric ! if !exist($(LIBDIR))
386 1.1 elric $(MKDIR) $(LIBDIR)
387 1.1 elric ! endif
388 1.1 elric ! if !exist($(BINDIR))
389 1.1 elric $(MKDIR) $(BINDIR)
390 1.1 elric ! endif
391 1.1 elric ! if !exist($(PLUGINDIR))
392 1.1 elric $(MKDIR) $(PLUGINDIR)
393 1.1 elric ! endif
394 1.1 elric ! if !exist($(INCDIR))
395 1.1 elric $(MKDIR) $(INCDIR)
396 1.1 elric ! endif
397 1.1 elric ! if !exist($(DOCDIR))
398 1.1 elric $(MKDIR) $(DOCDIR)
399 1.1 elric ! endif
400 1.1 elric ! if !exist($(INCDIR)\gssapi)
401 1.1 elric $(MKDIR) $(INCDIR)\gssapi
402 1.1 elric ! endif
403 1.1 elric ! if !exist($(INCDIR)\hcrypto)
404 1.1 elric $(MKDIR) $(INCDIR)\hcrypto
405 1.1 elric ! endif
406 1.1 elric ! if !exist($(INCDIR)\kadm5)
407 1.1 elric $(MKDIR) $(INCDIR)\kadm5
408 1.1 elric ! endif
409 1.1 elric ! if !exist($(INCDIR)\krb5)
410 1.1 elric $(MKDIR) $(INCDIR)\krb5
411 1.1 elric ! endif
412 1.1 elric
413 1.1 elric #----------------------------------------------------------------------
414 1.1 elric # If SUBDIRS is defined, we should recurse into the subdirectories
415 1.1 elric
416 1.1 elric !ifdef SUBDIRS
417 1.1 elric subdirs:
418 1.1 elric @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) && popd) || exit /b 1
419 1.1 elric
420 1.1 elric clean-subdirs:
421 1.1 elric @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) clean && popd) || exit /b 1
422 1.1 elric
423 1.1 elric test-subdirs:
424 1.1 elric @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) test && popd) || exit /b 1
425 1.1 elric
426 1.1 elric all:: subdirs
427 1.1 elric
428 1.1 elric clean:: clean-subdirs
429 1.1 elric
430 1.1 elric test:: test-subdirs
431 1.1 elric
432 1.1 elric !endif
433 1.1 elric
434 1.1 elric #----------------------------------------------------------------------
435 1.1 elric # Clean targets
436 1.1 elric
437 1.1 elric !ifdef CLEANFILES
438 1.1 elric clean::
439 1.1 elric -$(RM) $(CLEANFILES)
440 1.1 elric !endif
441 1.1 elric !ifdef RELDIR
442 1.1 elric clean::
443 1.1 elric -$(RM) $(OBJ)\*.*
444 1.1 elric !endif
445 1.1 elric
446 1.1 elric .SUFFIXES: .c .cpp .hin .h .x .hx
447 1.1 elric
448 1.1 elric #----------------------------------------------------------------------
449 1.1 elric # Manifest handling
450 1.1 elric #
451 1.1 elric # Starting with Visual Studio 8, the C compiler and the linker
452 1.1 elric # generate manifests so that the applications will link with the
453 1.1 elric # correct side-by-side DLLs at run-time. These are required for
454 1.1 elric # correct operation under Windows XP and later. We also have custom
455 1.1 elric # manifests which need to be merged with the manifests that VS
456 1.1 elric # creates.
457 1.1 elric #
458 1.1 elric # The syntax for invoking the _VC_MANIFEST_EMBED_FOO macro is:
459 1.1 elric # $(_VC_MANIFEST_EMBED_???) <additional manifests>
460 1.1 elric #
461 1.1 elric
462 1.1 elric MT=mt.exe -nologo
463 1.1 elric
464 1.1 elric _VC_MANIFEST_EMBED_EXE= \
465 1.1 elric ( if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest $(APPMANIFEST) )
466 1.1 elric
467 1.1 elric _VC_MANIFEST_EMBED_EXE_NOHEIM= \
468 1.1 elric ( if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest )
469 1.1 elric
470 1.1 elric _VC_MANIFEST_EMBED_DLL= \
471 1.1 elric ( if exist $@.manifest $(MT) -outputresource:$@;2 -manifest $@.manifest )
472 1.1 elric
473 1.1 elric _MERGE_MANIFEST_DLL= \
474 1.1 elric ( $(MT) -inputresource:$@;2 -manifest $(APPMANIFEST) -outputresource:$@;2 )
475 1.1 elric
476 1.1 elric _INSERT_APPMANIFEST_DLL= \
477 1.1 elric ( $(MT) -manifest $(APPMANIFEST) -outputresource:$@;2 )
478 1.1 elric
479 1.1 elric # Note that if you are merging manifests, then the VS generated
480 1.1 elric # manifest should be cleaned up after calling _VC_MANIFEST_EMBED_???.
481 1.1 elric # This ensures that even if the DLL or EXE is executed in-place, the
482 1.1 elric # embedded manifest will be used. Otherwise the $@.manifest file will
483 1.1 elric # be used.
484 1.1 elric
485 1.1 elric _VC_MANIFEST_CLEAN= \
486 1.1 elric ( if exist $@.manifest $(RM) $@.manifest )
487 1.1 elric
488 1.1 elric # End of manifest handling
489 1.1 elric
490 1.1 elric #----------------------------------------------------------------------
491 1.1 elric # Code and assembly signing
492 1.1 elric #
493 1.1 elric # SIGNTOOL_C is any set of options required for certificate/private
494 1.1 elric # key selection for code signging.
495 1.1 elric #
496 1.1 elric # SIGNTOOL_O is any set of additional options to signtool.exe
497 1.1 elric #
498 1.1 elric # SIGNTOOL_T is the timestamp option
499 1.1 elric
500 1.1 elric !ifdef CODESIGN
501 1.1 elric _CODESIGN=( $(CODESIGN) $@ )
502 1.1 elric !else
503 1.1 elric
504 1.1 elric !ifdef SIGNTOOL_C
505 1.1 elric
506 1.1 elric !ifndef SIGNTOOL_T
507 1.1 elric SIGNTOOL_T=/t http://timestamp.verisign.com/scripts/timstamp.dll
508 1.1 elric !endif
509 1.1 elric
510 1.1 elric _CODESIGN=( $(SIGNTOOL) sign $(SIGNTOOL_O) $(SIGNTOOL_T) $(SIGNTOOL_C) /v $@ )
511 1.1 elric !else
512 1.1 elric _CODESIGN=( echo Skipping code sign )
513 1.1 elric !endif
514 1.1 elric
515 1.1 elric !endif
516 1.1 elric
517 1.1 elric #----------------------------------------------------------------------
518 1.1 elric # Convenience macros for preparing EXEs and DLLs. These are multiline
519 1.1 elric # macros that deal with manifests and code signing. Unless we need to
520 1.1 elric # include custom manifests, these are what we should be using to
521 1.1 elric # prepare binaries.
522 1.1 elric
523 1.1 elric EXEPREP=\
524 1.1 elric ( $(_VC_MANIFEST_EMBED_EXE) && $(_VC_MANIFEST_CLEAN) && $(_CODESIGN) ) || ( $(RM) $@ && exit /b 1 )
525 1.1 elric
526 1.1 elric EXEPREP_NOHEIM=\
527 1.1 elric ( $(_VC_MANIFEST_EMBED_EXE_NOHEIM) && $(_VC_MANIFEST_CLEAN) && $(_CODESIGN) ) || ( $(RM) $@ && exit /b 1 )
528 1.1 elric
529 1.1 elric EXEPREP_NODIST=\
530 1.1 elric ( $(_VC_MANIFEST_EMBED_EXE_NOHEIM) && $(_VC_MANIFEST_CLEAN) ) || ( $(RM) $@ && exit /b 1 )
531 1.1 elric
532 1.1 elric DLLPREP=\
533 1.1 elric ( $(_VC_MANIFEST_EMBED_DLL) && $(_VC_MANIFEST_CLEAN) && $(_CODESIGN) ) || ( $(RM) $@ && exit /b 1 )
534 1.1 elric
535 1.1 elric DLLPREP_NODIST=\
536 1.1 elric ( $(_VC_MANIFEST_EMBED_DLL) && $(_VC_MANIFEST_CLEAN) ) || ( $(RM) $@ && exit /b 1 )
537 1.1 elric
538 1.1 elric DLLPREP_MERGE=\
539 1.1 elric ( ( $(_MERGE_MANIFEST_DLL) || $(_INSERT_APPMANIFEST_DLL) ) && $(_CODESIGN) ) || ( $(RM) $@ && exit /b 1 )
540 1.1 elric
541 1.1 elric #----------------------------------------------------------------------
542 1.1 elric # Convenience macros for import libraries and assemblies
543 1.1 elric #
544 1.1 elric
545 1.1 elric LIBASN1 =$(LIBDIR)\libasn1.lib
546 1.1 elric LIBCOMERR =$(LIBDIR)\libcom_err.lib
547 1.1 elric LIBEDITLINE =$(LIBDIR)\libeditline.lib
548 1.1 elric LIBGSSAPI =$(LIBDIR)\libgssapi.lib
549 1.1 elric LIBHCRYPTO =$(LIBDIR)\libhcrypto.lib
550 1.1 elric LIBHDB =$(LIBDIR)\libhdb.lib
551 1.1 elric LIBHEIMBASE =$(LIBDIR)\libheimbase.lib
552 1.1 elric LIBHEIMDAL =$(LIBDIR)\heimdal.lib
553 1.1 elric LIBHEIMIPCC =$(LIBDIR)\libheim-ipcc.lib
554 1.1 elric LIBHEIMIPCS =$(LIBDIR)\libheim-ipcs.lib
555 1.1 elric LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib
556 1.1 elric LIBHX509 =$(LIBDIR)\libhx509.lib
557 1.1 elric LIBKADM5CLNT=$(LIBDIR)\libkadm5clnt.lib
558 1.1 elric LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib
559 1.1 elric LIBKDC =$(LIBDIR)\libkdc.lib
560 1.1 elric LIBLTM =$(LIBDIR)\libltm.lib
561 1.1 elric LIBKRB5 =$(LIBDIR)\libkrb5.lib
562 1.1 elric LIBRFC3961 =$(LIBDIR)\librfc3961.lib
563 1.1 elric LIBROKEN =$(LIBDIR)\libroken.lib
564 1.1 elric LIBSL =$(LIBDIR)\libsl.lib
565 1.1 elric LIBSQLITE =$(LIBDIR)\libsqlite.lib
566 1.1 elric LIBVERS =$(LIBDIR)\libvers.lib
567 1.1 elric LIBWIND =$(LIBDIR)\libwind.lib
568 1.1 elric
569 1.1 elric ASMKRBNAME =Heimdal.Kerberos
570 1.1 elric ASMGSSNAME =Heimdal.GSSAPI
571 1.1 elric APPMANIFEST =$(INCDIR)\Heimdal.Application.$(MCPU).manifest
572 1.1 elric
573