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