1 | # Makefile for libxml2, specific for Windows, GCC (mingw) and GNU 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 | # 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 | # November 2002, Igor Zlatkovic <[email protected]>
|
---|
14 |
|
---|
15 | # There should never be a need to modify anything below this line.
|
---|
16 | # ----------------------------------------------------------------
|
---|
17 |
|
---|
18 | AUTOCONF = .\config.mingw
|
---|
19 | include $(AUTOCONF)
|
---|
20 |
|
---|
21 | # Names of various input and output components.
|
---|
22 | XML_NAME = xml2
|
---|
23 | XML_BASENAME = lib$(XML_NAME)
|
---|
24 | XML_SO = $(XML_BASENAME).dll
|
---|
25 | XML_IMP = $(XML_BASENAME).lib
|
---|
26 | XML_A = $(XML_BASENAME).a
|
---|
27 |
|
---|
28 | # Place where we let the compiler put its output.
|
---|
29 | BINDIR = bin.mingw
|
---|
30 | XML_INTDIR = int.mingw
|
---|
31 | XML_INTDIR_A = int.a.mingw
|
---|
32 | UTILS_INTDIR = int.utils.mingw
|
---|
33 |
|
---|
34 | # The preprocessor and its options.
|
---|
35 | CPP = gcc.exe -E
|
---|
36 | CPPFLAGS += -I$(XML_SRCDIR)/include
|
---|
37 | ifeq ($(WITH_THREADS),1)
|
---|
38 | CPPFLAGS += -D_REENTRANT
|
---|
39 | endif
|
---|
40 |
|
---|
41 | # The compiler and its options.
|
---|
42 | CC = gcc.exe
|
---|
43 | CFLAGS += -DWIN32 -D_WINDOWS -D_MBCS
|
---|
44 | CFLAGS += -I$(XML_SRCDIR) -I$(XML_SRCDIR)/include -I$(INCPREFIX)
|
---|
45 | ifneq ($(WITH_THREADS),no)
|
---|
46 | CFLAGS += -D_REENTRANT
|
---|
47 | endif
|
---|
48 | ifeq ($(WITH_THREADS),yes)
|
---|
49 | CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
|
---|
50 | endif
|
---|
51 | ifeq ($(WITH_THREADS),ctls)
|
---|
52 | CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
|
---|
53 | endif
|
---|
54 | ifeq ($(WITH_THREADS),native)
|
---|
55 | CFLAGS += -DHAVE_WIN32_THREADS
|
---|
56 | endif
|
---|
57 | ifeq ($(WITH_THREADS),posix)
|
---|
58 | CFLAGS += -DHAVE_PTHREAD_H
|
---|
59 | endif
|
---|
60 | ifeq ($(WITH_ZLIB),1)
|
---|
61 | CFLAGS += -DHAVE_ZLIB_H
|
---|
62 | endif
|
---|
63 |
|
---|
64 | # The linker and its options.
|
---|
65 | LD = gcc.exe
|
---|
66 | LDFLAGS += -Wl,--major-image-version,$(LIBXML_MAJOR_VERSION)
|
---|
67 | LDFLAGS += -Wl,--minor-image-version,$(LIBXML_MINOR_VERSION)
|
---|
68 | LDFLAGS += -Wl,-L,$(BINDIR) -Wl,-L,$(LIBPREFIX)
|
---|
69 | LIBS =
|
---|
70 | ifeq ($(WITH_FTP),1)
|
---|
71 | CFLAGS += -D_WINSOCKAPI_
|
---|
72 | LIBS += -lwsock32
|
---|
73 | endif
|
---|
74 | ifeq ($(WITH_HTTP),1)
|
---|
75 | CFLAGS += -D_WINSOCKAPI_
|
---|
76 | LIBS += -lwsock32
|
---|
77 | endif
|
---|
78 | ifeq ($(WITH_ICONV),1)
|
---|
79 | LIBS += -liconv
|
---|
80 | endif
|
---|
81 | ifeq ($(WITH_ZLIB),1)
|
---|
82 | LIBS += -lzdll
|
---|
83 | endif
|
---|
84 | ifeq ($(WITH_THREADS),posix)
|
---|
85 | LIBS += -lpthreadGC
|
---|
86 | endif
|
---|
87 | ifeq ($(WITH_MODULES),1)
|
---|
88 | LIBS += -lkernel32
|
---|
89 | endif
|
---|
90 |
|
---|
91 | # The archiver and its options.
|
---|
92 | AR = ar.exe
|
---|
93 | ARFLAGS = -r
|
---|
94 |
|
---|
95 | # Optimisation and debug symbols.
|
---|
96 | ifeq ($(DEBUG),1)
|
---|
97 | CFLAGS += -D_DEBUG -g
|
---|
98 | LDFLAGS +=
|
---|
99 | else
|
---|
100 | CFLAGS += -DNDEBUG -O2
|
---|
101 | LDFLAGS +=
|
---|
102 | endif
|
---|
103 |
|
---|
104 |
|
---|
105 | # Libxml object files.
|
---|
106 | XML_OBJS = $(XML_INTDIR)/c14n.o\
|
---|
107 | $(XML_INTDIR)/catalog.o\
|
---|
108 | $(XML_INTDIR)/chvalid.o\
|
---|
109 | $(XML_INTDIR)/debugXML.o\
|
---|
110 | $(XML_INTDIR)/dict.o\
|
---|
111 | $(XML_INTDIR)/DOCBparser.o\
|
---|
112 | $(XML_INTDIR)/encoding.o\
|
---|
113 | $(XML_INTDIR)/entities.o\
|
---|
114 | $(XML_INTDIR)/error.o\
|
---|
115 | $(XML_INTDIR)/globals.o\
|
---|
116 | $(XML_INTDIR)/hash.o\
|
---|
117 | $(XML_INTDIR)/HTMLparser.o\
|
---|
118 | $(XML_INTDIR)/HTMLtree.o\
|
---|
119 | $(XML_INTDIR)/legacy.o\
|
---|
120 | $(XML_INTDIR)/list.o\
|
---|
121 | $(XML_INTDIR)/nanoftp.o\
|
---|
122 | $(XML_INTDIR)/nanohttp.o\
|
---|
123 | $(XML_INTDIR)/parser.o\
|
---|
124 | $(XML_INTDIR)/parserInternals.o\
|
---|
125 | $(XML_INTDIR)/pattern.o\
|
---|
126 | $(XML_INTDIR)/relaxng.o\
|
---|
127 | $(XML_INTDIR)/SAX.o\
|
---|
128 | $(XML_INTDIR)/SAX2.o\
|
---|
129 | $(XML_INTDIR)/schematron.o\
|
---|
130 | $(XML_INTDIR)/threads.o\
|
---|
131 | $(XML_INTDIR)/tree.o\
|
---|
132 | $(XML_INTDIR)/uri.o\
|
---|
133 | $(XML_INTDIR)/valid.o\
|
---|
134 | $(XML_INTDIR)/xinclude.o\
|
---|
135 | $(XML_INTDIR)/xlink.o\
|
---|
136 | $(XML_INTDIR)/xmlIO.o\
|
---|
137 | $(XML_INTDIR)/xmlmemory.o\
|
---|
138 | $(XML_INTDIR)/xmlreader.o\
|
---|
139 | $(XML_INTDIR)/xmlregexp.o\
|
---|
140 | $(XML_INTDIR)/xmlmodule.o\
|
---|
141 | $(XML_INTDIR)/xmlsave.o\
|
---|
142 | $(XML_INTDIR)/xmlschemas.o\
|
---|
143 | $(XML_INTDIR)/xmlschemastypes.o\
|
---|
144 | $(XML_INTDIR)/xmlunicode.o\
|
---|
145 | $(XML_INTDIR)/xmlwriter.o\
|
---|
146 | $(XML_INTDIR)/xpath.o\
|
---|
147 | $(XML_INTDIR)/xpointer.o\
|
---|
148 | $(XML_INTDIR)/xmlstring.o
|
---|
149 |
|
---|
150 | XML_SRCS = $(subst .o,.c,$(subst $(XML_INTDIR)/,$(XML_SRCDIR)/,$(XML_OBJS)))
|
---|
151 |
|
---|
152 | # Static libxml object files.
|
---|
153 | XML_OBJS_A = $(XML_INTDIR_A)/c14n.o\
|
---|
154 | $(XML_INTDIR_A)/catalog.o\
|
---|
155 | $(XML_INTDIR_A)/chvalid.o\
|
---|
156 | $(XML_INTDIR_A)/debugXML.o\
|
---|
157 | $(XML_INTDIR_A)/dict.o\
|
---|
158 | $(XML_INTDIR_A)/DOCBparser.o\
|
---|
159 | $(XML_INTDIR_A)/encoding.o\
|
---|
160 | $(XML_INTDIR_A)/entities.o\
|
---|
161 | $(XML_INTDIR_A)/error.o\
|
---|
162 | $(XML_INTDIR_A)/globals.o\
|
---|
163 | $(XML_INTDIR_A)/hash.o\
|
---|
164 | $(XML_INTDIR_A)/HTMLparser.o\
|
---|
165 | $(XML_INTDIR_A)/HTMLtree.o\
|
---|
166 | $(XML_INTDIR_A)/legacy.o\
|
---|
167 | $(XML_INTDIR_A)/list.o\
|
---|
168 | $(XML_INTDIR_A)/nanoftp.o\
|
---|
169 | $(XML_INTDIR_A)/nanohttp.o\
|
---|
170 | $(XML_INTDIR_A)/parser.o\
|
---|
171 | $(XML_INTDIR_A)/parserInternals.o\
|
---|
172 | $(XML_INTDIR_A)/pattern.o\
|
---|
173 | $(XML_INTDIR_A)/relaxng.o\
|
---|
174 | $(XML_INTDIR_A)/SAX.o\
|
---|
175 | $(XML_INTDIR_A)/SAX2.o\
|
---|
176 | $(XML_INTDIR_A)/schematron.o\
|
---|
177 | $(XML_INTDIR_A)/threads.o\
|
---|
178 | $(XML_INTDIR_A)/tree.o\
|
---|
179 | $(XML_INTDIR_A)/uri.o\
|
---|
180 | $(XML_INTDIR_A)/valid.o\
|
---|
181 | $(XML_INTDIR_A)/xinclude.o\
|
---|
182 | $(XML_INTDIR_A)/xlink.o\
|
---|
183 | $(XML_INTDIR_A)/xmlIO.o\
|
---|
184 | $(XML_INTDIR_A)/xmlmemory.o\
|
---|
185 | $(XML_INTDIR_A)/xmlreader.o\
|
---|
186 | $(XML_INTDIR_A)/xmlregexp.o\
|
---|
187 | $(XML_INTDIR_A)/xmlmodule.o\
|
---|
188 | $(XML_INTDIR_A)/xmlsave.o\
|
---|
189 | $(XML_INTDIR_A)/xmlschemas.o\
|
---|
190 | $(XML_INTDIR_A)/xmlschemastypes.o\
|
---|
191 | $(XML_INTDIR_A)/xmlunicode.o\
|
---|
192 | $(XML_INTDIR_A)/xmlwriter.o\
|
---|
193 | $(XML_INTDIR_A)/xpath.o\
|
---|
194 | $(XML_INTDIR_A)/xpointer.o\
|
---|
195 | $(XML_INTDIR_A)/xmlstring.o
|
---|
196 |
|
---|
197 | XML_SRCS_A = $(subst .o,.c,$(subst $(XML_INTDIR_A)/,$(XML_SRCDIR)/,$(XML_OBJS_A)))
|
---|
198 |
|
---|
199 | # Xmllint and friends executables.
|
---|
200 | UTILS = $(BINDIR)/xmllint.exe\
|
---|
201 | $(BINDIR)/xmlcatalog.exe\
|
---|
202 | $(BINDIR)/testAutomata.exe\
|
---|
203 | $(BINDIR)/testC14N.exe\
|
---|
204 | $(BINDIR)/testDocbook.exe\
|
---|
205 | $(BINDIR)/testHTML.exe\
|
---|
206 | $(BINDIR)/testReader.exe\
|
---|
207 | $(BINDIR)/testRegexp.exe\
|
---|
208 | $(BINDIR)/testModule.exe\
|
---|
209 | $(BINDIR)/testRelax.exe\
|
---|
210 | $(BINDIR)/testSAX.exe\
|
---|
211 | $(BINDIR)/testSchemas.exe\
|
---|
212 | $(BINDIR)/testURI.exe\
|
---|
213 | $(BINDIR)/testXPath.exe\
|
---|
214 | $(BINDIR)/runtest.exe\
|
---|
215 | $(BINDIR)/runsuite.exe\
|
---|
216 | $(BINDIR)/testapi.exe
|
---|
217 |
|
---|
218 | ifeq ($(WITH_THREADS),yes)
|
---|
219 | UTILS += $(BINDIR)/testThreadsWin32.exe
|
---|
220 | endif
|
---|
221 | ifeq ($(WITH_THREADS),ctls)
|
---|
222 | UTILS += $(BINDIR)/testThreadsWin32.exe
|
---|
223 | endif
|
---|
224 | ifeq ($(WITH_THREADS),native)
|
---|
225 | UTILS += $(BINDIR)/testThreadsWin32.exe
|
---|
226 | endif
|
---|
227 | ifeq ($(WITH_THREADS),posix)
|
---|
228 | UTILS += $(BINDIR)/testThreads.exe
|
---|
229 | endif
|
---|
230 |
|
---|
231 | all : dep libxml libxmla utils
|
---|
232 |
|
---|
233 | libxml : $(BINDIR)/$(XML_SO)
|
---|
234 |
|
---|
235 | libxmla : $(BINDIR)/$(XML_A)
|
---|
236 |
|
---|
237 | utils : $(UTILS)
|
---|
238 |
|
---|
239 | clean :
|
---|
240 | cmd.exe /C "if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)"
|
---|
241 | cmd.exe /C "if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)"
|
---|
242 | cmd.exe /C "if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)"
|
---|
243 | cmd.exe /C "if exist $(BINDIR) rmdir /S /Q $(BINDIR)"
|
---|
244 | cmd.exe /C "if exist depends.mingw del depends.mingw"
|
---|
245 |
|
---|
246 | distclean : clean
|
---|
247 | cmd.exe /C "if exist config.* del config.*"
|
---|
248 | cmd.exe /C "if exist Makefile del Makefile"
|
---|
249 |
|
---|
250 | rebuild : clean all
|
---|
251 |
|
---|
252 | install-libs : all
|
---|
253 | cmd.exe /C "if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml"
|
---|
254 | cmd.exe /C "if not exist $(BINPREFIX) mkdir $(BINPREFIX)"
|
---|
255 | cmd.exe /C "if not exist $(LIBPREFIX) mkdir $(LIBPREFIX)"
|
---|
256 | cmd.exe /C "copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml"
|
---|
257 | cmd.exe /C "copy $(BINDIR)\$(XML_SO) $(SOPREFIX)"
|
---|
258 | cmd.exe /C "copy $(BINDIR)\$(XML_A) $(LIBPREFIX)"
|
---|
259 | cmd.exe /C "copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX)"
|
---|
260 | cmd.exe /C "copy $(BINDIR)\xml*.exe $(BINPREFIX)"
|
---|
261 |
|
---|
262 | install : install-libs
|
---|
263 | cmd.exe /C "copy $(BINDIR)\*.exe $(BINPREFIX)"
|
---|
264 |
|
---|
265 | install-dist : install-libs
|
---|
266 | cmd.exe /C "copy $(BINDIR)\xml*.exe $(BINPREFIX)"
|
---|
267 |
|
---|
268 | # This is a target for me, to make a binary distribution. Not for the public use,
|
---|
269 | # keep your hands off :-)
|
---|
270 | BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION)
|
---|
271 | BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32
|
---|
272 | bindist : all
|
---|
273 | $(MAKE) PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)/bin install-dist
|
---|
274 | cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt
|
---|
275 |
|
---|
276 |
|
---|
277 | # Creates the dependency file
|
---|
278 | dep :
|
---|
279 | $(CC) $(CFLAGS) -M $(XML_SRCS) > depends.mingw
|
---|
280 |
|
---|
281 |
|
---|
282 | # Makes the output directory.
|
---|
283 | $(BINDIR) :
|
---|
284 | cmd.exe /C if not exist $(BINDIR) mkdir $(BINDIR)
|
---|
285 |
|
---|
286 |
|
---|
287 | # Makes the libxml intermediate directory.
|
---|
288 | $(XML_INTDIR) :
|
---|
289 | cmd.exe /C if not exist $(XML_INTDIR) mkdir $(XML_INTDIR)
|
---|
290 |
|
---|
291 | # Makes the static libxml intermediate directory.
|
---|
292 | $(XML_INTDIR_A) :
|
---|
293 | cmd.exe /C if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A)
|
---|
294 |
|
---|
295 | # An implicit rule for libxml compilation.
|
---|
296 | $(XML_INTDIR)/%.o : $(XML_SRCDIR)/%.c
|
---|
297 | $(CC) $(CFLAGS) -o $@ -c $<
|
---|
298 |
|
---|
299 | # An implicit rule for static libxml compilation.
|
---|
300 | $(XML_INTDIR_A)/%.o : $(XML_SRCDIR)/%.c
|
---|
301 | $(CC) $(CFLAGS) -DLIBXML_STATIC -o $@ -c $<
|
---|
302 |
|
---|
303 |
|
---|
304 | # Compiles libxml source. Uses the implicit rule for commands.
|
---|
305 | $(XML_OBJS) : $(XML_INTDIR)
|
---|
306 |
|
---|
307 | # Compiles static libxml source. Uses the implicit rule for commands.
|
---|
308 | $(XML_OBJS_A) : $(XML_INTDIR_A)
|
---|
309 |
|
---|
310 | # Creates the libxml shared object.
|
---|
311 | XMLSO_LDFLAGS = $(LDFLAGS) -shared -Wl,--dll -Wl,--out-implib,$(BINDIR)/$(XML_IMP)
|
---|
312 | $(BINDIR)/$(XML_SO) : $(BINDIR) $(XML_OBJS)
|
---|
313 | $(LD) $(XMLSO_LDFLAGS) -o $(BINDIR)/$(XML_SO) $(XML_OBJS) $(LIBS)
|
---|
314 |
|
---|
315 | # Creates the libxml archive.
|
---|
316 | $(BINDIR)/$(XML_A) : $(BINDIR) $(XML_OBJS_A)
|
---|
317 | $(AR) $(ARFLAGS) $(BINDIR)\$(XML_A) $(XML_OBJS_A)
|
---|
318 |
|
---|
319 |
|
---|
320 | # Makes the utils intermediate directory.
|
---|
321 | $(UTILS_INTDIR) :
|
---|
322 | cmd.exe /C if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR)
|
---|
323 |
|
---|
324 | # An implicit rule for xmllint and friends.
|
---|
325 | ifeq ($(STATIC),1)
|
---|
326 | $(BINDIR)/%.exe : $(UTILS_SRCDIR)/%.c
|
---|
327 | $(CC) -DLIBXML_STATIC $(CFLAGS) -o $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -c $<
|
---|
328 | $(LD) $(LDFLAGS) -o $@ $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -l$(XML_BASENAME) $(LIBS)
|
---|
329 | else
|
---|
330 | $(BINDIR)/%.exe : $(UTILS_SRCDIR)/%.c
|
---|
331 | $(CC) $(CFLAGS) -o $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -c $<
|
---|
332 | $(LD) $(LDFLAGS) -o $@ $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -l$(XML_BASENAME) $(LIBS)
|
---|
333 | endif
|
---|
334 |
|
---|
335 | # Builds xmllint and friends. Uses the implicit rule for commands.
|
---|
336 | $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla
|
---|
337 |
|
---|
338 | # Source dependencies
|
---|
339 | #-include depends.mingw
|
---|
340 |
|
---|