Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 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@stud.fh-frankfurt.de> |
| 14 | |
| 15 | AUTOCONF = .\configure.txt |
| 16 | |
| 17 | # If you cannot run the configuration script, which would take the burden of |
| 18 | # editing this file from your back, then remove the following line... |
| 19 | !include $(AUTOCONF) |
| 20 | # ...and enable the following lines and adapt them to your environment. |
| 21 | #XML_SRCDIR = .. |
| 22 | #UTILS_SRCDIR = .. |
| 23 | #BINDIR = binaries |
| 24 | #LIBXML_MAJOR_VERSION = 0 # set this to the right value. |
| 25 | #LIBXML_MINOR_VERSION = 0 # set this to the right value. |
| 26 | #LIBXML_MICRO_VERSION = 0 # set this to the right value. |
| 27 | #WITH_TRIO = 0 |
| 28 | #WITH_THREADS = 0 |
| 29 | #WITH_FTP = 1 |
| 30 | #WITH_HTTP = 1 |
| 31 | #WITH_HTML = 1 |
| 32 | #WITH_C14N = 1 |
| 33 | #WITH_CATALOG = 1 |
| 34 | #WITH_DOCB = 1 |
| 35 | #WITH_XPATH = 1 |
| 36 | #WITH_XPTR = 1 |
| 37 | #WITH_XINCLUDE = 1 |
| 38 | #WITH_ICONV = 1 |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 39 | #WITH_ZLIB = 0 |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 40 | #WITH_DEBUG = 1 |
| 41 | #WITH_MEM_DEBUG = 0 |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 42 | #WITH_SCHEMAS = 1 |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 43 | #DEBUG = 0 |
| 44 | #STATIC = 0 |
| 45 | #PREFIX = . # set this to the right value. |
| 46 | #BINPREFIX = $(PREFIX)\bin |
| 47 | #INCPREFIX = $(PREFIX)\include |
| 48 | #LIBPREFIX = $(PREFIX)\lib |
| 49 | #SOPREFIX = $(PREFIX)\lib |
| 50 | #INCLUDE = $(INCLUDE);$(INCPREFIX) |
| 51 | #LIB = $(LIB);$(LIBPREFIX) |
| 52 | |
| 53 | |
| 54 | # There should never be a need to modify anything below this line. |
| 55 | # ---------------------------------------------------------------- |
| 56 | |
| 57 | |
| 58 | # Names of various input and output components. |
| 59 | XML_NAME = xml2 |
| 60 | XML_BASENAME = lib$(XML_NAME) |
| 61 | XML_SO = $(XML_BASENAME).dll |
| 62 | XML_IMP = $(XML_BASENAME).lib |
| 63 | XML_DEF = $(XML_BASENAME).def |
| 64 | XML_A = $(XML_BASENAME)_a.lib |
| 65 | |
| 66 | # Place where we let the compiler put its intermediate trash. |
| 67 | XML_INTDIR = $(XML_BASENAME).int |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 68 | XML_INTDIR_A = $(XML_BASENAME)_a.int |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 69 | UTILS_INTDIR = utils.int |
| 70 | |
| 71 | # The preprocessor and its options. |
| 72 | CPP = cl.exe /EP |
| 73 | CPPFLAGS = /nologo /I$(XML_SRCDIR)\include |
Igor Zlatkovic | 9425ce2 | 2002-04-10 21:57:11 +0000 | [diff] [blame] | 74 | !if "$(WITH_THREADS)" == "1" |
| 75 | CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT" |
| 76 | !endif |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 77 | |
| 78 | # The compiler and its options. |
| 79 | CC = cl.exe |
| 80 | CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 /MD |
Igor Zlatkovic | a78942c | 2002-08-20 14:42:07 +0000 | [diff] [blame] | 81 | CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 82 | !if "$(WITH_THREADS)" == "1" |
| 83 | CFLAGS = $(CFLAGS) /D "_REENTRANT" |
| 84 | !endif |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 85 | !if "$(WITH_ZLIB)" == "1" |
| 86 | CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H" |
| 87 | !endif |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 88 | |
| 89 | # The linker and its options. |
| 90 | LD = link.exe |
| 91 | LDFLAGS = /nologo /VERSION:$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION) |
Igor Zlatkovic | a78942c | 2002-08-20 14:42:07 +0000 | [diff] [blame] | 92 | LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 93 | LIBS = |
| 94 | !if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1" |
| 95 | LIBS = $(LIBS) wsock32.lib |
| 96 | !endif |
| 97 | !if "$(WITH_ICONV)" == "1" |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 98 | LIBS = $(LIBS) iconv.lib |
| 99 | !endif |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 100 | !if "$(WITH_ZLIB)" == "1" |
| 101 | LIBS = $(LIBS) zlib.lib |
| 102 | !endif |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 103 | |
| 104 | # The archiver and its options. |
| 105 | AR = lib.exe |
| 106 | ARFLAGS = /nologo |
| 107 | |
| 108 | # Optimisation and debug symbols. |
| 109 | !if "$(DEBUG)" == "1" |
| 110 | CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 |
| 111 | LDFLAGS = $(LDFLAGS) /DEBUG |
| 112 | !else |
| 113 | CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 |
| 114 | LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 |
| 115 | !endif |
| 116 | |
| 117 | # Libxml object files. |
| 118 | XML_OBJS = $(XML_INTDIR)\c14n.obj\ |
| 119 | $(XML_INTDIR)\catalog.obj\ |
| 120 | $(XML_INTDIR)\debugXML.obj\ |
| 121 | $(XML_INTDIR)\DOCBparser.obj\ |
| 122 | $(XML_INTDIR)\encoding.obj\ |
| 123 | $(XML_INTDIR)\entities.obj\ |
| 124 | $(XML_INTDIR)\error.obj\ |
| 125 | $(XML_INTDIR)\globals.obj\ |
| 126 | $(XML_INTDIR)\hash.obj\ |
| 127 | $(XML_INTDIR)\HTMLparser.obj\ |
| 128 | $(XML_INTDIR)\HTMLtree.obj\ |
| 129 | $(XML_INTDIR)\list.obj\ |
| 130 | $(XML_INTDIR)\nanoftp.obj\ |
| 131 | $(XML_INTDIR)\nanohttp.obj\ |
| 132 | $(XML_INTDIR)\parser.obj\ |
| 133 | $(XML_INTDIR)\parserInternals.obj\ |
| 134 | $(XML_INTDIR)\SAX.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\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 143 | $(XML_INTDIR)\xmlregexp.obj\ |
| 144 | $(XML_INTDIR)\xmlschemas.obj\ |
| 145 | $(XML_INTDIR)\xmlschemastypes.obj\ |
| 146 | $(XML_INTDIR)\xmlunicode.obj\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 147 | $(XML_INTDIR)\xpath.obj\ |
| 148 | $(XML_INTDIR)\xpointer.obj |
| 149 | |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 150 | # Static libxml object files. |
| 151 | XML_OBJS_A = $(XML_INTDIR_A)\c14n.obj\ |
| 152 | $(XML_INTDIR_A)\catalog.obj\ |
| 153 | $(XML_INTDIR_A)\debugXML.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)\list.obj\ |
| 163 | $(XML_INTDIR_A)\nanoftp.obj\ |
| 164 | $(XML_INTDIR_A)\nanohttp.obj\ |
| 165 | $(XML_INTDIR_A)\parser.obj\ |
| 166 | $(XML_INTDIR_A)\parserInternals.obj\ |
| 167 | $(XML_INTDIR_A)\SAX.obj\ |
| 168 | $(XML_INTDIR_A)\threads.obj\ |
| 169 | $(XML_INTDIR_A)\tree.obj\ |
| 170 | $(XML_INTDIR_A)\uri.obj\ |
| 171 | $(XML_INTDIR_A)\valid.obj\ |
| 172 | $(XML_INTDIR_A)\xinclude.obj\ |
| 173 | $(XML_INTDIR_A)\xlink.obj\ |
| 174 | $(XML_INTDIR_A)\xmlIO.obj\ |
| 175 | $(XML_INTDIR_A)\xmlmemory.obj\ |
| 176 | $(XML_INTDIR_A)\xmlregexp.obj\ |
| 177 | $(XML_INTDIR_A)\xmlschemas.obj\ |
| 178 | $(XML_INTDIR_A)\xmlschemastypes.obj\ |
| 179 | $(XML_INTDIR_A)\xmlunicode.obj\ |
| 180 | $(XML_INTDIR_A)\xpath.obj\ |
| 181 | $(XML_INTDIR_A)\xpointer.obj |
| 182 | |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 183 | # Xmllint and friends executables. |
| 184 | UTILS = $(BINDIR)\xmllint.exe\ |
| 185 | $(BINDIR)\xmlcatalog.exe\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 186 | $(BINDIR)\testAutomata.exe\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 187 | $(BINDIR)\testC14N.exe\ |
| 188 | $(BINDIR)\testDocbook.exe\ |
| 189 | $(BINDIR)\testHTML.exe\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 190 | $(BINDIR)\testRegexp.exe\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 191 | $(BINDIR)\testSAX.exe\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 192 | $(BINDIR)\testSchemas.exe\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 193 | $(BINDIR)\testURI.exe\ |
| 194 | $(BINDIR)\testXPath.exe |
| 195 | |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 196 | all : libxml libxmla utils |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 197 | |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 198 | libxml : $(BINDIR)\$(XML_SO) |
| 199 | |
| 200 | libxmla : $(BINDIR)\$(XML_A) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 201 | |
| 202 | utils : $(UTILS) |
| 203 | |
| 204 | clean : |
| 205 | if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR) |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 206 | if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 207 | if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) |
| 208 | if exist $(BINDIR) rmdir /S /Q $(BINDIR) |
| 209 | |
| 210 | rebuild : clean all |
| 211 | |
| 212 | install : all |
| 213 | if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml |
| 214 | if not exist $(BINPREFIX) mkdir $(BINPREFIX) |
| 215 | if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) |
| 216 | copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml |
| 217 | copy $(BINDIR)\$(XML_SO) $(SOPREFIX) |
| 218 | copy $(BINDIR)\$(XML_A) $(LIBPREFIX) |
| 219 | copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX) |
| 220 | copy $(BINDIR)\*.exe $(BINPREFIX) |
Igor Zlatkovic | c3b604e | 2002-07-10 19:22:22 +0000 | [diff] [blame] | 221 | -copy $(BINDIR)\*.pdb $(BINPREFIX) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 222 | |
| 223 | # This is a target for me, to make a binary distribution. Not for the public use, |
| 224 | # keep your hands off :-) |
| 225 | BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION) |
| 226 | BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32 |
| 227 | bindist : all |
| 228 | $(MAKE) /nologo PREFIX=$(BDPREFIX) BINPREFIX=$(BDPREFIX)\util install |
| 229 | cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt |
| 230 | |
| 231 | |
| 232 | # Makes the output directory. |
| 233 | $(BINDIR) : |
| 234 | if not exist $(BINDIR) mkdir $(BINDIR) |
| 235 | |
| 236 | |
| 237 | # Makes the libxml intermediate directory. |
| 238 | $(XML_INTDIR) : |
| 239 | if not exist $(XML_INTDIR) mkdir $(XML_INTDIR) |
| 240 | |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 241 | # Makes the static libxml intermediate directory. |
| 242 | $(XML_INTDIR_A) : |
| 243 | if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A) |
| 244 | |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 245 | # An implicit rule for libxml compilation. |
| 246 | {$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj:: |
| 247 | $(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $< |
| 248 | |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 249 | # An implicit rule for static libxml compilation. |
| 250 | {$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj:: |
| 251 | $(CC) $(CFLAGS) /D "LIBXML_STATIC" /Fo$(XML_INTDIR_A)\ /c $< |
| 252 | |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 253 | # Compiles libxml source. Uses the implicit rule for commands. |
| 254 | $(XML_OBJS) : $(XML_INTDIR) |
| 255 | |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 256 | # Compiles static libxml source. Uses the implicit rule for commands. |
| 257 | $(XML_OBJS_A) : $(XML_INTDIR_A) |
| 258 | |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 259 | # Creates the export definition file (DEF) for libxml. |
| 260 | $(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src |
| 261 | $(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF) |
| 262 | |
| 263 | # Creates the libxml shared object. |
| 264 | $(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) |
| 265 | $(LD) $(LDFLAGS) /DLL /DEF:$(XML_INTDIR)\$(XML_DEF) \ |
| 266 | /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS) |
| 267 | |
| 268 | # Creates the libxml archive. |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 269 | $(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A) |
| 270 | $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 271 | |
| 272 | |
| 273 | # Makes the utils intermediate directory. |
| 274 | $(UTILS_INTDIR) : |
| 275 | if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) |
| 276 | |
| 277 | # An implicit rule for xmllint and friends. |
| 278 | !if "$(STATIC)" == "1" |
| 279 | {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: |
| 280 | $(CC) /D "LIBXML_STATIC" $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< |
| 281 | $(LD) $(LDFLAGS) /OUT:$@ $(XML_A) $(LIBS) $(UTILS_INTDIR)\$(<B).obj |
| 282 | !else |
| 283 | {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: |
| 284 | $(CC) $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< |
| 285 | $(LD) $(LDFLAGS) /OUT:$@ $(XML_IMP) $(UTILS_INTDIR)\$(<B).obj |
| 286 | !endif |
| 287 | |
| 288 | # Builds xmllint and friends. Uses the implicit rule for commands. |
Igor Zlatkovic | 15f5f62 | 2002-09-29 17:54:00 +0000 | [diff] [blame] | 289 | $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 290 | |
| 291 | |
| 292 | # Source dependences should be autogenerated somehow here, but how to |
| 293 | # do it? I have no clue. |
| 294 | |