add heim_ipc_types.h
[heimdal.git] / windows / NTMakefile.w32
blobf719fd8f085052938bc41460f4fa6f9bf17f88a4
1 ########################################################################
3 # Copyright (c) 2009, Secure Endpoints Inc.
4 # All rights reserved.
5
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9
10 # - Redistributions of source code must retain the above copyright
11 #   notice, this list of conditions and the following disclaimer.
12
13 # - Redistributions in binary form must reproduce the above copyright
14 #   notice, this list of conditions and the following disclaimer in
15 #   the documentation and/or other materials provided with the
16 #   distribution.
17
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
30
32 all::
34 clean::
36 test::
38 prep::
40 all:: prep
42 !include <Win32.Mak>
44 !ifdef NODEBUG
45 BUILD=rel
46 !else
47 BUILD=dbg
48 !endif
50 !if exist($(MAKEDIR)\windows\NTMakefile.w32)
51 SRC=$(MAKEDIR)
52 !elseif exist($(MAKEDIR)\..\windows\NTMakefile.w32)
53 SRC=$(MAKEDIR)\..
54 !elseif exist($(MAKEDIR)\..\..\windows\NTMakefile.w32)
55 SRC=$(MAKEDIR)\..\..
56 !elseif exist($(MAKEDIR)\..\..\..\windows\NTMakefile.w32)
57 SRC=$(MAKEDIR)\..\..\..
58 !else
59 !  error Cant determine source directory
60 !endif
62 !  if "$(CPU)"=="i386" || "$(CPU)"=="x86"
63 MCPU=x86
64 !  elseif "$(CPU)"=="AMD64"
65 MCPU=amd64
66 !  else
67 !    error Unknown CPU
68 !  endif
70 !include "NTMakefile.config"
72 #----------------------------------------------------------------
73 # Directory macros
75 DESTDIR=$(SRC)\out\dest_$(OUTDIR)
76 OBJDIR =$(SRC)\out\obj_$(OUTDIR)
78 INCDIR =$(DESTDIR)\inc
79 LIBDIR =$(DESTDIR)\lib
80 BINDIR =$(DESTDIR)\bin
81 SBINDIR=$(BINDIR)
82 LIBEXECDIR=$(BINDIR)
83 ASMDIR=$(BINDIR)
85 !ifdef RELDIR
86 SRCDIR =$(SRC)\$(RELDIR)
87 OBJ    =$(OBJDIR)\$(RELDIR)
88 !else
89 OBJ    =$(OBJDIR)
90 !endif
92 # For tests:
93 PATH=$(PATH);$(BINDIR)
95 #----------------------------------------------------------------
96 # Command macros
98 RMAKE=nmake /nologo /f NTMakefile RECURSE=1
99 MKDIR=md
100 CP=copy /Y
101 LINK=link
102 LM=lib
103 RM=del /q
104 ECHO=echo
105 RC=rc
107 AWK=gawk.exe
108 YACC=bison.exe -y
109 LEX=flex.exe
110 PYTHON=python.exe
111 PERL=perl.exe
112 CMP=cmp.exe
113 SIGNTOOL=signtool.exe
114 MAKECAT=makecat.exe
116 # Only used for tests
117 SH=sh.exe
118 SED=sed.exe
120 #----------------------------------------------------------------
121 # External dependencies
123 # For pthread support to be enabled, both PTHREAD_INC and PTHREAD_LIB
124 # should be defined.  PTHREAD_INC should be the include directory
125 # where pthread.h is to be found (i.e. $(PTHREAD_INC)\pthread.h should
126 # exist), and PTHREAD_LIB is the full path to the pthread import
127 # library.
129 # Note that both paths should not contain any whitespace.
131 !ifdef PTHREAD_INC
132 pthreadinc= -I$(PTHREAD_INC)
133 !endif
135 #----------------------------------------------------------------
136 # Build options
138 cincdirs=$(cincdirs) -I$(INCDIR) -I$(INCDIR)\krb5 $(pthreadinc)
139 cdefines=$(cdefines) -DHAVE_CONFIG_H
141 # ---------------------------------------------------------------
142 # time_t issues
144 !if "$(MCPU)"=="x86"
145 cdefines=$(cdefines) -D_USE_32BIT_TIME_T
146 !endif
148 # Disable warnings:
150 # C4996: 'function' was declared deprecated
151 # C4127: Conditional expression is constant
152 # C4244: Conversion from 'type1' to 'type2', possible loss of data
153 # C4100: 'identifier': unreferenced formal parameter
154 # C4706: Assignment within conditional expression
155 # C4214: Nonstandard extension used
156 # C4267: '': Conversion from 'type1' to 'type2', possible loss of data
157 # C4018: '': Signed/unsigned mismatch
158 # C4204: Nonstandard extension used: non-constant aggregate initializer
159 # C4221: Nonstandard extension used: 'v1': cannot be initialized using address of automatic variable 'v2'
160 # C4295: '': Array is too small to include a terminating null character
162 cwarn=$(cwarn) -D_CRT_SECURE_NO_WARNINGS -wd4996 -wd4127 -wd4244 -wd4100 -wd4706
163 cwarn=$(cwarn) -wd4214 -wd4267 -wd4018 -wd4389 -wd4204 -wd4221 -wd4295
165 !if "$(CPU)"=="i386"
166 libmach=/machine:X86
167 !elseif "$(CPU)"=="AMD64"
168 libmach=/machine:X64
169 !else
170 !  error Unknown CPU value
171 !endif
173 !ifndef STATICRUNTIME
175 C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsdll) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn)
176 EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsdll) $(libmach)
177 EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsdll) $(libmach)
178 DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsdll) $(libmach)
179 DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsdll) $(libmach)
181 !else # STATICRUNTIME
183 C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn)
184 EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsmt) $(libmach)
185 EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsmt) $(libmach)
186 DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsmt) $(libmach)
187 DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsmt) $(libmach)
189 !endif
191 LIBGUI_C = $(LM) /nologo $(libmach) /SUBSYSTEM:WINDOWS
192 LIBCON_C = $(LM) /nologo $(libmach) /SUBSYSTEM:CONSOLE
194 C2OBJ = $(C2OBJ_C) -Fo$@ -Fd$(@D)\ $**
195 C2OBJ_NP = $(C2OBJ_C) -MP $<
196 C2OBJ_P = $(C2OBJ_NP) -Fo$(OBJ)\ -Fd$(OBJ)\ #
197 EXECONLINK = $(EXECONLINK_C) -OUT:$@ $**
198 EXEGUILINK = $(EXEGUILINK_C) -OUT:$@ $**
199 DLLCONLINK = $(DLLCONLINK_C) -OUT:$@ $**
200 DLLGUILINK = $(DLLGUILINK_C) -OUT:$@ $**
201 LIBGUI = $(LIBGUI_C) /OUT:$@ $**
202 LIBCON = $(LIBCON_C) /OUT:$@ $**
204 # Preprocess files to stdout using config.h
205 CPREPROCESSOUT = $(CC) /EP /FI$(INCDIR)\config.h /TC /DCPP_ONLY=1
207 # Resources
209 RC2RES_C = $(RC) $(cincdirs) $(AUXRCFLAGS)
210 RC2RES = $(RC2RES_C) -fo $@ $**
212 #----------------------------------------------------------------------
213 # If this is the initial invocation, we check if all the build
214 # utilities are there.  Also show the commands macros.
216 !ifndef RECURSE
218 check-utils:
219         @for %%g in ( "$(AWK)" "$(YACC)" "$(LEX)" "$(PYTHON)" "$(PERL)" "$(CMP)" "$(SED)" "$(SIGNTOOL)" "$(MAKECAT)" ) do @( \
220         for /f %%f in ( "%%g" ) do @( \
221                 if exist %%f @( \
222                         echo Found %%f \
223                 ) else if "%%~$$PATH:f"=="" @( \
224                         echo Could not find %%f in PATH && \
225                         exit /b 1 \
226                 ) else @( \
227                         echo Found %%~$$PATH:f \
228                 ) \
229         ) \
230         )
231         @for %%g in ( "$(SH)" ) do @( \
232         for /f %%f in ( "%%g" ) do @( \
233                 if exist %%f @( \
234                         echo Found %%f \
235                 ) else if "%%~$$PATH:f"=="" @( \
236                         echo Could not find %%f in PATH && \
237                         echo Test targets may fail. \
238                 ) else @( \
239                         echo Found %%~$$PATH:f \
240                 ) \
241         ) \
242         )
245 prep:: check-utils
247 show-cmds:
248         @$(ECHO) C2OBJ=$(C2OBJ_C:\=\\)
249         @$(ECHO).
250         @$(ECHO) EXECONLINK=$(EXECONLINK_C)
251         @$(ECHO).
252         @$(ECHO) EXEGUILINK=$(EXEGUILINK_C)
253         @$(ECHO).
254         @$(ECHO) DLLCONLINK=$(DLLCONLINK_C)
255         @$(ECHO).
256         @$(ECHO) DLLGUILINK=$(DLLGUILINK_C)
257         @$(ECHO).
258         @$(ECHO) LIBGUI=$(LIBGUI_C)
259         @$(ECHO).
260         @$(ECHO) LIBCON=$(LIBCON_C)
262 prep:: show-cmds
264 !endif                          # RECURSE
266 {}.c{$(OBJ)}.obj::
267         $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ /MP @<<
271 {$(OBJ)}.c{$(OBJ)}.obj::
272         $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ /MP @<<
276 {}.cpp{$(OBJ)}.obj::
277         $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ /MP @<<
281 {$(OBJ)}.cpp{$(OBJ)}.obj::
282         $(C2OBJ_C) /Fd$(OBJ)\ /Fo$(OBJ)\ /MP @<<
286 {}.hin{$(INCDIR)}.h:
287         $(CP) $< $@
289 {}.h{$(INCDIR)}.h:
290         $(CP) $< $@
292 {}.h{$(INCDIR)\krb5}.h:
293         $(CP) $< $@
295 {$(OBJ)}.h{$(INCDIR)}.h:
296         $(CP) $< $@
298 {$(OBJ)}.x{$(OBJ)}.c:
299         $(CP) $< $@
301 {$(OBJ)}.hx{$(INCDIR)}.h:
302         $(CP) $< $@
304 {$(OBJ)}.hx{$(OBJ)}.h:
305         $(CP) $< $@
307 {}.rc{$(OBJ)}.res:
308         $(RC2RES)
310 #----------------------------------------------------------------------
311 # Announce the build directory
313 !ifdef RELDIR
314 all:: announce
316 all-tools:: announce-tools
318 test:: announce
320 clean:: announce
322 announce:
323         @echo.
324         @echo --------- Entering $(RELDIR:\= ):
326 announce-tools:
327         @echo.
328         @echo --------- Entering $(RELDIR:\= ) tools:
329 !endif
331 #----------------------------------------------------------------------
332 # Create any required directories if they don't already exist
334 prep:: mkdirs
336 mkdirs:
337 !  if !exist($(OBJ))
338         $(MKDIR) $(OBJ)
339 !  endif
340 !  if !exist($(DESTDIR))
341         $(MKDIR) $(DESTDIR)
342 !  endif
343 !  if !exist($(LIBDIR))
344         $(MKDIR) $(LIBDIR)
345 !  endif
346 !  if !exist($(BINDIR))
347         $(MKDIR) $(BINDIR)
348 !  endif
349 !  if !exist($(INCDIR))
350         $(MKDIR) $(INCDIR)
351 !  endif
352 !  if !exist($(INCDIR)\gssapi)
353         $(MKDIR) $(INCDIR)\gssapi
354 !  endif
355 !  if !exist($(INCDIR)\hcrypto)
356         $(MKDIR) $(INCDIR)\hcrypto
357 !  endif
358 !  if !exist($(INCDIR)\kadm5)
359         $(MKDIR) $(INCDIR)\kadm5
360 !  endif
361 !  if !exist($(INCDIR)\krb5)
362         $(MKDIR) $(INCDIR)\krb5
363 !  endif
365 #----------------------------------------------------------------------
366 # If SUBDIRS is defined, we should recurse into the subdirectories
368 !ifdef SUBDIRS
369 subdirs:
370         @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) && popd) || exit /b 1
372 clean-subdirs:
373         @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) clean && popd) || exit /b 1
375 test-subdirs:
376         @for %%f in ( $(SUBDIRS) ) do @ (pushd %%f && $(RMAKE) test && popd) || exit /b 1
378 all:: subdirs
380 clean:: clean-subdirs
382 test:: test-subdirs
384 !endif
386 #----------------------------------------------------------------------
387 # Clean targets
389 !ifdef CLEANFILES
390 clean::
391         -$(RM) $(CLEANFILES)
392 !endif
393 !ifdef RELDIR
394 clean::
395         -$(RM) $(OBJ)\*.*
396 !endif
398 .SUFFIXES: .c .cpp .hin .h .x .hx
400 #----------------------------------------------------------------------
401 # Manifest handling
403 # Starting with Visual Studio 8, the C compiler and the linker
404 # generate manifests so that the applications will link with the
405 # correct side-by-side DLLs at run-time.  These are required for
406 # correct operation under Windows XP and later.  We also have custom
407 # manifests which need to be merged with the manifests that VS
408 # creates.
410 # The syntax for invoking the _VC_MANIFEST_EMBED_FOO macro is:
411 # $(_VC_MANIFEST_EMBED_???) <additional manifests>
414 MT=mt.exe -nologo
416 _VC_MANIFEST_EMBED_EXE= \
417 ( if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest )
419 _VC_MANIFEST_EMBED_DLL= \
420 ( if exist $@.manifest $(MT) -outputresource:$@;2 -manifest $@.manifest )
422 # Note that if you are merging manifests, then the VS generated
423 # manifest should be cleaned up after calling _VC_MANIFEST_EMBED_???.
424 # This ensures that even if the DLL or EXE is executed in-place, the
425 # embedded manifest will be used.  Otherwise the $@.manifest file will
426 # be used.
428 _VC_MANIFEST_CLEAN= \
429 ( if exist $@.manifest $(RM) $@.manifest )
431 # End of manifest handling
433 #----------------------------------------------------------------------
434 # Code and assembly signing
436 # SIGNTOOL_C is any set of options required for certificate/private
437 # key selection for code signging.
439 # SIGNTOOL_O is any set of additional options to signtool.exe
441 # SIGNTOOL_T is the timestamp option
443 !ifdef CODESIGN
444 _CODESIGN=( $(CODESIGN) $@ )
445 !else
447 !ifdef SIGNTOOL_C
449 !ifndef SIGNTOOL_T
450 SIGNTOOL_T=/t http://timestamp.verisign.com/scripts/timstamp.dll
451 !endif
453 _CODESIGN=( $(SIGNTOOL) sign $(SIGNTOOL_O) $(SIGNTOOL_T) $(SIGNTOOL_C) /v $@ )
454 !else
455 _CODESIGN=( echo Skipping code sign )
456 !endif
458 !endif
460 #----------------------------------------------------------------------
461 # Convenience macros for preparing EXEs and DLLs.  These are multiline
462 # macros that deal with manifests and code signing.  Unless we need to
463 # include custom manifests, these are what we should be using to
464 # prepare binaries.
466 EXEPREP=\
467 ( $(_VC_MANIFEST_EMBED_EXE) && $(_VC_MANIFEST_CLEAN) && $(_CODESIGN) ) || $(RM) $@
469 EXEPREP_NODIST=\
470 ( $(_VC_MANIFEST_EMBED_EXE) && $(_VC_MANIFEST_CLEAN) ) || $(RM) $@
472 DLLPREP=\
473 ( $(_VC_MANIFEST_EMBED_DLL) && $(_VC_MANIFEST_CLEAN) && $(_CODESIGN) ) || $(RM) $@
475 DLLPREP_NODIST=\
476 ( $(_VC_MANIFEST_EMBED_DLL) && $(_VC_MANIFEST_CLEAN) ) || $(RM) $@
478 #----------------------------------------------------------------------
479 # Convenience macros for import libraries and assemblies
482 LIBASN1     =$(LIBDIR)\libasn1.lib
483 LIBCOMERR   =$(LIBDIR)\libcom_err.lib
484 LIBEDITLINE =$(LIBDIR)\libeditline.lib
485 LIBGSSAPI   =$(LIBDIR)\libgssapi.lib
486 LIBHCRYPTO  =$(LIBDIR)\libhcrypto.lib
487 LIBHDB      =$(LIBDIR)\libhdb.lib
488 LIBHEIMDAL  =$(LIBDIR)\heimdal.lib
489 LIBHEIMIPCC =$(LIBDIR)\libheim-ipcc.lib
490 LIBHEIMIPCS =$(LIBDIR)\libheim-ipcs.lib
491 LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib
492 LIBHX509    =$(LIBDIR)\libhx509.lib
493 LIBKADM5CLNT=$(LIBDIR)\libkadm5clnt.lib
494 LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib
495 LIBKDC      =$(LIBDIR)\libkdc.lib
496 LIBLTM      =$(LIBDIR)\libltm.lib
497 LIBKRB5     =$(LIBDIR)\libkrb5.lib
498 LIBROKEN    =$(LIBDIR)\libroken.lib
499 LIBSL       =$(LIBDIR)\libsl.lib
500 LIBSQLITE   =$(LIBDIR)\libsqlite.lib
501 LIBVERS     =$(LIBDIR)\libvers.lib
502 LIBWIND     =$(LIBDIR)\libwind.lib
504 ASMKRBNAME  =Heimdal.Kerberos
505 ASMGSSNAME  =Heimdal.GSSAPI
506 APPMANIFEST =$(INCDIR)\Heimdal.Application.$(MCPU).manifest