summaryrefslogtreecommitdiff
path: root/win32/Makefile.bcb
blob: ab4d08028cba94414d13f57af69171e5d3dfb183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# Makefile for libxml2, specific for Windows, BCB6 and Borland make.
#
# Take a look at the beginning and modify the variables to suit your 
# environment. Having done that, you can do a
#
# make [all]     to build the libxml and the accompanying utilities.
# make clean     to remove all compiler output files and return to a
#                 clean state.
# make rebuild   to rebuild everything from scratch. This basically does
#                 a 'nmake clean' and then a 'nmake all'.
# make install   to install the library and its header files.
#
# August 2003, Eric Zurcher <Eric.Zurcher@csiro.au>
# based on the MSVC version of
# March 2002, Igor Zlatkovic <igor@zlatkovic.com>
#

# There should never be a need to modify anything below this line.
# ----------------------------------------------------------------

AUTOCONF = .\config.bcb
!include $(AUTOCONF)

!if !$d(BCB)
BCB = $(MAKEDIR)\..
!endif
.autodepend

# Names of various input and output components.
XML_NAME = xml2
XML_BASENAME = lib$(XML_NAME)
XML_SO = $(XML_BASENAME).dll
XML_IMP = $(XML_BASENAME).lib
XML_DEF = $(XML_BASENAME).def
XML_A = $(XML_BASENAME)_a.lib
DUMMY = dir.exists

# Place where we let the compiler put its intermediate trash.
BINDIR = bin.bcb
XML_INTDIR = int.bcb
XML_INTDIR_A = int.a.bcb
UTILS_INTDIR = int.utils.bcb

# The preprocessor and its options.
CPP = cpp32.exe -P- -DWIN32
CPPFLAGS = -I"$(XML_SRCDIR)\include"
!if "$(WITH_THREADS)" != "no"
CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__
!endif

# The compiler and its options.
CC = bcc32.exe
CFLAGS = -q -DWIN32 -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -w-
CFLAGS = $(CFLAGS) -I"$(XML_SRCDIR)" -I"$(XML_SRCDIR)\include" -I"$(INCPREFIX)" -I"$(INCLUDE)"
!if "$(WITH_THREADS)" != "no"
CFLAGS = $(CFLAGS) -D_REENTRANT -tWM
!endif
!if "$(DYNRUNTIME)" == "1"
CFLAGS = $(CFLAGS) -tWR
!endif
!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
!else if "$(WITH_THREADS)" == "native"
CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS
!else if "$(WITH_THREADS)" == "posix"
CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H
!endif
!if "$(WITH_ZLIB)" == "1"
CFLAGS = $(CFLAGS) -DHAVE_ZLIB_H
!endif

# The linker and its options.
LD = ilink32.exe
LDFLAGS = -q -U$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION)
LDFLAGS = $(LDFLAGS) -L"$(BINDIR);$(LIBPREFIX);$(LIB);$(BCB)\lib\PSdk"
LIBS = import32.lib
!if "$(WITH_THREADS)" != "no" && "$(DYNRUNTIME)" == "1"
LIBS = $(LIBS) cw32mti.lib
!elif "$(WITH_THREADS)" != "no"
LIBS = $(LIBS) cw32mt.lib
!elif "$(DYNRUNTIME)" == "1"
LIBS = $(LIBS) cw32i.lib
!else
LIBS = $(LIBS) cw32.lib
!endif
!if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1"
LIBS = $(LIBS) wsock32.lib
!endif 
!if "$(WITH_ICONV)" == "1"
LIBS = $(LIBS) iconvomf.lib
!endif 
!if "$(WITH_ZLIB)" == "1"
LIBS = $(LIBS) zlibomf.lib
!endif
!if "$(WITH_THREADS)" == "posix"
LIBS = $(LIBS) pthreadVC.lib
!endif

# The archiver and its options.
AR = tlib.exe
ARFLAGS = /P64 /0

# Optimisation and debug symbols.
!if "$(DEBUG)" == "1"
CFLAGS = $(CFLAGS) -D_DEBUG -Od -v
LDFLAGS = $(LDFLAGS) -v
!else
CFLAGS = $(CFLAGS) -DNDEBUG -O2 
LDFLAGS = $(LDFLAGS)
!endif

# Libxml object files.
XML_OBJS = $(XML_INTDIR)\c14n.obj\
	$(XML_INTDIR)\catalog.obj\
	$(XML_INTDIR)\chvalid.obj\
	$(XML_INTDIR)\debugXML.obj\
	$(XML_INTDIR)\dict.obj\
	$(XML_INTDIR)\DOCBparser.obj\
	$(XML_INTDIR)\encoding.obj\
	$(XML_INTDIR)\entities.obj\
	$(XML_INTDIR)\error.obj\
	$(XML_INTDIR)\globals.obj\
	$(XML_INTDIR)\hash.obj\
	$(XML_INTDIR)\HTMLparser.obj\
	$(XML_INTDIR)\HTMLtree.obj\
	$(XML_INTDIR)\legacy.obj\
	$(XML_INTDIR)\list.obj\
	$(XML_INTDIR)\nanoftp.obj\
	$(XML_INTDIR)\nanohttp.obj\
	$(XML_INTDIR)\parser.obj\
	$(XML_INTDIR)\parserInternals.obj\
	$(XML_INTDIR)\pattern.obj\
	$(XML_INTDIR)\relaxng.obj\
	$(XML_INTDIR)\SAX.obj\
	$(XML_INTDIR)\SAX2.obj\
	$(XML_INTDIR)\threads.obj\
	$(XML_INTDIR)\tree.obj\
	$(XML_INTDIR)\uri.obj\
	$(XML_INTDIR)\valid.obj\
	$(XML_INTDIR)\xinclude.obj\
	$(XML_INTDIR)\xlink.obj\
	$(XML_INTDIR)\xmlIO.obj\
	$(XML_INTDIR)\xmlmemory.obj\
	$(XML_INTDIR)\xmlreader.obj\
	$(XML_INTDIR)\xmlregexp.obj\
	$(XML_INTDIR)\xmlsave.obj\
	$(XML_INTDIR)\xmlschemas.obj\
	$(XML_INTDIR)\xmlschemastypes.obj\
	$(XML_INTDIR)\xmlunicode.obj\
	$(XML_INTDIR)\xmlwriter.obj\
	$(XML_INTDIR)\xpath.obj\
	$(XML_INTDIR)\xpointer.obj\
	$(XML_INTDIR)\xmlstring.obj

# Static libxml object files.
XML_OBJS_A = $(XML_INTDIR_A)\c14n.obj\
	$(XML_INTDIR_A)\catalog.obj\
	$(XML_INTDIR_A)\chvalid.obj\
	$(XML_INTDIR_A)\debugXML.obj\
	$(XML_INTDIR_A)\dict.obj\
	$(XML_INTDIR_A)\DOCBparser.obj\
	$(XML_INTDIR_A)\encoding.obj\
	$(XML_INTDIR_A)\entities.obj\
	$(XML_INTDIR_A)\error.obj\
	$(XML_INTDIR_A)\globals.obj\
	$(XML_INTDIR_A)\hash.obj\
	$(XML_INTDIR_A)\HTMLparser.obj\
	$(XML_INTDIR_A)\HTMLtree.obj\
	$(XML_INTDIR_A)\legacy.obj\
	$(XML_INTDIR_A)\list.obj\
	$(XML_INTDIR_A)\nanoftp.obj\
	$(XML_INTDIR_A)\nanohttp.obj\
	$(XML_INTDIR_A)\parser.obj\
	$(XML_INTDIR_A)\parserInternals.obj\
	$(XML_INTDIR_A)\pattern.obj\
	$(XML_INTDIR_A)\relaxng.obj\
	$(XML_INTDIR_A)\SAX.obj\
	$(XML_INTDIR_A)\SAX2.obj\
	$(XML_INTDIR_A)\threads.obj\
	$(XML_INTDIR_A)\tree.obj\
	$(XML_INTDIR_A)\uri.obj\
	$(XML_INTDIR_A)\valid.obj\
	$(XML_INTDIR_A)\xinclude.obj\
	$(XML_INTDIR_A)\xlink.obj\
	$(XML_INTDIR_A)\xmlIO.obj\
	$(XML_INTDIR_A)\xmlmemory.obj\
	$(XML_INTDIR_A)\xmlreader.obj\
	$(XML_INTDIR_A)\xmlregexp.obj\
	$(XML_INTDIR_A)\xmlsave.obj\
	$(XML_INTDIR_A)\xmlschemas.obj\
	$(XML_INTDIR_A)\xmlschemastypes.obj\
	$(XML_INTDIR_A)\xmlunicode.obj\
	$(XML_INTDIR_A)\xmlwriter.obj\
	$(XML_INTDIR_A)\xpath.obj\
	$(XML_INTDIR_A)\xpointer.obj\
	$(XML_INTDIR_A)\xmlstring.obj

# Xmllint and friends executables.
UTILS = $(BINDIR)\xmllint.exe\
	$(BINDIR)\xmlcatalog.exe\
	$(BINDIR)\testAutomata.exe\
	$(BINDIR)\testC14N.exe\
	$(BINDIR)\testDocbook.exe\
	$(BINDIR)\testHTML.exe\
	$(BINDIR)\testReader.exe\
	$(BINDIR)\testRelax.exe\
	$(BINDIR)\testRegexp.exe\
	$(BINDIR)\testSAX.exe\
	$(BINDIR)\testSchemas.exe\
	$(BINDIR)\testURI.exe\
	$(BINDIR)\testXPath.exe


!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native"
UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe
!else if "$(WITH_THREADS)" == "posix"
UTILS = $(UTILS) $(BINDIR)\testThreads.exe
!endif


all : libxml libxmla utils

libxml : $(BINDIR)\$(XML_SO) 

libxmla : $(BINDIR)\$(XML_A)

utils : $(UTILS)

clean :
	if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
	if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
	if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
	if exist $(BINDIR) rmdir /S /Q $(BINDIR)

distclean : clean
	if exist config.* del config.*
	if exist Makefile del Makefile

rebuild : clean all

install : all
	if not exist "$(INCPREFIX)\libxml" mkdir "$(INCPREFIX)\libxml"
	if not exist "$(BINPREFIX)" mkdir "$(BINPREFIX)"
	if not exist "$(LIBPREFIX)" mkdir "$(LIBPREFIX)"
	copy $(XML_SRCDIR)\include\libxml\*.h "$(INCPREFIX)\libxml"
	copy $(BINDIR)\$(XML_SO) "$(SOPREFIX)"
	copy $(BINDIR)\$(XML_A) "$(LIBPREFIX)"
	copy $(BINDIR)\$(XML_IMP) "$(LIBPREFIX)"
	copy $(BINDIR)\*.exe "$(BINPREFIX)"

# This is a target for me, to make a binary distribution. Not for the public use,
# keep your hands off :-)
BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION)
BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32
bindist : all
	$(MAKE) /nologo PREFIX=$(BDPREFIX) BINPREFIX=$(BDPREFIX)\util install
	cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt


# Makes the output directory.
$(BINDIR)\$(DUMMY) :
	if not exist $(BINDIR) mkdir $(BINDIR)
	touch $(BINDIR)\$(DUMMY)

# Makes the libxml intermediate directory.
$(XML_INTDIR)\$(DUMMY) :
	if not exist $(XML_INTDIR) mkdir $(XML_INTDIR)
	touch $(XML_INTDIR)\$(DUMMY)

# Makes the static libxml intermediate directory.
$(XML_INTDIR_A)\$(DUMMY) :
	if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A)
	touch $(XML_INTDIR_A)\$(DUMMY)

# An implicit rule for libxml compilation.
{$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj:
	$(CC) $(CFLAGS) -n$(XML_INTDIR) -c $<

# An implicit rule for static libxml compilation.
{$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj:
	$(CC) $(CFLAGS) -DLIBXML_STATIC -n$(XML_INTDIR_A)\ -c $<

# Compiles libxml source. Uses the implicit rule for commands.
$(XML_OBJS) : $(XML_INTDIR)\$(DUMMY)

# Compiles static libxml source. Uses the implicit rule for commands.
$(XML_OBJS_A) : $(XML_INTDIR_A)\$(DUMMY) 

#def4bcb.exe : def4bcb.c

# Creates the export definition file (DEF) for libxml.
#$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR)\$(DUMMY) $(XML_DEF).src def4bcb.exe
#	$(CPP) $(CPPFLAGS) -o $(XML_INTDIR)\$(XML_DEF).tmp $(XML_DEF).src
#	def4bcb -msnames < $(XML_INTDIR)\$(XML_DEF).tmp > $(XML_INTDIR)\$(XML_DEF)

# Creates the libxml shared object.
$(BINDIR)\$(XML_SO) : $(BINDIR)\$(DUMMY) $(XML_OBJS)
	$(LD) $(LDFLAGS) -Tpd -Gi c0d32.obj $(XML_OBJS),$(BINDIR)\$(XML_SO),,$(LIBS)

#$(BINDIR)\$(XML_SO) : $(BINDIR)\$(DUMMY) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF)
#	$(LD) $(LDFLAGS) -Tpd -Gi c0d32.obj $(XML_OBJS),$(BINDIR)\$(XML_SO),,$(LIBS),$(XML_INTDIR)\$(XML_DEF)

# Creates the libxml archive.
$(BINDIR)\$(XML_A) : $(BINDIR)\$(DUMMY) $(XML_OBJS_A)
	$(AR) $(BINDIR)\$(XML_A) $(ARFLAGS) /u $(XML_OBJS_A)

# Makes the utils intermediate directory.
$(UTILS_INTDIR)\$(DUMMY) :
	if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR)
	touch $(UTILS_INTDIR)\$(DUMMY)

# An implicit rule for xmllint and friends.
!if "$(STATIC)" == "1"
{$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
	$(CC) -DLIBXML_STATIC -w -tWC $(CFLAGS) -o$(UTILS_INTDIR)\$&.obj -c $< 
	$(LD) $(LDFLAGS) c0x32.obj $(UTILS_INTDIR)\$&.obj,$@,,$(LIBS) $(XML_A)
!else
{$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
	$(CC) $(CFLAGS) -tWC -o$(UTILS_INTDIR)\$&.obj -c $< 
	$(LD) $(LDFLAGS) c0x32.obj $(UTILS_INTDIR)\$&.obj $(XML_IMP),$@,,$(LIBS) 
!endif

# Builds xmllint and friends. Uses the implicit rule for commands.
$(UTILS) : $(UTILS_INTDIR)\$(DUMMY) $(BINDIR)\$(DUMMY) $(BINDIR)\$(XML_SO) $(BINDIR)\$(XML_A)

# Source dependences should be autogenerated somehow here, but how to
# do it? I have no clue.