1 ########################################################################
3 # Copyright (c) 2009, Secure Endpoints Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # - Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
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
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.
50 !if exist($(MAKEDIR)\windows\NTMakefile.w32)
52 !elseif exist($(MAKEDIR)\..\windows\NTMakefile.w32)
54 !elseif exist($(MAKEDIR)\..\..\windows\NTMakefile.w32)
56 !elseif exist($(MAKEDIR)\..\..\..\windows\NTMakefile.w32)
57 SRC=$(MAKEDIR)\..\..\..
59 ! error Cant determine source directory
62 !include "NTMakefile.config"
64 #----------------------------------------------------------------
67 DESTDIR=$(SRC)\out\dest_$(OUTDIR)
68 OBJDIR =$(SRC)\out\obj_$(OUTDIR)
70 INCDIR =$(DESTDIR)\inc
71 LIBDIR =$(DESTDIR)\lib
72 BINDIR =$(DESTDIR)\bin
77 SRCDIR =$(SRC)\$(RELDIR)
78 OBJ =$(OBJDIR)\$(RELDIR)
84 PATH=$(PATH);$(BINDIR)
86 #----------------------------------------------------------------
89 RMAKE=nmake /nologo /f NTMakefile RECURSE=1
122 # Only used for tests
131 #----------------------------------------------------------------
132 # External dependencies
134 # For pthread support to be enabled, both PTHREAD_INC and PTHREAD_LIB
135 # should be defined. PTHREAD_INC should be the include directory
136 # where pthread.h is to be found (i.e. $(PTHREAD_INC)\pthread.h should
137 # exist), and PTHREAD_LIB is the full path to the pthread import
140 # Note that both paths should not contain any whitespace.
143 pthreadinc= -I$(PTHREAD_INC)
146 #----------------------------------------------------------------
149 cincdirs=$(cincdirs) -I$(INCDIR) -I$(INCDIR)\krb5 $(pthreadinc)
150 cdefines=$(cdefines) -DHAVE_CONFIG_H
151 cwarn=$(cwarn) -D_CRT_SECURE_NO_WARNINGS -wd4996 -wd4127 -wd4244 -wd4100
155 !elseif "$(CPU)"=="AMD64"
158 ! error Unknown CPU value
161 !ifndef STATICRUNTIME
163 C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsdll) $(AUXCFLAGS) $(cdefines) $(cincdirs) $(cwarn)
164 EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsdll)
165 EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsdll)
166 DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsdll)
167 DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsdll)
169 !else # STATICRUNTIME
171 C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(cdefines) $(cincdirs) $(cwarn)
172 EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsmt)
173 EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsmt)
174 DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsmt)
175 DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsmt)
179 LIBGUI_C = $(LM) /nologo $(libmach) /SUBSYSTEM:WINDOWS
180 LIBCON_C = $(LM) /nologo $(libmach) /SUBSYSTEM:CONSOLE
182 C2OBJ = $(C2OBJ_C) -Fo$@ -Fd$(@D)\ $**
183 EXECONLINK = $(EXECONLINK_C) -OUT:$@ $**
184 EXEGUILINK = $(EXEGUILINK_C) -OUT:$@ $**
185 DLLCONLINK = $(DLLCONLINK_C) -OUT:$@ $**
186 DLLGUILINK = $(DLLGUILINK_C) -OUT:$@ $**
187 LIBGUI = $(LIBGUI_C) /OUT:$@ $**
188 LIBCON = $(LIBCON_C) /OUT:$@ $**
190 # Preprocess files to stdout using config.h
191 CPREPROCESSOUT = $(CC) /EP /FI$(INCDIR)\config.h /TC /DCPP_ONLY=1
195 RC2RES_C = $(RC) $(cincdirs) $(AUXRCFLAGS)
196 RC2RES = $(RC2RES_C) -fo $@ $**
198 #----------------------------------------------------------------------
199 # If this is the initial invocation, we check if all the build
200 # utilities are there. Also show the commands macros.
205 @for %%g in ( "$(AWK)" "$(YACC)" "$(LEX)" "$(PYTHON)" "$(PERL)" "$(CMP)" ) do @( \
206 for /f %%f in ( "%%g" ) do @( \
209 ) else if "%%~$$PATH:f"=="" @( \
210 echo Could not find %%f in PATH && \
213 echo Found %%~$$PATH:f \
217 @for %%g in ( "$(SH)" "$(SED)" ) do @( \
218 for /f %%f in ( "%%g" ) do @( \
221 ) else if "%%~$$PATH:f"=="" @( \
222 echo Could not find %%f in PATH && \
223 echo Test targets may fail. \
225 echo Found %%~$$PATH:f \
234 @$(ECHO) C2OBJ=$(C2OBJ_C:\=\\)
236 @$(ECHO) EXECONLINK=$(EXECONLINK_C)
238 @$(ECHO) EXEGUILINK=$(EXEGUILINK_C)
240 @$(ECHO) DLLCONLINK=$(DLLCONLINK_C)
242 @$(ECHO) DLLGUILINK=$(DLLGUILINK_C)
244 @$(ECHO) LIBGUI=$(LIBGUI_C)
246 @$(ECHO) LIBCON=$(LIBCON_C)
255 {$(OBJ)}.c{$(OBJ)}.obj:
261 {$(OBJ)}.cpp{$(OBJ)}.obj:
270 {}.h{$(INCDIR)\krb5}.h:
273 {$(OBJ)}.h{$(INCDIR)}.h:
276 {$(OBJ)}.x{$(OBJ)}.c:
279 {$(OBJ)}.hx{$(INCDIR)}.h:
282 {$(OBJ)}.hx{$(OBJ)}.h:
288 #----------------------------------------------------------------------
289 # Announce the build directory
300 @echo --------- Entering $(RELDIR:\= ):
303 #----------------------------------------------------------------------
304 # Create any required directories if they don't already exist
312 ! if !exist($(DESTDIR))
315 ! if !exist($(LIBDIR))
318 ! if !exist($(BINDIR))
321 ! if !exist($(INCDIR))
324 ! if !exist($(INCDIR)\gssapi)
325 $(MKDIR) $(INCDIR)\gssapi
327 ! if !exist($(INCDIR)\hcrypto)
328 $(MKDIR) $(INCDIR)\hcrypto
330 ! if !exist($(INCDIR)\kadm5)
331 $(MKDIR) $(INCDIR)\kadm5
333 ! if !exist($(INCDIR)\krb5)
334 $(MKDIR) $(INCDIR)\krb5
337 #----------------------------------------------------------------------
338 # If SUBDIRS is defined, we should recurse into the subdirectories
342 @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) && cd ..) || exit /b 1
345 @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) clean && cd ..) || exit /b 1
348 @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) test && cd ..) || exit /b 1
352 clean:: clean-subdirs
358 #----------------------------------------------------------------------
370 .SUFFIXES: .c .cpp .hin .h .x .hx
372 #----------------------------------------------------------------------
375 # Starting with Visual Studio 8, the C compiler and the linker
376 # generate manifests so that the applications will link with the
377 # correct side-by-side DLLs at run-time. These are required for
378 # correct operation under Windows XP and later. We also have custom
379 # manifests which need to be merged with the manifests that VS
382 # The syntax for invoking the _VC_MANIFEST_EMBED_FOO macro is:
383 # $(_VC_MANIFEST_EMBED_???) <additional manifests>
388 _VC_MANIFEST_EMBED_EXE= \
389 if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest
391 _VC_MANIFEST_EMBED_DLL= \
392 if exist $@.manifest $(MT) -outputresource:$@;2 -manifest $@.manifest
394 # Note that if you are merging manifests, then the VS generated
395 # manifest should be cleaned up after calling _VC_MANIFEST_EMBED_???.
396 # This ensures that even if the DLL or EXE is executed in-place, the
397 # embedded manifest will be used. Otherwise the $@.manifest file will
400 _VC_MANIFEST_CLEAN= \
401 if exist $@.manifest $(RM) $@.manifest
403 # End of manifest handling
407 _CODESIGN=$(CODESIGN) $@
412 #----------------------------------------------------------------------
413 # Convenience macros for preparing EXEs and DLLs. These are multiline
414 # macros that deal with manifests and code signing. Unless we need to
415 # include custom manifests, these are what we should be using to
419 $(_VC_MANIFEST_EMBED_EXE)^
420 $(_VC_MANIFEST_CLEAN)^
424 $(_VC_MANIFEST_EMBED_EXE)^
425 $(_VC_MANIFEST_CLEAN)
428 $(_VC_MANIFEST_EMBED_DLL)^
429 $(_VC_MANIFEST_CLEAN)^
433 $(_VC_MANIFEST_EMBED_DLL)^
434 $(_VC_MANIFEST_CLEAN)
436 #----------------------------------------------------------------------
437 # Convenience macros for import libraries
440 LIBROKEN =$(LIBDIR)\libroken.lib
441 LIBVERS =$(LIBDIR)\libvers.lib
442 LIBEDITLINE =$(LIBDIR)\libeditline.lib
443 LIBCOMERR =$(LIBDIR)\libcom_err.lib
444 LIBSL =$(LIBDIR)\libsl.lib
445 LIBWIND =$(LIBDIR)\libwind.lib
446 LIBASN1 =$(LIBDIR)\libasn1.lib
447 LIBSQLITE =$(LIBDIR)\libsqlite.lib
448 LIBHCRYPTO =$(LIBDIR)\libhcrypto.lib
449 LIBHX509 =$(LIBDIR)\libhx509.lib
450 LIBKRB5 =$(LIBDIR)\libkrb5.lib
451 LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib
452 LIBHEIMIPCC =$(LIBDIR)\libheim-ipcc.lib
453 LIBHEIMIPCS =$(LIBDIR)\libheim-ipcs.lib
454 LIBGSSAPI =$(LIBDIR)\libgssapi.lib
455 LIBHDB =$(LIBDIR)\libhdb.lib
456 LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib
457 LIBKADM5CLNT=$(LIBDIR)\libkadm5clnt.lib
458 LIBKDC =$(LIBDIR)\libkdc.lib
459 LIBTFM =$(LIBDIR)\libtfm.lib