Home | History | Annotate | Download | only in win32
      1 # Makefile for libxml2, specific for Windows, BCB6 and Borland make.
      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 # make [all]     to build the libxml and the accompanying utilities.
      7 # make clean     to remove all compiler output files and return to a
      8 #                 clean state.
      9 # make rebuild   to rebuild everything from scratch. This basically does
     10 #                 a 'nmake clean' and then a 'nmake all'.
     11 # make install   to install the library and its header files.
     12 #
     13 # August 2003, Eric Zurcher <Eric.Zurcher (a] csiro.au>
     14 # based on the MSVC version of
     15 # March 2002, Igor Zlatkovic <igor (a] zlatkovic.com>
     16 #
     17 
     18 # There should never be a need to modify anything below this line.
     19 # ----------------------------------------------------------------
     20 
     21 AUTOCONF = .\config.bcb
     22 !include $(AUTOCONF)
     23 
     24 !if !$d(BCB)
     25 BCB = $(MAKEDIR)\..
     26 !endif
     27 .autodepend
     28 
     29 # Names of various input and output components.
     30 XML_NAME = xml2
     31 XML_BASENAME = lib$(XML_NAME)
     32 XML_SO = $(XML_BASENAME).dll
     33 XML_IMP = $(XML_BASENAME).lib
     34 XML_DEF = $(XML_BASENAME).def
     35 XML_A = $(XML_BASENAME)_a.lib
     36 DUMMY = dir.exists
     37 
     38 # Place where we let the compiler put its intermediate trash.
     39 BINDIR = bin.bcb
     40 XML_INTDIR = int.bcb
     41 XML_INTDIR_A = int.a.bcb
     42 UTILS_INTDIR = int.utils.bcb
     43 
     44 # The preprocessor and its options.
     45 CPP = cpp32.exe -P- -DWIN32
     46 CPPFLAGS = -I"$(XML_SRCDIR)\include" -DNOLIBTOOL 
     47 !if "$(WITH_THREADS)" != "no"
     48 CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__
     49 !endif
     50 
     51 # The compiler and its options.
     52 CC = bcc32.exe
     53 CFLAGS = -q -DWIN32 -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -DNOLIBTOOL -w-
     54 CFLAGS = $(CFLAGS) -I"$(XML_SRCDIR)" -I"$(XML_SRCDIR)\include" -I"$(INCPREFIX)" -I"$(INCLUDE)"
     55 !if "$(WITH_THREADS)" != "no"
     56 CFLAGS = $(CFLAGS) -D_REENTRANT -tWM
     57 !endif
     58 !if "$(DYNRUNTIME)" == "1"
     59 CFLAGS = $(CFLAGS) -tWR
     60 !endif
     61 !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
     62 CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
     63 !else if "$(WITH_THREADS)" == "native"
     64 CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS
     65 !else if "$(WITH_THREADS)" == "posix"
     66 CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H
     67 !endif
     68 !if "$(WITH_ZLIB)" == "1"
     69 CFLAGS = $(CFLAGS) -DHAVE_ZLIB_H
     70 !endif
     71 !if "$(WITH_LZMA)" == "1"
     72 CFLAGS = $(CFLAGS) -DHAVE_LZMA_H
     73 !endif
     74 
     75 # The linker and its options.
     76 LD = ilink32.exe
     77 LDFLAGS = -q -U$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION)
     78 LDFLAGS = $(LDFLAGS) -L"$(BINDIR);$(LIBPREFIX);$(LIB);$(BCB)\lib;$(BCB)\lib\PSdk"
     79 LIBS = import32.lib
     80 !if "$(WITH_THREADS)" != "no" && "$(DYNRUNTIME)" == "1"
     81 LIBS = $(LIBS) cw32mti.lib
     82 !elif "$(WITH_THREADS)" != "no"
     83 LIBS = $(LIBS) cw32mt.lib
     84 !elif "$(DYNRUNTIME)" == "1"
     85 LIBS = $(LIBS) cw32i.lib
     86 !else
     87 LIBS = $(LIBS) cw32.lib
     88 !endif
     89 !if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1"
     90 LIBS = $(LIBS) wsock32.lib ws2_32.lib
     91 !endif 
     92 !if "$(WITH_ICONV)" == "1"
     93 LIBS = $(LIBS) iconvomf.lib
     94 !endif 
     95 !if "$(WITH_ZLIB)" == "1"
     96 LIBS = $(LIBS) zlibomf.lib
     97 !endif
     98 !if "$(WITH_LZMA)" == "1"
     99 LIBS = $(LIBS) liblzma.lib
    100 !endif
    101 !if "$(WITH_THREADS)" == "posix"
    102 LIBS = $(LIBS) pthreadVC.lib
    103 !endif
    104 !if "$(WITH_MODULES)" == "1"
    105 LIBS = $(LIBS) kernel32.lib
    106 !endif
    107 
    108 # The archiver and its options.
    109 AR = tlib.exe
    110 ARFLAGS = /P64 /0
    111 
    112 # Optimisation and debug symbols.
    113 !if "$(DEBUG)" == "1"
    114 CFLAGS = $(CFLAGS) -D_DEBUG -Od -v
    115 LDFLAGS = $(LDFLAGS) -v
    116 !else
    117 CFLAGS = $(CFLAGS) -DNDEBUG -O2 
    118 LDFLAGS = $(LDFLAGS)
    119 !endif
    120 
    121 # Libxml object files.
    122 XML_OBJS = $(XML_INTDIR)\buf.obj\
    123 	$(XML_INTDIR)\c14n.obj\
    124 	$(XML_INTDIR)\catalog.obj\
    125 	$(XML_INTDIR)\chvalid.obj\
    126 	$(XML_INTDIR)\debugXML.obj\
    127 	$(XML_INTDIR)\dict.obj\
    128 	$(XML_INTDIR)\DOCBparser.obj\
    129 	$(XML_INTDIR)\encoding.obj\
    130 	$(XML_INTDIR)\entities.obj\
    131 	$(XML_INTDIR)\error.obj\
    132 	$(XML_INTDIR)\globals.obj\
    133 	$(XML_INTDIR)\hash.obj\
    134 	$(XML_INTDIR)\HTMLparser.obj\
    135 	$(XML_INTDIR)\HTMLtree.obj\
    136 	$(XML_INTDIR)\legacy.obj\
    137 	$(XML_INTDIR)\list.obj\
    138 	$(XML_INTDIR)\nanoftp.obj\
    139 	$(XML_INTDIR)\nanohttp.obj\
    140 	$(XML_INTDIR)\parser.obj\
    141 	$(XML_INTDIR)\parserInternals.obj\
    142 	$(XML_INTDIR)\pattern.obj\
    143 	$(XML_INTDIR)\relaxng.obj\
    144 	$(XML_INTDIR)\SAX.obj\
    145 	$(XML_INTDIR)\SAX2.obj\
    146 	$(XML_INTDIR)\schematron.obj\
    147 	$(XML_INTDIR)\threads.obj\
    148 	$(XML_INTDIR)\tree.obj\
    149 	$(XML_INTDIR)\uri.obj\
    150 	$(XML_INTDIR)\valid.obj\
    151 	$(XML_INTDIR)\xinclude.obj\
    152 	$(XML_INTDIR)\xlink.obj\
    153 	$(XML_INTDIR)\xmlIO.obj\
    154 	$(XML_INTDIR)\xmlmemory.obj\
    155 	$(XML_INTDIR)\xmlreader.obj\
    156 	$(XML_INTDIR)\xmlregexp.obj\
    157 	$(XML_INTDIR)\xmlmodule.obj\
    158 	$(XML_INTDIR)\xmlsave.obj\
    159 	$(XML_INTDIR)\xmlschemas.obj\
    160 	$(XML_INTDIR)\xmlschemastypes.obj\
    161 	$(XML_INTDIR)\xmlunicode.obj\
    162 	$(XML_INTDIR)\xmlwriter.obj\
    163 	$(XML_INTDIR)\xpath.obj\
    164 	$(XML_INTDIR)\xpointer.obj\
    165 	$(XML_INTDIR)\xmlstring.obj
    166 
    167 # Static libxml object files.
    168 XML_OBJS_A = $(XML_INTDIR_A)\buf.obj\
    169 	$(XML_INTDIR_A)\c14n.obj\
    170 	$(XML_INTDIR_A)\catalog.obj\
    171 	$(XML_INTDIR_A)\chvalid.obj\
    172 	$(XML_INTDIR_A)\debugXML.obj\
    173 	$(XML_INTDIR_A)\dict.obj\
    174 	$(XML_INTDIR_A)\DOCBparser.obj\
    175 	$(XML_INTDIR_A)\encoding.obj\
    176 	$(XML_INTDIR_A)\entities.obj\
    177 	$(XML_INTDIR_A)\error.obj\
    178 	$(XML_INTDIR_A)\globals.obj\
    179 	$(XML_INTDIR_A)\hash.obj\
    180 	$(XML_INTDIR_A)\HTMLparser.obj\
    181 	$(XML_INTDIR_A)\HTMLtree.obj\
    182 	$(XML_INTDIR_A)\legacy.obj\
    183 	$(XML_INTDIR_A)\list.obj\
    184 	$(XML_INTDIR_A)\nanoftp.obj\
    185 	$(XML_INTDIR_A)\nanohttp.obj\
    186 	$(XML_INTDIR_A)\parser.obj\
    187 	$(XML_INTDIR_A)\parserInternals.obj\
    188 	$(XML_INTDIR_A)\pattern.obj\
    189 	$(XML_INTDIR_A)\relaxng.obj\
    190 	$(XML_INTDIR_A)\SAX.obj\
    191 	$(XML_INTDIR_A)\SAX2.obj\
    192 	$(XML_INTDIR_A)\schematron.obj\
    193 	$(XML_INTDIR_A)\threads.obj\
    194 	$(XML_INTDIR_A)\tree.obj\
    195 	$(XML_INTDIR_A)\uri.obj\
    196 	$(XML_INTDIR_A)\valid.obj\
    197 	$(XML_INTDIR_A)\xinclude.obj\
    198 	$(XML_INTDIR_A)\xlink.obj\
    199 	$(XML_INTDIR_A)\xmlIO.obj\
    200 	$(XML_INTDIR_A)\xmlmemory.obj\
    201 	$(XML_INTDIR_A)\xmlreader.obj\
    202 	$(XML_INTDIR_A)\xmlregexp.obj\
    203 	$(XML_INTDIR_A)\xmlmodule.obj\
    204 	$(XML_INTDIR_A)\xmlsave.obj\
    205 	$(XML_INTDIR_A)\xmlschemas.obj\
    206 	$(XML_INTDIR_A)\xmlschemastypes.obj\
    207 	$(XML_INTDIR_A)\xmlunicode.obj\
    208 	$(XML_INTDIR_A)\xmlwriter.obj\
    209 	$(XML_INTDIR_A)\xpath.obj\
    210 	$(XML_INTDIR_A)\xpointer.obj\
    211 	$(XML_INTDIR_A)\xmlstring.obj
    212 
    213 # Xmllint and friends executables.
    214 UTILS = $(BINDIR)\xmllint.exe\
    215 	$(BINDIR)\xmlcatalog.exe\
    216 	$(BINDIR)\testAutomata.exe\
    217 	$(BINDIR)\testC14N.exe\
    218 	$(BINDIR)\testDocbook.exe\
    219 	$(BINDIR)\testHTML.exe\
    220 	$(BINDIR)\testReader.exe\
    221 	$(BINDIR)\testRelax.exe\
    222 	$(BINDIR)\testRegexp.exe\
    223 	$(BINDIR)\testModule.exe\
    224 	$(BINDIR)\testSAX.exe\
    225 	$(BINDIR)\testSchemas.exe\
    226 	$(BINDIR)\testURI.exe\
    227 	$(BINDIR)\testXPath.exe\
    228 	$(BINDIR)\runtest.exe\
    229 	$(BINDIR)\runsuite.exe\
    230 	$(BINDIR)\testapi.exe\
    231 	$(BINDIR)\testlimits.exe
    232 
    233 
    234 !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native"
    235 UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe
    236 !else if "$(WITH_THREADS)" == "posix"
    237 UTILS = $(UTILS) $(BINDIR)\testThreads.exe
    238 !endif
    239 
    240 
    241 all : libxml libxmla utils
    242 
    243 libxml : $(BINDIR)\$(XML_SO) 
    244 
    245 libxmla : $(BINDIR)\$(XML_A)
    246 
    247 utils : $(UTILS)
    248 
    249 clean :
    250 	if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
    251 	if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
    252 	if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
    253 	if exist $(BINDIR) rmdir /S /Q $(BINDIR)
    254 
    255 distclean : clean
    256 	if exist config.* del config.*
    257 	if exist Makefile del Makefile
    258 
    259 rebuild : clean all
    260 
    261 install-libs : all
    262 	if not exist "$(INCPREFIX)\libxml2" mkdir "$(INCPREFIX)\libxml2"
    263 	if not exist "$(INCPREFIX)\libxml2\libxml" mkdir "$(INCPREFIX)\libxml2\libxml"
    264 	if not exist "$(BINPREFIX)" mkdir "$(BINPREFIX)"
    265 	if not exist "$(LIBPREFIX)" mkdir "$(LIBPREFIX)"
    266 	copy $(XML_SRCDIR)\include\libxml\*.h "$(INCPREFIX)\libxml2\libxml"
    267 	copy $(BINDIR)\$(XML_SO) "$(SOPREFIX)"
    268 	copy $(BINDIR)\$(XML_A) "$(LIBPREFIX)"
    269 	copy $(BINDIR)\$(XML_IMP) "$(LIBPREFIX)"
    270 	copy $(BINDIR)\*.exe "$(BINPREFIX)"
    271 
    272 install : install-libs
    273 	copy $(BINDIR)\*.exe "$(BINPREFIX)"
    274 
    275 install-dist : install-libs
    276 	copy $(BINDIR)\xml*.exe "$(BINPREFIX)"
    277 
    278 # This is a target for me, to make a binary distribution. Not for the public use,
    279 # keep your hands off :-)
    280 BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION)
    281 BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32
    282 bindist : all
    283 	$(MAKE) /nologo PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)\bin install-dist
    284 	cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt
    285 
    286 
    287 # Makes the output directory.
    288 $(BINDIR)\$(DUMMY) :
    289 	if not exist $(BINDIR) mkdir $(BINDIR)
    290 	touch $(BINDIR)\$(DUMMY)
    291 
    292 # Makes the libxml intermediate directory.
    293 $(XML_INTDIR)\$(DUMMY) :
    294 	if not exist $(XML_INTDIR) mkdir $(XML_INTDIR)
    295 	touch $(XML_INTDIR)\$(DUMMY)
    296 
    297 # Makes the static libxml intermediate directory.
    298 $(XML_INTDIR_A)\$(DUMMY) :
    299 	if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A)
    300 	touch $(XML_INTDIR_A)\$(DUMMY)
    301 
    302 # An implicit rule for libxml compilation.
    303 {$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj:
    304 	$(CC) $(CFLAGS) -n$(XML_INTDIR) -c $<
    305 
    306 # An implicit rule for static libxml compilation.
    307 {$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj:
    308 	$(CC) $(CFLAGS) -DLIBXML_STATIC -n$(XML_INTDIR_A)\ -c $<
    309 
    310 # Compiles libxml source. Uses the implicit rule for commands.
    311 $(XML_OBJS) : $(XML_INTDIR)\$(DUMMY)
    312 
    313 # Compiles static libxml source. Uses the implicit rule for commands.
    314 $(XML_OBJS_A) : $(XML_INTDIR_A)\$(DUMMY) 
    315 
    316 #def4bcb.exe : def4bcb.c
    317 
    318 # Creates the export definition file (DEF) for libxml.
    319 #$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR)\$(DUMMY) $(XML_DEF).src def4bcb.exe
    320 #	$(CPP) $(CPPFLAGS) -o $(XML_INTDIR)\$(XML_DEF).tmp $(XML_DEF).src
    321 #	def4bcb -msnames < $(XML_INTDIR)\$(XML_DEF).tmp > $(XML_INTDIR)\$(XML_DEF)
    322 
    323 # Creates the libxml shared object.
    324 $(BINDIR)\$(XML_SO) : $(BINDIR)\$(DUMMY) $(XML_OBJS)
    325 	$(LD) $(LDFLAGS) -Tpd -Gi c0d32.obj $(XML_OBJS),$(BINDIR)\$(XML_SO),,$(LIBS)
    326 
    327 #$(BINDIR)\$(XML_SO) : $(BINDIR)\$(DUMMY) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF)
    328 #	$(LD) $(LDFLAGS) -Tpd -Gi c0d32.obj $(XML_OBJS),$(BINDIR)\$(XML_SO),,$(LIBS),$(XML_INTDIR)\$(XML_DEF)
    329 
    330 # Creates the libxml archive.
    331 $(BINDIR)\$(XML_A) : $(BINDIR)\$(DUMMY) $(XML_OBJS_A)
    332 	$(AR) $(BINDIR)\$(XML_A) $(ARFLAGS) /u $(XML_OBJS_A)
    333 
    334 # Makes the utils intermediate directory.
    335 $(UTILS_INTDIR)\$(DUMMY) :
    336 	if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR)
    337 	touch $(UTILS_INTDIR)\$(DUMMY)
    338 
    339 # An implicit rule for xmllint and friends.
    340 !if "$(STATIC)" == "1"
    341 {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
    342 	$(CC) -DLIBXML_STATIC -w -tWC $(CFLAGS) -o$(UTILS_INTDIR)\$&.obj -c $< 
    343 	$(LD) $(LDFLAGS) c0x32.obj $(UTILS_INTDIR)\$&.obj,$@,,$(LIBS) $(XML_A)
    344 !else
    345 {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
    346 	$(CC) $(CFLAGS) -tWC -o$(UTILS_INTDIR)\$&.obj -c $< 
    347 	$(LD) $(LDFLAGS) c0x32.obj $(UTILS_INTDIR)\$&.obj $(XML_IMP),$@,,$(LIBS) 
    348 !endif
    349 
    350 # Builds xmllint and friends. Uses the implicit rule for commands.
    351 $(UTILS) : $(UTILS_INTDIR)\$(DUMMY) $(BINDIR)\$(DUMMY) $(BINDIR)\$(XML_SO) $(BINDIR)\$(XML_A)
    352 
    353 # Source dependences should be autogenerated somehow here, but how to
    354 # do it? I have no clue.
    355 
    356