Makefile.bcb 10 KB

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