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 |
| 39 | #WITH_DEBUG = 1 |
| 40 | #WITH_MEM_DEBUG = 0 |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 41 | #WITH_SCHEMAS = 1 |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 42 | #DEBUG = 0 |
| 43 | #STATIC = 0 |
| 44 | #PREFIX = . # set this to the right value. |
| 45 | #BINPREFIX = $(PREFIX)\bin |
| 46 | #INCPREFIX = $(PREFIX)\include |
| 47 | #LIBPREFIX = $(PREFIX)\lib |
| 48 | #SOPREFIX = $(PREFIX)\lib |
| 49 | #INCLUDE = $(INCLUDE);$(INCPREFIX) |
| 50 | #LIB = $(LIB);$(LIBPREFIX) |
| 51 | |
| 52 | |
| 53 | # There should never be a need to modify anything below this line. |
| 54 | # ---------------------------------------------------------------- |
| 55 | |
| 56 | |
| 57 | # Names of various input and output components. |
| 58 | XML_NAME = xml2 |
| 59 | XML_BASENAME = lib$(XML_NAME) |
| 60 | XML_SO = $(XML_BASENAME).dll |
| 61 | XML_IMP = $(XML_BASENAME).lib |
| 62 | XML_DEF = $(XML_BASENAME).def |
| 63 | XML_A = $(XML_BASENAME)_a.lib |
| 64 | |
| 65 | # Place where we let the compiler put its intermediate trash. |
| 66 | XML_INTDIR = $(XML_BASENAME).int |
| 67 | UTILS_INTDIR = utils.int |
| 68 | |
| 69 | # The preprocessor and its options. |
| 70 | CPP = cl.exe /EP |
| 71 | CPPFLAGS = /nologo /I$(XML_SRCDIR)\include |
Igor Zlatkovic | 9425ce2 | 2002-04-10 21:57:11 +0000 | [diff] [blame] | 72 | !if "$(WITH_THREADS)" == "1" |
| 73 | CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT" |
| 74 | !endif |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 75 | |
| 76 | # The compiler and its options. |
| 77 | CC = cl.exe |
| 78 | CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 /MD |
Igor Zlatkovic | a78942c | 2002-08-20 14:42:07 +0000 | [diff] [blame] | 79 | CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 80 | !if "$(WITH_THREADS)" == "1" |
| 81 | CFLAGS = $(CFLAGS) /D "_REENTRANT" |
| 82 | !endif |
| 83 | |
| 84 | # The linker and its options. |
| 85 | LD = link.exe |
| 86 | LDFLAGS = /nologo /VERSION:$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION) |
Igor Zlatkovic | a78942c | 2002-08-20 14:42:07 +0000 | [diff] [blame] | 87 | LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 88 | LIBS = |
| 89 | !if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1" |
| 90 | LIBS = $(LIBS) wsock32.lib |
| 91 | !endif |
| 92 | !if "$(WITH_ICONV)" == "1" |
| 93 | !if "$(STATIC)" == "1" |
| 94 | LIBS = $(LIBS) iconv_a.lib |
| 95 | !else |
| 96 | LIBS = $(LIBS) iconv.lib |
| 97 | !endif |
| 98 | !endif |
| 99 | |
| 100 | # The archiver and its options. |
| 101 | AR = lib.exe |
| 102 | ARFLAGS = /nologo |
| 103 | |
| 104 | # Optimisation and debug symbols. |
| 105 | !if "$(DEBUG)" == "1" |
| 106 | CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 |
| 107 | LDFLAGS = $(LDFLAGS) /DEBUG |
| 108 | !else |
| 109 | CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 |
| 110 | LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 |
| 111 | !endif |
| 112 | |
| 113 | # Libxml object files. |
| 114 | XML_OBJS = $(XML_INTDIR)\c14n.obj\ |
| 115 | $(XML_INTDIR)\catalog.obj\ |
| 116 | $(XML_INTDIR)\debugXML.obj\ |
| 117 | $(XML_INTDIR)\DOCBparser.obj\ |
| 118 | $(XML_INTDIR)\encoding.obj\ |
| 119 | $(XML_INTDIR)\entities.obj\ |
| 120 | $(XML_INTDIR)\error.obj\ |
| 121 | $(XML_INTDIR)\globals.obj\ |
| 122 | $(XML_INTDIR)\hash.obj\ |
| 123 | $(XML_INTDIR)\HTMLparser.obj\ |
| 124 | $(XML_INTDIR)\HTMLtree.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)\SAX.obj\ |
| 131 | $(XML_INTDIR)\threads.obj\ |
| 132 | $(XML_INTDIR)\tree.obj\ |
| 133 | $(XML_INTDIR)\uri.obj\ |
| 134 | $(XML_INTDIR)\valid.obj\ |
| 135 | $(XML_INTDIR)\xinclude.obj\ |
| 136 | $(XML_INTDIR)\xlink.obj\ |
| 137 | $(XML_INTDIR)\xmlIO.obj\ |
| 138 | $(XML_INTDIR)\xmlmemory.obj\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 139 | $(XML_INTDIR)\xmlregexp.obj\ |
| 140 | $(XML_INTDIR)\xmlschemas.obj\ |
| 141 | $(XML_INTDIR)\xmlschemastypes.obj\ |
| 142 | $(XML_INTDIR)\xmlunicode.obj\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 143 | $(XML_INTDIR)\xpath.obj\ |
| 144 | $(XML_INTDIR)\xpointer.obj |
| 145 | |
| 146 | # Xmllint and friends executables. |
| 147 | UTILS = $(BINDIR)\xmllint.exe\ |
| 148 | $(BINDIR)\xmlcatalog.exe\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 149 | $(BINDIR)\testAutomata.exe\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 150 | $(BINDIR)\testC14N.exe\ |
| 151 | $(BINDIR)\testDocbook.exe\ |
| 152 | $(BINDIR)\testHTML.exe\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 153 | $(BINDIR)\testRegexp.exe\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 154 | $(BINDIR)\testSAX.exe\ |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 155 | $(BINDIR)\testSchemas.exe\ |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 156 | $(BINDIR)\testURI.exe\ |
| 157 | $(BINDIR)\testXPath.exe |
| 158 | |
| 159 | all : libxml utils |
| 160 | |
| 161 | libxml : $(BINDIR)\$(XML_SO) $(BINDIR)\$(XML_A) |
| 162 | |
| 163 | utils : $(UTILS) |
| 164 | |
| 165 | clean : |
| 166 | if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR) |
| 167 | if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) |
| 168 | if exist $(BINDIR) rmdir /S /Q $(BINDIR) |
| 169 | |
| 170 | rebuild : clean all |
| 171 | |
| 172 | install : all |
| 173 | if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml |
| 174 | if not exist $(BINPREFIX) mkdir $(BINPREFIX) |
| 175 | if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) |
| 176 | copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml |
| 177 | copy $(BINDIR)\$(XML_SO) $(SOPREFIX) |
| 178 | copy $(BINDIR)\$(XML_A) $(LIBPREFIX) |
| 179 | copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX) |
| 180 | copy $(BINDIR)\*.exe $(BINPREFIX) |
Igor Zlatkovic | c3b604e | 2002-07-10 19:22:22 +0000 | [diff] [blame] | 181 | -copy $(BINDIR)\*.pdb $(BINPREFIX) |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 182 | |
| 183 | # This is a target for me, to make a binary distribution. Not for the public use, |
| 184 | # keep your hands off :-) |
| 185 | BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION) |
| 186 | BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32 |
| 187 | bindist : all |
| 188 | $(MAKE) /nologo PREFIX=$(BDPREFIX) BINPREFIX=$(BDPREFIX)\util install |
| 189 | cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt |
| 190 | |
| 191 | |
| 192 | # Makes the output directory. |
| 193 | $(BINDIR) : |
| 194 | if not exist $(BINDIR) mkdir $(BINDIR) |
| 195 | |
| 196 | |
| 197 | # Makes the libxml intermediate directory. |
| 198 | $(XML_INTDIR) : |
| 199 | if not exist $(XML_INTDIR) mkdir $(XML_INTDIR) |
| 200 | |
| 201 | # An implicit rule for libxml compilation. |
| 202 | {$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj:: |
| 203 | $(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $< |
| 204 | |
| 205 | # Compiles libxml source. Uses the implicit rule for commands. |
| 206 | $(XML_OBJS) : $(XML_INTDIR) |
| 207 | |
| 208 | # Creates the export definition file (DEF) for libxml. |
| 209 | $(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src |
| 210 | $(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF) |
| 211 | |
| 212 | # Creates the libxml shared object. |
| 213 | $(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) |
| 214 | $(LD) $(LDFLAGS) /DLL /DEF:$(XML_INTDIR)\$(XML_DEF) \ |
| 215 | /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS) |
| 216 | |
| 217 | # Creates the libxml archive. |
| 218 | $(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS) |
| 219 | $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS) |
| 220 | |
| 221 | |
| 222 | # Makes the utils intermediate directory. |
| 223 | $(UTILS_INTDIR) : |
| 224 | if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) |
| 225 | |
| 226 | # An implicit rule for xmllint and friends. |
| 227 | !if "$(STATIC)" == "1" |
| 228 | {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: |
| 229 | $(CC) /D "LIBXML_STATIC" $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< |
| 230 | $(LD) $(LDFLAGS) /OUT:$@ $(XML_A) $(LIBS) $(UTILS_INTDIR)\$(<B).obj |
| 231 | !else |
| 232 | {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: |
| 233 | $(CC) $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< |
| 234 | $(LD) $(LDFLAGS) /OUT:$@ $(XML_IMP) $(UTILS_INTDIR)\$(<B).obj |
| 235 | !endif |
| 236 | |
| 237 | # Builds xmllint and friends. Uses the implicit rule for commands. |
| 238 | $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml |
| 239 | |
| 240 | |
| 241 | # Source dependences should be autogenerated somehow here, but how to |
| 242 | # do it? I have no clue. |
| 243 | |