VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/win32/Makefile.mingw@ 107377

Last change on this file since 107377 was 105420, checked in by vboxsync, 6 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

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