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)
57 ! error Cant determine source directory
60 !include "NTMakefile.config"
62 #----------------------------------------------------------------
65 DESTDIR=$(SRC)\out32\dest_$(OUTDIR)
66 OBJDIR =$(SRC)\out32\obj_$(OUTDIR)
68 INCDIR =$(DESTDIR)\inc
69 LIBDIR =$(DESTDIR)\lib
70 BINDIR =$(DESTDIR)\bin
75 SRCDIR =$(SRC)\$(RELDIR)
76 OBJ =$(OBJDIR)\$(RELDIR)
82 PATH=$(PATH);$(BINDIR)
84 #----------------------------------------------------------------
87 RMAKE=nmake /nologo /f NTMakefile RECURSE=1
120 # Only used for tests
129 #----------------------------------------------------------------
130 # External dependencies
132 # For pthread support to be enabled, both PTHREAD_INC and PTHREAD_LIB
133 # should be defined. PTHREAD_INC should be the include directory
134 # where pthread.h is to be found (i.e. $(PTHREAD_INC)\pthread.h should
135 # exist), and PTHREAD_LIB is the full path to the pthread import
138 # Note that both paths should not contain any whitespace.
141 pthreadinc= -I$(PTHREAD_INC)
144 #----------------------------------------------------------------
147 cincdirs=$(cincdirs) -I$(INCDIR) -I$(INCDIR)\krb5 $(pthreadinc)
148 cdefines=$(cdefines) -DHAVE_CONFIG_H
149 cwarn=$(cwarn) -D_CRT_SECURE_NO_WARNINGS -wd4996
153 !elseif "$(CPU)"=="AMD64"
156 ! error Unknown CPU value
159 !ifndef STATICRUNTIME
161 C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsdll) $(AUXCFLAGS) $(cdefines) $(cincdirs) $(cwarn)
162 EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsdll)
163 EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsdll)
164 DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsdll)
165 DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsdll)
167 !else # STATICRUNTIME
169 C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(cdefines) $(cincdirs) $(cwarn)
170 EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsmt)
171 EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsmt)
172 DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsmt)
173 DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsmt)
177 LIBGUI_C = $(LM) /nologo $(libmach) /SUBSYSTEM:WINDOWS
178 LIBCON_C = $(LM) /nologo $(libmach) /SUBSYSTEM:CONSOLE
180 C2OBJ = $(C2OBJ_C) -Fo$@ -Fd$(@D)\ $**
181 EXECONLINK = $(EXECONLINK_C) -OUT:$@ $**
182 EXEGUILINK = $(EXEGUILINK_C) -OUT:$@ $**
183 DLLCONLINK = $(DLLCONLINK_C) -OUT:$@ $**
184 DLLGUILINK = $(DLLGUILINK_C) -OUT:$@ $**
185 LIBGUI = $(LIBGUI_C) /OUT:$@ $**
186 LIBCON = $(LIBCON_C) /OUT:$@ $**
188 # Preprocess files to stdout using config.h
189 CPREPROCESSOUT = $(CC) /EP /FI$(INCDIR)\config.h /TC /DCPP_ONLY=1
193 RC2RES_C = $(RC) $(cincdirs) $(AUXRCFLAGS)
194 RC2RES = $(RC2RES_C) -fo $@ $**
196 #----------------------------------------------------------------------
197 # If this is the initial invocation, we check if all the build
198 # utilities are there. Also show the commands macros.
203 @for %%g in ( "$(AWK)" "$(YACC)" "$(LEX)" "$(PYTHON)" "$(PERL)" "$(CMP)" ) do @( \
204 for /f %%f in ( "%%g" ) do @( \
207 ) else if "%%~$$PATH:f"=="" @( \
208 echo Could not find %%f in PATH && \
211 echo Found %%~$$PATH:f \
215 @for %%g in ( "$(SH)" "$(SED)" ) do @( \
216 for /f %%f in ( "%%g" ) do @( \
219 ) else if "%%~$$PATH:f"=="" @( \
220 echo Could not find %%f in PATH && \
221 echo Test targets may fail. \
223 echo Found %%~$$PATH:f \
232 @$(ECHO) C2OBJ=$(C2OBJ_C:\=\\)
234 @$(ECHO) EXECONLINK=$(EXECONLINK_C)
236 @$(ECHO) EXEGUILINK=$(EXEGUILINK_C)
238 @$(ECHO) DLLCONLINK=$(DLLCONLINK_C)
240 @$(ECHO) DLLGUILINK=$(DLLGUILINK_C)
242 @$(ECHO) LIBGUI=$(LIBGUI_C)
244 @$(ECHO) LIBCON=$(LIBCON_C)
253 {$(OBJ)}.c{$(OBJ)}.obj:
259 {$(OBJ)}.cpp{$(OBJ)}.obj:
268 {}.h{$(INCDIR)\krb5}.h:
271 {$(OBJ)}.h{$(INCDIR)}.h:
274 {$(OBJ)}.x{$(OBJ)}.c:
277 {$(OBJ)}.hx{$(INCDIR)}.h:
280 {$(OBJ)}.hx{$(OBJ)}.h:
286 #----------------------------------------------------------------------
287 # Announce the build directory
298 @echo --------- Entering $(RELDIR:\= ):
301 #----------------------------------------------------------------------
302 # Create any required directories if they don't already exist
310 ! if !exist($(DESTDIR))
313 ! if !exist($(LIBDIR))
316 ! if !exist($(BINDIR))
319 ! if !exist($(INCDIR))
322 ! if !exist($(INCDIR)\gssapi)
323 $(MKDIR) $(INCDIR)\gssapi
325 ! if !exist($(INCDIR)\hcrypto)
326 $(MKDIR) $(INCDIR)\hcrypto
328 ! if !exist($(INCDIR)\kadm5)
329 $(MKDIR) $(INCDIR)\kadm5
331 ! if !exist($(INCDIR)\krb5)
332 $(MKDIR) $(INCDIR)\krb5
335 #----------------------------------------------------------------------
336 # If SUBDIRS is defined, we should recurse into the subdirectories
340 @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) && cd ..) || exit /b 1
343 @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) clean && cd ..) || exit /b 1
346 @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) test && cd ..) || exit /b 1
350 clean:: clean-subdirs
356 #----------------------------------------------------------------------
368 .SUFFIXES: .c .cpp .hin .h .x .hx
370 #----------------------------------------------------------------------
373 # Starting with Visual Studio 8, the C compiler and the linker
374 # generate manifests so that the applications will link with the
375 # correct side-by-side DLLs at run-time. These are required for
376 # correct operation under Windows XP and later. We also have custom
377 # manifests which need to be merged with the manifests that VS
380 # The syntax for invoking the _VC_MANIFEST_EMBED_FOO macro is:
381 # $(_VC_MANIFEST_EMBED_???) <additional manifests>
386 _VC_MANIFEST_EMBED_EXE= \
387 if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest
389 _VC_MANIFEST_EMBED_DLL= \
390 if exist $@.manifest $(MT) -outputresource:$@;2 -manifest $@.manifest
392 # Note that if you are merging manifests, then the VS generated
393 # manifest should be cleaned up after calling _VC_MANIFEST_EMBED_???.
394 # This ensures that even if the DLL or EXE is executed in-place, the
395 # embedded manifest will be used. Otherwise the $@.manifest file will
398 _VC_MANIFEST_CLEAN= \
399 if exist $@.manifest $(RM) $@.manifest
401 # End of manifest handling
405 _CODESIGN=$(CODESIGN) $@
410 #----------------------------------------------------------------------
411 # Convenience macros for preparing EXEs and DLLs. These are multiline
412 # macros that deal with manifests and code signing. Unless we need to
413 # include custom manifests, these are what we should be using to
417 $(_VC_MANIFEST_EMBED_EXE)^
418 $(_VC_MANIFEST_CLEAN)^
422 $(_VC_MANIFEST_EMBED_EXE)^
423 $(_VC_MANIFEST_CLEAN)
426 $(_VC_MANIFEST_EMBED_DLL)^
427 $(_VC_MANIFEST_CLEAN)^
431 $(_VC_MANIFEST_EMBED_DLL)^
432 $(_VC_MANIFEST_CLEAN)
434 #----------------------------------------------------------------------
435 # Convenience macros for import libraries
438 LIBROKEN =$(LIBDIR)\libroken.lib
439 LIBVERS =$(LIBDIR)\libvers.lib
440 LIBEDITLINE =$(LIBDIR)\libeditline.lib
441 LIBCOMERR =$(LIBDIR)\libcom_err.lib
442 LIBSL =$(LIBDIR)\libsl.lib
443 LIBWIND =$(LIBDIR)\libwind.lib
444 LIBASN1 =$(LIBDIR)\libasn1.lib
445 LIBSQLITE =$(LIBDIR)\libsqlite.lib
446 LIBHCRYPTO =$(LIBDIR)\libhcrypto.lib
447 LIBHX509 =$(LIBDIR)\libhx509.lib
448 LIBKRB5 =$(LIBDIR)\libkrb5.lib
449 LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib
450 LIBHEIMIPCC =$(LIBDIR)\libheim-ipcc.lib
451 LIBHEIMIPCS =$(LIBDIR)\libheim-ipcs.lib
452 LIBGSSAPI =$(LIBDIR)\libgssapi.lib
453 LIBHDB =$(LIBDIR)\libhdb.lib
454 LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib
455 LIBKADM5CLNT=$(LIBDIR)\libkadm5clnt.lib
456 LIBKDC =$(LIBDIR)\libkdc.lib