blob: c687678e461fe70356d8bc793b69f33a16d5a584 [file] [log] [blame]
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00001# 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
15AUTOCONF = .\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 Zlatkovic3acadf42002-09-20 16:40:17 +000039#WITH_ZLIB = 0
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000040#WITH_DEBUG = 1
41#WITH_MEM_DEBUG = 0
Igor Zlatkovica6f2d902002-04-16 17:57:17 +000042#WITH_SCHEMAS = 1
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000043#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.
59XML_NAME = xml2
60XML_BASENAME = lib$(XML_NAME)
61XML_SO = $(XML_BASENAME).dll
62XML_IMP = $(XML_BASENAME).lib
63XML_DEF = $(XML_BASENAME).def
64XML_A = $(XML_BASENAME)_a.lib
65
66# Place where we let the compiler put its intermediate trash.
67XML_INTDIR = $(XML_BASENAME).int
Igor Zlatkovic15f5f622002-09-29 17:54:00 +000068XML_INTDIR_A = $(XML_BASENAME)_a.int
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000069UTILS_INTDIR = utils.int
70
71# The preprocessor and its options.
72CPP = cl.exe /EP
73CPPFLAGS = /nologo /I$(XML_SRCDIR)\include
Igor Zlatkovic9425ce22002-04-10 21:57:11 +000074!if "$(WITH_THREADS)" == "1"
75CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT"
76!endif
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000077
78# The compiler and its options.
79CC = cl.exe
80CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 /MD
Igor Zlatkovica78942c2002-08-20 14:42:07 +000081CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000082!if "$(WITH_THREADS)" == "1"
83CFLAGS = $(CFLAGS) /D "_REENTRANT"
84!endif
Igor Zlatkovic3acadf42002-09-20 16:40:17 +000085!if "$(WITH_ZLIB)" == "1"
86CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H"
87!endif
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000088
89# The linker and its options.
90LD = link.exe
91LDFLAGS = /nologo /VERSION:$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION)
Igor Zlatkovica78942c2002-08-20 14:42:07 +000092LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000093LIBS =
94!if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1"
95LIBS = $(LIBS) wsock32.lib
96!endif
97!if "$(WITH_ICONV)" == "1"
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000098LIBS = $(LIBS) iconv.lib
99!endif
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000100!if "$(WITH_ZLIB)" == "1"
101LIBS = $(LIBS) zlib.lib
102!endif
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000103
104# The archiver and its options.
105AR = lib.exe
106ARFLAGS = /nologo
107
108# Optimisation and debug symbols.
109!if "$(DEBUG)" == "1"
110CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7
111LDFLAGS = $(LDFLAGS) /DEBUG
112!else
113CFLAGS = $(CFLAGS) /D "NDEBUG" /O2
114LDFLAGS = $(LDFLAGS) /OPT:NOWIN98
115!endif
116
117# Libxml object files.
118XML_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 Zlatkovica6f2d902002-04-16 17:57:17 +0000143 $(XML_INTDIR)\xmlregexp.obj\
144 $(XML_INTDIR)\xmlschemas.obj\
145 $(XML_INTDIR)\xmlschemastypes.obj\
146 $(XML_INTDIR)\xmlunicode.obj\
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000147 $(XML_INTDIR)\xpath.obj\
148 $(XML_INTDIR)\xpointer.obj
149
Igor Zlatkovic15f5f622002-09-29 17:54:00 +0000150# Static libxml object files.
151XML_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 Zlatkovicac97f6e2002-03-24 21:00:26 +0000183# Xmllint and friends executables.
184UTILS = $(BINDIR)\xmllint.exe\
185 $(BINDIR)\xmlcatalog.exe\
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000186 $(BINDIR)\testAutomata.exe\
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000187 $(BINDIR)\testC14N.exe\
188 $(BINDIR)\testDocbook.exe\
189 $(BINDIR)\testHTML.exe\
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000190 $(BINDIR)\testRegexp.exe\
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000191 $(BINDIR)\testSAX.exe\
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000192 $(BINDIR)\testSchemas.exe\
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000193 $(BINDIR)\testURI.exe\
194 $(BINDIR)\testXPath.exe
195
Igor Zlatkovic15f5f622002-09-29 17:54:00 +0000196all : libxml libxmla utils
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000197
Igor Zlatkovic15f5f622002-09-29 17:54:00 +0000198libxml : $(BINDIR)\$(XML_SO)
199
200libxmla : $(BINDIR)\$(XML_A)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000201
202utils : $(UTILS)
203
204clean :
205 if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
Igor Zlatkovic15f5f622002-09-29 17:54:00 +0000206 if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000207 if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
208 if exist $(BINDIR) rmdir /S /Q $(BINDIR)
209
210rebuild : clean all
211
212install : 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 Zlatkovicc3b604e2002-07-10 19:22:22 +0000221 -copy $(BINDIR)\*.pdb $(BINPREFIX)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000222
223# This is a target for me, to make a binary distribution. Not for the public use,
224# keep your hands off :-)
225BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION)
226BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32
227bindist : 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 Zlatkovic15f5f622002-09-29 17:54:00 +0000241# Makes the static libxml intermediate directory.
242$(XML_INTDIR_A) :
243 if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A)
244
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000245# An implicit rule for libxml compilation.
246{$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj::
247 $(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $<
248
Igor Zlatkovic15f5f622002-09-29 17:54:00 +0000249# 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 Zlatkovicac97f6e2002-03-24 21:00:26 +0000253# Compiles libxml source. Uses the implicit rule for commands.
254$(XML_OBJS) : $(XML_INTDIR)
255
Igor Zlatkovic15f5f622002-09-29 17:54:00 +0000256# Compiles static libxml source. Uses the implicit rule for commands.
257$(XML_OBJS_A) : $(XML_INTDIR_A)
258
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000259# 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 Zlatkovic15f5f622002-09-29 17:54:00 +0000269$(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A)
270 $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000271
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 Zlatkovic15f5f622002-09-29 17:54:00 +0000289$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000290
291
292# Source dependences should be autogenerated somehow here, but how to
293# do it? I have no clue.
294