Home | History | Annotate | Download | only in win32
      1 # Makefile for libxml2, specific for Windows, MSVC and NMAKE.
      2 #
      3 # Take a look at the beginning and modify the variables to suit your 
      4 # environment. Having done that, you can do a
      5 #
      6 # nmake [all]     to build the libxml and the accompanying utilities.
      7 # nmake clean     to remove all compiler output files and return to a
      8 #                 clean state.
      9 # nmake rebuild   to rebuild everything from scratch. This basically does
     10 #                 a 'nmake clean' and then a 'nmake all'.
     11 # nmake install   to install the library and its header files.
     12 #
     13 # March 2002, Igor Zlatkovic <igor (a] zlatkovic.com>
     14 
     15 # There should never be a need to modify anything below this line.
     16 # ----------------------------------------------------------------
     17 
     18 AUTOCONF = .\config.msvc
     19 !include $(AUTOCONF)
     20 
     21 # Names of various input and output components.
     22 XML_NAME = xml2
     23 XML_BASENAME = lib$(XML_NAME)
     24 XML_SO = $(XML_BASENAME).dll
     25 XML_RES = $(XML_BASENAME).res
     26 XML_IMP = $(XML_BASENAME).lib
     27 XML_DEF = $(XML_BASENAME).def
     28 XML_A = $(XML_BASENAME)_a.lib
     29 XML_A_DLL = $(XML_BASENAME)_a_dll.lib
     30 
     31 # Place where we let the compiler put its output.
     32 BINDIR = bin.msvc
     33 XML_INTDIR = int.msvc
     34 XML_INTDIR_A = int.a.msvc
     35 XML_INTDIR_A_DLL = int.a.dll.msvc
     36 UTILS_INTDIR = int.utils.msvc
     37 
     38 # The preprocessor and its options.
     39 CPP = cl.exe /EP
     40 CPPFLAGS = /nologo /I$(XML_SRCDIR)\include /D "NOLIBTOOL" 
     41 !if "$(WITH_THREADS)" != "no"
     42 CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT"
     43 !endif
     44 
     45 # The compiler and its options.
     46 CC = cl.exe
     47 CFLAGS = /nologo /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W3 /wd4244 /wd4267 $(CRUNTIME)
     48 CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX)
     49 !if "$(WITH_THREADS)" != "no"
     50 CFLAGS = $(CFLAGS) /D "_REENTRANT"
     51 !endif
     52 !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
     53 CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" /D "HAVE_COMPILER_TLS"
     54 !else if "$(WITH_THREADS)" == "native"
     55 CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS"
     56 !else if "$(WITH_THREADS)" == "posix"
     57 CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H"
     58 !endif
     59 CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
     60 
     61 # The linker and its options.
     62 LD = link.exe
     63 LDFLAGS = /nologo /VERSION:$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION)
     64 LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX)
     65 LIBS =
     66 !if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1"
     67 LIBS = $(LIBS) wsock32.lib ws2_32.lib
     68 !endif 
     69 !if "$(WITH_ICONV)" == "1"
     70 LIBS = $(LIBS) iconv.lib
     71 !endif 
     72 !if "$(WITH_ICU)" == "1"
     73 !if "$(STATIC)" == "1"
     74 LIBS = $(LIBS) advapi32.lib sicuuc.lib sicuin.lib sicudt.lib
     75 !else
     76 LIBS = $(LIBS) icuuc.lib icuin.lib icudt.lib
     77 !endif
     78 !endif
     79 !if "$(WITH_ZLIB)" == "1"
     80 # could be named differently zdll or zlib
     81 # LIBS = $(LIBS) zdll.lib
     82 LIBS = $(LIBS) zlib.lib
     83 !endif
     84 !if "$(WITH_LZMA)" == "1"
     85 LIBS = $(LIBS) liblzma.lib
     86 !endif
     87 !if "$(WITH_THREADS)" == "posix"
     88 LIBS = $(LIBS) pthreadVC.lib
     89 !endif
     90 !if "$(WITH_MODULES)" == "1"
     91 LIBS = $(LIBS) kernel32.lib
     92 !endif
     93 
     94 # The archiver and its options.
     95 AR = lib.exe
     96 ARFLAGS = /nologo
     97 
     98 # Optimisation and debug symbols.
     99 !if "$(DEBUG)" == "1"
    100 CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7
    101 LDFLAGS = $(LDFLAGS) /DEBUG
    102 !else
    103 CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 
    104 # commented out as this break VC10 c.f. 634846
    105 # LDFLAGS = $(LDFLAGS) /OPT:NOWIN98
    106 LDFLAGS = $(LDFLAGS)
    107 !endif
    108 
    109 # Libxml object files.
    110 XML_OBJS = $(XML_INTDIR)\buf.obj\
    111 	$(XML_INTDIR)\c14n.obj\
    112 	$(XML_INTDIR)\catalog.obj\
    113 	$(XML_INTDIR)\chvalid.obj\
    114 	$(XML_INTDIR)\debugXML.obj\
    115 	$(XML_INTDIR)\dict.obj\
    116 	$(XML_INTDIR)\DOCBparser.obj\
    117 	$(XML_INTDIR)\encoding.obj\
    118 	$(XML_INTDIR)\entities.obj\
    119 	$(XML_INTDIR)\error.obj\
    120 	$(XML_INTDIR)\globals.obj\
    121 	$(XML_INTDIR)\hash.obj\
    122 	$(XML_INTDIR)\HTMLparser.obj\
    123 	$(XML_INTDIR)\HTMLtree.obj\
    124 	$(XML_INTDIR)\legacy.obj\
    125 	$(XML_INTDIR)\list.obj\
    126 	$(XML_INTDIR)\nanoftp.obj\
    127 	$(XML_INTDIR)\nanohttp.obj\
    128 	$(XML_INTDIR)\parser.obj\
    129 	$(XML_INTDIR)\parserInternals.obj\
    130 	$(XML_INTDIR)\pattern.obj\
    131 	$(XML_INTDIR)\relaxng.obj\
    132 	$(XML_INTDIR)\SAX2.obj\
    133 	$(XML_INTDIR)\SAX.obj\
    134 	$(XML_INTDIR)\schematron.obj\
    135 	$(XML_INTDIR)\threads.obj\
    136 	$(XML_INTDIR)\tree.obj\
    137 	$(XML_INTDIR)\uri.obj\
    138 	$(XML_INTDIR)\valid.obj\
    139 	$(XML_INTDIR)\xinclude.obj\
    140 	$(XML_INTDIR)\xlink.obj\
    141 	$(XML_INTDIR)\xmlIO.obj\
    142 	$(XML_INTDIR)\xmlmemory.obj\
    143 	$(XML_INTDIR)\xmlreader.obj\
    144 	$(XML_INTDIR)\xmlregexp.obj\
    145 	$(XML_INTDIR)\xmlmodule.obj\
    146 	$(XML_INTDIR)\xmlsave.obj\
    147 	$(XML_INTDIR)\xmlschemas.obj\
    148 	$(XML_INTDIR)\xmlschemastypes.obj\
    149 	$(XML_INTDIR)\xmlunicode.obj\
    150 	$(XML_INTDIR)\xmlwriter.obj\
    151 	$(XML_INTDIR)\xpath.obj\
    152 	$(XML_INTDIR)\xpointer.obj\
    153 	$(XML_INTDIR)\xmlstring.obj
    154 
    155 # Static libxml object files.
    156 XML_OBJS_A = $(XML_INTDIR_A)\buf.obj\
    157 	$(XML_INTDIR_A)\c14n.obj\
    158 	$(XML_INTDIR_A)\catalog.obj\
    159 	$(XML_INTDIR_A)\chvalid.obj\
    160 	$(XML_INTDIR_A)\debugXML.obj\
    161 	$(XML_INTDIR_A)\dict.obj\
    162 	$(XML_INTDIR_A)\DOCBparser.obj\
    163 	$(XML_INTDIR_A)\encoding.obj\
    164 	$(XML_INTDIR_A)\entities.obj\
    165 	$(XML_INTDIR_A)\error.obj\
    166 	$(XML_INTDIR_A)\globals.obj\
    167 	$(XML_INTDIR_A)\hash.obj\
    168 	$(XML_INTDIR_A)\HTMLparser.obj\
    169 	$(XML_INTDIR_A)\HTMLtree.obj\
    170 	$(XML_INTDIR_A)\legacy.obj\
    171 	$(XML_INTDIR_A)\list.obj\
    172 	$(XML_INTDIR_A)\nanoftp.obj\
    173 	$(XML_INTDIR_A)\nanohttp.obj\
    174 	$(XML_INTDIR_A)\parser.obj\
    175 	$(XML_INTDIR_A)\parserInternals.obj\
    176 	$(XML_INTDIR_A)\pattern.obj\
    177 	$(XML_INTDIR_A)\relaxng.obj\
    178 	$(XML_INTDIR_A)\SAX2.obj\
    179 	$(XML_INTDIR_A)\SAX.obj\
    180 	$(XML_INTDIR_A)\schematron.obj\
    181 	$(XML_INTDIR_A)\threads.obj\
    182 	$(XML_INTDIR_A)\tree.obj\
    183 	$(XML_INTDIR_A)\uri.obj\
    184 	$(XML_INTDIR_A)\valid.obj\
    185 	$(XML_INTDIR_A)\xinclude.obj\
    186 	$(XML_INTDIR_A)\xlink.obj\
    187 	$(XML_INTDIR_A)\xmlIO.obj\
    188 	$(XML_INTDIR_A)\xmlmemory.obj\
    189 	$(XML_INTDIR_A)\xmlreader.obj\
    190 	$(XML_INTDIR_A)\xmlregexp.obj\
    191 	$(XML_INTDIR_A)\xmlmodule.obj\
    192 	$(XML_INTDIR_A)\xmlsave.obj\
    193 	$(XML_INTDIR_A)\xmlschemas.obj\
    194 	$(XML_INTDIR_A)\xmlschemastypes.obj\
    195 	$(XML_INTDIR_A)\xmlunicode.obj\
    196 	$(XML_INTDIR_A)\xmlwriter.obj\
    197 	$(XML_INTDIR_A)\xpath.obj\
    198 	$(XML_INTDIR_A)\xpointer.obj\
    199 	$(XML_INTDIR_A)\xmlstring.obj
    200 
    201 # Static libxml object files.
    202 XML_OBJS_A_DLL = $(XML_INTDIR_A_DLL)\buf.obj\
    203 	$(XML_INTDIR_A_DLL)\c14n.obj\
    204 	$(XML_INTDIR_A_DLL)\catalog.obj\
    205 	$(XML_INTDIR_A_DLL)\chvalid.obj\
    206 	$(XML_INTDIR_A_DLL)\debugXML.obj\
    207 	$(XML_INTDIR_A_DLL)\dict.obj\
    208 	$(XML_INTDIR_A_DLL)\DOCBparser.obj\
    209 	$(XML_INTDIR_A_DLL)\encoding.obj\
    210 	$(XML_INTDIR_A_DLL)\entities.obj\
    211 	$(XML_INTDIR_A_DLL)\error.obj\
    212 	$(XML_INTDIR_A_DLL)\globals.obj\
    213 	$(XML_INTDIR_A_DLL)\hash.obj\
    214 	$(XML_INTDIR_A_DLL)\HTMLparser.obj\
    215 	$(XML_INTDIR_A_DLL)\HTMLtree.obj\
    216 	$(XML_INTDIR_A_DLL)\legacy.obj\
    217 	$(XML_INTDIR_A_DLL)\list.obj\
    218 	$(XML_INTDIR_A_DLL)\nanoftp.obj\
    219 	$(XML_INTDIR_A_DLL)\nanohttp.obj\
    220 	$(XML_INTDIR_A_DLL)\parser.obj\
    221 	$(XML_INTDIR_A_DLL)\parserInternals.obj\
    222 	$(XML_INTDIR_A_DLL)\pattern.obj\
    223 	$(XML_INTDIR_A_DLL)\relaxng.obj\
    224 	$(XML_INTDIR_A_DLL)\SAX2.obj\
    225 	$(XML_INTDIR_A_DLL)\SAX.obj\
    226 	$(XML_INTDIR_A_DLL)\schematron.obj\
    227 	$(XML_INTDIR_A_DLL)\threads.obj\
    228 	$(XML_INTDIR_A_DLL)\tree.obj\
    229 	$(XML_INTDIR_A_DLL)\uri.obj\
    230 	$(XML_INTDIR_A_DLL)\valid.obj\
    231 	$(XML_INTDIR_A_DLL)\xinclude.obj\
    232 	$(XML_INTDIR_A_DLL)\xlink.obj\
    233 	$(XML_INTDIR_A_DLL)\xmlIO.obj\
    234 	$(XML_INTDIR_A_DLL)\xmlmemory.obj\
    235 	$(XML_INTDIR_A_DLL)\xmlreader.obj\
    236 	$(XML_INTDIR_A_DLL)\xmlregexp.obj\
    237 	$(XML_INTDIR_A_DLL)\xmlmodule.obj\
    238 	$(XML_INTDIR_A_DLL)\xmlsave.obj\
    239 	$(XML_INTDIR_A_DLL)\xmlschemas.obj\
    240 	$(XML_INTDIR_A_DLL)\xmlschemastypes.obj\
    241 	$(XML_INTDIR_A_DLL)\xmlunicode.obj\
    242 	$(XML_INTDIR_A_DLL)\xmlwriter.obj\
    243 	$(XML_INTDIR_A_DLL)\xpath.obj\
    244 	$(XML_INTDIR_A_DLL)\xpointer.obj\
    245 	$(XML_INTDIR_A_DLL)\xmlstring.obj
    246 
    247 !if "$(WITH_LZMA)" == "1"
    248 XML_OBJS = $(XML_OBJS) $(XML_INTDIR)\xzlib.obj
    249 XML_OBJS_A = $(XML_OBJS_A) $(XML_INTDIR_A)\xzlib.obj
    250 XML_OBJS_A_DLL = $(XML_OBJS_A_DLL) $(XML_INTDIR_A_DLL)\xzlib.obj
    251 !endif
    252 
    253 # Xmllint and friends executables.
    254 UTILS = $(BINDIR)\xmllint.exe\
    255 	$(BINDIR)\xmlcatalog.exe\
    256 	$(BINDIR)\testAutomata.exe\
    257 	$(BINDIR)\testC14N.exe\
    258 	$(BINDIR)\testDocbook.exe\
    259 	$(BINDIR)\testHTML.exe\
    260 	$(BINDIR)\testReader.exe\
    261 	$(BINDIR)\testRelax.exe\
    262 	$(BINDIR)\testRegexp.exe\
    263 	$(BINDIR)\testModule.exe\
    264 	$(BINDIR)\testSAX.exe\
    265 	$(BINDIR)\testSchemas.exe\
    266 	$(BINDIR)\testURI.exe\
    267 	$(BINDIR)\testXPath.exe\
    268 	$(BINDIR)\runtest.exe\
    269 	$(BINDIR)\runsuite.exe\
    270 	$(BINDIR)\runxmlconf.exe\
    271 	$(BINDIR)\testapi.exe\
    272 	$(BINDIR)\testchar.exe\
    273 	$(BINDIR)\testdict.exe\
    274 	$(BINDIR)\testlimits.exe\
    275 	$(BINDIR)\testrecurse.exe
    276 	
    277 !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native"
    278 UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe
    279 !else if "$(WITH_THREADS)" == "posix"
    280 UTILS = $(UTILS) $(BINDIR)\testThreads.exe
    281 !endif
    282 
    283 !if "$(VCMANIFEST)" == "1"
    284 _VC_MANIFEST_EMBED_EXE= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1
    285 _VC_MANIFEST_EMBED_DLL= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2
    286 !else
    287 _VC_MANIFEST_EMBED_EXE=
    288 _VC_MANIFEST_EMBED_DLL=
    289 !endif
    290 
    291 all : libxml libxmla libxmladll utils
    292 
    293 libxml : $(BINDIR)\$(XML_SO) 
    294 
    295 libxmla : $(BINDIR)\$(XML_A)
    296 
    297 libxmladll : $(BINDIR)\$(XML_A_DLL)
    298 
    299 utils : $(UTILS)
    300 
    301 clean :
    302 	if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
    303 	if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
    304 	if exist $(XML_INTDIR_A_DLL) rmdir /S /Q $(XML_INTDIR_A_DLL)
    305 	if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
    306 	if exist $(BINDIR) rmdir /S /Q $(BINDIR)
    307 
    308 distclean : clean
    309 	if exist config.* del config.*
    310 	if exist Makefile del Makefile
    311 
    312 rebuild : clean all
    313 
    314 install-libs : all
    315 	if not exist $(INCPREFIX)\libxml2 mkdir $(INCPREFIX)\libxml2
    316 	if not exist $(INCPREFIX)\libxml2\libxml mkdir $(INCPREFIX)\libxml2\libxml
    317 	if not exist $(BINPREFIX) mkdir $(BINPREFIX)
    318 	if not exist $(LIBPREFIX) mkdir $(LIBPREFIX)
    319 	if not exist $(SOPREFIX) mkdir $(SOPREFIX)
    320 	copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml2\libxml
    321 	copy $(BINDIR)\$(XML_SO) $(SOPREFIX)
    322 	copy $(BINDIR)\$(XML_A) $(LIBPREFIX)
    323 	copy $(BINDIR)\$(XML_A_DLL) $(LIBPREFIX)
    324 	copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX)
    325 
    326 install : install-libs 
    327 	copy $(BINDIR)\*.exe $(BINPREFIX)
    328 	-copy $(BINDIR)\*.pdb $(BINPREFIX)
    329 
    330 install-dist : install-libs 
    331 	copy $(BINDIR)\xml*.exe $(BINPREFIX)
    332 	-copy $(BINDIR)\xml*.pdb $(BINPREFIX)
    333 
    334 # This is a target for me, to make a binary distribution. Not for the public use,
    335 # keep your hands off :-)
    336 BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION)
    337 BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32
    338 bindist : all
    339 	$(MAKE) /nologo PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)\bin install-dist
    340 	cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt
    341 
    342 
    343 # Makes the output directory.
    344 $(BINDIR) :
    345 	if not exist $(BINDIR) mkdir $(BINDIR)
    346 
    347 
    348 # Makes the libxml intermediate directory.
    349 $(XML_INTDIR) :
    350 	if not exist $(XML_INTDIR) mkdir $(XML_INTDIR)
    351 
    352 # Makes the static libxml intermediate directory.
    353 $(XML_INTDIR_A) :
    354 	if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A)
    355 
    356 # Makes the static for dll libxml intermediate directory.
    357 $(XML_INTDIR_A_DLL) :
    358 	if not exist $(XML_INTDIR_A_DLL) mkdir $(XML_INTDIR_A_DLL)
    359 
    360 # An implicit rule for libxml compilation.
    361 {$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj::
    362 	$(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $<
    363 
    364 # An implicit rule for static libxml compilation.
    365 {$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj::
    366 	$(CC) $(CFLAGS) /D "LIBXML_STATIC" /Fo$(XML_INTDIR_A)\ /c $<
    367 
    368 # An implicit rule for static for dll libxml compilation.
    369 {$(XML_SRCDIR)}.c{$(XML_INTDIR_A_DLL)}.obj::
    370 	$(CC) $(CFLAGS) /D "LIBXML_STATIC" /D "LIBXML_STATIC_FOR_DLL" /Fo$(XML_INTDIR_A_DLL)\ /c $<
    371 
    372 # Compiles libxml source. Uses the implicit rule for commands.
    373 $(XML_OBJS) : $(XML_INTDIR) 
    374 
    375 # Compiles static libxml source. Uses the implicit rule for commands.
    376 $(XML_OBJS_A) : $(XML_INTDIR_A) 
    377 
    378 # Compiles static for dll libxml source. Uses the implicit rule for commands.
    379 $(XML_OBJS_A_DLL) : $(XML_INTDIR_A_DLL) 
    380 
    381 # Creates the export definition file (DEF) for libxml.
    382 $(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src
    383 	$(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF)
    384 $(XML_INTDIR)\$(XML_RES) : $(XML_INTDIR) libxml2.rc
    385 	rc -Fo $(XML_INTDIR)\$(XML_RES) libxml2.rc
    386 
    387 # Creates the libxml shared object.
    388 $(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) $(XML_INTDIR)\$(XML_RES)
    389 	$(LD) $(LDFLAGS) /DLL \
    390 		/IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(XML_INTDIR)\$(XML_RES) $(LIBS)
    391 	@$(_VC_MANIFEST_EMBED_DLL)
    392 
    393 #$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF)
    394 #	$(LD) $(LDFLAGS) /DLL /DEF:$(XML_INTDIR)\$(XML_DEF) \
    395 #		/IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS)
    396 
    397 # Creates the libxml archive.
    398 $(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A)
    399 	$(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A)
    400 
    401 # Creates the libxml static for dll archive.
    402 $(BINDIR)\$(XML_A_DLL) : $(BINDIR) $(XML_OBJS_A_DLL)
    403 	$(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A_DLL) $(XML_OBJS_A_DLL)
    404 
    405 # Makes the utils intermediate directory.
    406 $(UTILS_INTDIR) :
    407 	if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR)
    408 
    409 # An implicit rule for xmllint and friends.
    410 !if "$(STATIC)" == "1"
    411 {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
    412 	$(CC) /D "LIBXML_STATIC" $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< 
    413 	$(LD) $(LDFLAGS) /OUT:$@ $(XML_A) $(LIBS) $(UTILS_INTDIR)\$(<B).obj
    414 	@$(_VC_MANIFEST_EMBED_EXE)
    415 !else
    416 {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
    417 	$(CC) $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< 
    418 	$(LD) $(LDFLAGS) /OUT:$@ $(XML_IMP) $(LIBS) $(UTILS_INTDIR)\$(<B).obj
    419 	@$(_VC_MANIFEST_EMBED_EXE)
    420 !endif
    421 
    422 # Builds xmllint and friends. Uses the implicit rule for commands.
    423 $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla libxmladll
    424 
    425 # Source dependences should be autogenerated somehow here, but how to
    426 # do it? I have no clue.
    427 
    428 # TESTS
    429 
    430 tests : checktests XPathtests
    431 
    432 checktests : $(UTILS)
    433 	cd .. && win32\$(BINDIR)\runtest.exe
    434 	cd .. && win32\$(BINDIR)\testrecurse.exe
    435 	cd .. && win32\$(BINDIR)\testapi.exe
    436 	cd .. && win32\$(BINDIR)\testchar.exe
    437 	cd .. && win32\$(BINDIR)\testdict.exe
    438 	cd .. && win32\$(BINDIR)\runxmlconf.exe
    439 
    440 XPathtests : $(BINDIR)\testXPath.exe
    441 	@echo. 2> .memdump
    442 	@echo ## XPath regression tests
    443 	@-$(BINDIR)\testXPath.exe | find /C "support not compiled in" 1>nul
    444 	@if %ERRORLEVEL% NEQ 0 @( \
    445 		echo Skipping debug not compiled in\
    446 		@exit 0 \
    447 	)
    448 	@for %%I in ($(XML_SRCDIR)\test\XPath\expr\*.*) do @( \
    449 		@IF NOT EXIST $(XML_SRCDIR)\result\XPath\expr\%%~nxI ( \
    450 			@echo New test %%~nxI &&\
    451 			@echo %%~nxI &&\
    452 			$(BINDIR)\testXPath.exe -f --expr %%I > $(XML_SRCDIR)/result/XPath/expr/%%~nxI &&\
    453 			findstr /C:"MEMORY ALLOCATED : 0" \
    454 		) ELSE ( \
    455 			$(BINDIR)\testXPath.exe -f --expr %%I 2>&1 > result.%%~nxI &&\
    456 			fc $(XML_SRCDIR)\result\XPath\expr\%%~nxI result.%%~nxI >nul &\
    457 			iF ERRORLEVEL 1 exit 1 & \
    458 			findstr "MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" >nul &&\
    459 			del result.%%~nxI \
    460 		) \
    461 	)
    462 	@for %%I in ($(XML_SRCDIR)\test\XPath\docs\*.*) do @( \
    463 		for %%J in ($(XML_SRCDIR)\test\XPath\tests\%%~nxI*.*) do @( \
    464 			if not exist $(XML_SRCDIR)\result\XPath\tests\%%~nxJ ( \
    465 				$(BINDIR)\testXPath.exe -f -i %%I %%J > $(XML_SRCDIR)\result\XPath\tests\%%~nxJ &&\
    466 				findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > nul \
    467 			) ELSE ( \
    468 				$(BINDIR)\testXPAth.exe -f -i %%I %%J 2>&1 > result.%%~nxJ &&\
    469 				findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0">null &&\
    470 				fc $(XML_SRCDIR)\result\XPath\tests\%%~nxJ result.%%~nxJ >null & \
    471 				IF ERRORLEVEL 1 (echo Error: %%I %%J & exit 1) & \
    472 				del result.%%~nxJ \
    473 			)\
    474 		)\
    475 	)
    476 
    477 XMLtests : $(BINDIR)\xmllint.exe
    478 	@echo. 2> .memdump
    479 	@echo ## XML regression tests
    480 	-@for %%I in ($(XML_SRCDIR)\test\*) do @( \
    481 		if not exist $(XML_SRCDIR)\result\%%~nxI ( \
    482 			echo New test file %%~nxI &\
    483 			$(BINDIR)\xmllint.exe  %%I > $(XML_SRCDIR)\result\%%~nxI && \
    484 			findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > null \
    485 		) ELSE ( \
    486 			$(BINDIR)\xmllint.exe %%I 2>&1 > result.%%~nxI && \
    487 			findstr /C:"MEMORY ALLOC" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > null && \
    488 			fc $(XML_SRCDIR)\result\%%~nxI result.%%~nxI > null && \
    489 			$(BINDIR)\xmllint.exe result.%%~nxI 2>&1 > result2.%%~nxI | findstr /V /C:"failed to load external entity" && \
    490 			fc result.%%~nxI result2.%%~nxI & \
    491 			del result.%%~nxI result2.%%~nxI\
    492 		) \
    493 	)	
    494 
    495 				
    496 
    497 
    498 
    499 	
    500