VirtualBox

source: vbox/trunk/src/libs/libxml2-2.9.14/win32/Makefile.mingw@ 98879

Last change on this file since 98879 was 95312, checked in by vboxsync, 2 years ago

libs/{curl,libxml2}: OSE export fixes, bugref:8515

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette