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
|
# Makefile for libxslt, specific for Windows, GCC (mingw) and GNU 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 libxslt 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 'make clean' and then a 'make all'.
# make install to install the library and its header files.
#
# November 2002, Igor Zlatkovic <igor@zlatkovic.com>
AUTOCONF = .\config.mingw
include $(AUTOCONF)
# There should never be a need to modify anything below this line.
# ----------------------------------------------------------------
BASEDIR = ..
XSLT_SRCDIR = $(BASEDIR)\libxslt
EXSLT_SRCDIR = $(BASEDIR)\libexslt
UTILS_SRCDIR = $(BASEDIR)\xsltproc
BINDIR = bin.mingw
# Names of various input and output components.
XSLT_NAME = xslt
XSLT_BASENAME = lib$(XSLT_NAME)
XSLT_SO = $(XSLT_BASENAME).dll
XSLT_IMP = $(XSLT_BASENAME).lib
XSLT_A = $(XSLT_BASENAME).a
EXSLT_NAME = exslt
EXSLT_BASENAME = lib$(EXSLT_NAME)
EXSLT_SO = $(EXSLT_BASENAME).dll
EXSLT_IMP = $(EXSLT_BASENAME).lib
EXSLT_A = $(EXSLT_BASENAME).a
# Places where intermediate files produced by the compiler go
XSLT_INTDIR = int.xslt.mingw
XSLT_INTDIR_A = int.xslta.mingw
EXSLT_INTDIR = int.exslt.mingw
EXSLT_INTDIR_A = int.exslta.mingw
UTILS_INTDIR = int.utils.mingw
# The preprocessor and its options.
CPP = gcc.exe -E
CPPFLAGS +=
# The compiler and its options.
CC = gcc.exe
CFLAGS += -DWIN32 -D_WINDOWS -D_MBCS
CFLAGS += -I$(BASEDIR) -I$(XSLT_SRCDIR) -I$(INCPREFIX)
# The linker and its options.
LD = gcc.exe
LDFLAGS += -Wl,-L,$(BINDIR) -Wl,-L,$(LIBPREFIX)
LIBS = -lwsock32
# The archiver and its options.
AR = ar.exe
ARFLAGS = -r
# Optimisation and debug symbols.
ifeq ($(DEBUG),1)
CFLAGS += -D_DEBUG -g
LDFLAGS +=
else
CFLAGS += -DNDEBUG -O2
LDFLAGS +=
endif
# Libxslt object files.
XSLT_OBJS = $(XSLT_INTDIR)/attributes.o\
$(XSLT_INTDIR)/attrvt.o\
$(XSLT_INTDIR)/documents.o\
$(XSLT_INTDIR)/extensions.o\
$(XSLT_INTDIR)/extra.o\
$(XSLT_INTDIR)/functions.o\
$(XSLT_INTDIR)/imports.o\
$(XSLT_INTDIR)/keys.o\
$(XSLT_INTDIR)/namespaces.o\
$(XSLT_INTDIR)/numbers.o\
$(XSLT_INTDIR)/pattern.o\
$(XSLT_INTDIR)/preproc.o\
$(XSLT_INTDIR)/security.o\
$(XSLT_INTDIR)/templates.o\
$(XSLT_INTDIR)/transform.o\
$(XSLT_INTDIR)/variables.o\
$(XSLT_INTDIR)/xslt.o\
$(XSLT_INTDIR)/xsltlocale.o\
$(XSLT_INTDIR)/xsltutils.o
XSLT_SRCS = $(subst .o,.c,$(subst $(XSLT_INTDIR),$(XSLT_SRCDIR),$(XSLT_OBJS)))
# Static libxslt object files.
XSLT_OBJS_A = $(XSLT_INTDIR_A)/attributes.o\
$(XSLT_INTDIR_A)/attrvt.o\
$(XSLT_INTDIR_A)/documents.o\
$(XSLT_INTDIR_A)/extensions.o\
$(XSLT_INTDIR_A)/extra.o\
$(XSLT_INTDIR_A)/functions.o\
$(XSLT_INTDIR_A)/imports.o\
$(XSLT_INTDIR_A)/keys.o\
$(XSLT_INTDIR_A)/namespaces.o\
$(XSLT_INTDIR_A)/numbers.o\
$(XSLT_INTDIR_A)/pattern.o\
$(XSLT_INTDIR_A)/preproc.o\
$(XSLT_INTDIR_A)/security.o\
$(XSLT_INTDIR_A)/templates.o\
$(XSLT_INTDIR_A)/transform.o\
$(XSLT_INTDIR_A)/variables.o\
$(XSLT_INTDIR_A)/xslt.o\
$(XSLT_INTDIR_A)/xsltlocale.o\
$(XSLT_INTDIR_A)/xsltutils.o
# Libexslt object files.
EXSLT_OBJS = $(EXSLT_INTDIR)/common.o\
$(EXSLT_INTDIR)/crypto.o\
$(EXSLT_INTDIR)/date.o\
$(EXSLT_INTDIR)/exslt.o\
$(EXSLT_INTDIR)/functions.o\
$(EXSLT_INTDIR)/math.o\
$(EXSLT_INTDIR)/saxon.o\
$(EXSLT_INTDIR)/sets.o\
$(EXSLT_INTDIR)/strings.o\
$(EXSLT_INTDIR)/dynamic.o
EXSLT_SRCS = $(subst .o,.c,$(subst $(EXSLT_INTDIR)/,$(EXSLT_SRCDIR)/,$(EXSLT_OBJS)))
# Static libexslt object files.
EXSLT_OBJS_A = $(EXSLT_INTDIR_A)/common.o\
$(EXSLT_INTDIR_A)/crypto.o\
$(EXSLT_INTDIR_A)/date.o\
$(EXSLT_INTDIR_A)/exslt.o\
$(EXSLT_INTDIR_A)/functions.o\
$(EXSLT_INTDIR_A)/math.o\
$(EXSLT_INTDIR_A)/saxon.o\
$(EXSLT_INTDIR_A)/sets.o\
$(EXSLT_INTDIR_A)/strings.o\
$(EXSLT_INTDIR_A)/dynamic.o
# Xsltproc and friends executables.
UTILS = $(BINDIR)/xsltproc.exe
all : dep libxslt libxslta libexslt libexslta utils
libxslt : $(BINDIR)\$(XSLT_SO)
libxslta : $(BINDIR)\$(XSLT_A)
libexslt : $(BINDIR)\$(EXSLT_SO)
libexslta : $(BINDIR)\$(EXSLT_A)
utils : $(UTILS)
clean :
cmd.exe /C "if exist $(XSLT_INTDIR) rmdir /S /Q $(XSLT_INTDIR)"
cmd.exe /C "if exist $(XSLT_INTDIR_A) rmdir /S /Q $(XSLT_INTDIR_A)"
cmd.exe /C "if exist $(EXSLT_INTDIR) rmdir /S /Q $(EXSLT_INTDIR)"
cmd.exe /C "if exist $(EXSLT_INTDIR_A) rmdir /S /Q $(EXSLT_INTDIR_A)"
cmd.exe /C "if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)"
cmd.exe /C "if exist $(BINDIR) rmdir /S /Q $(BINDIR)"
cmd.exe /C "if exist depends.mingw del depends.mingw"
rebuild : clean all
distclean : clean
cmd.exe /C "if exist config.* del config.*"
cmd.exe /C "if exist depends.* del depends.*"
cmd.exe /C "if exist Makefile del Makefile"
install-libs : all
cmd.exe /C "if not exist $(INCPREFIX)\$(XSLT_BASENAME) mkdir $(INCPREFIX)\$(XSLT_BASENAME)"
cmd.exe /C "if not exist $(INCPREFIX)\$(EXSLT_BASENAME) mkdir $(INCPREFIX)\$(EXSLT_BASENAME)"
cmd.exe /C "if not exist $(BINPREFIX) mkdir $(BINPREFIX)"
cmd.exe /C "if not exist $(LIBPREFIX) mkdir $(LIBPREFIX)"
cmd.exe /C "copy $(XSLT_SRCDIR)\*.h $(INCPREFIX)\$(XSLT_BASENAME)"
cmd.exe /C "copy $(EXSLT_SRCDIR)\*.h $(INCPREFIX)\$(EXSLT_BASENAME)"
cmd.exe /C "copy $(BINDIR)\$(XSLT_SO) $(SOPREFIX)"
cmd.exe /C "copy $(BINDIR)\$(XSLT_A) $(LIBPREFIX)"
cmd.exe /C "copy $(BINDIR)\$(XSLT_IMP) $(LIBPREFIX)"
cmd.exe /C "copy $(BINDIR)\$(EXSLT_SO) $(SOPREFIX)"
cmd.exe /C "copy $(BINDIR)\$(EXSLT_A) $(LIBPREFIX)"
cmd.exe /C "copy $(BINDIR)\$(EXSLT_IMP) $(LIBPREFIX)"
install : install-libs
cmd.exe /C "copy $(BINDIR)\*.exe $(BINPREFIX)"
install-dist : install
# This is a target for me, to make a binary distribution. Not for the public use,
# keep your hands off :-)
BDVERSION = $(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION).$(LIBXSLT_MICRO_VERSION)
BDPREFIX = $(XSLT_BASENAME)-$(BDVERSION).win32
bindist : all
$(MAKE) PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)/bin install-dist
cscript //NoLogo configure.js genreadme $(XSLT_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt
# Creates the dependency files
dep :
$(CC) $(subst \,/,$(CFLAGS)) -MM $(subst \,/,$(XSLT_SRCS)) $(subst \,/,$(EXSLT_SRCS)) > depends.mingw
# Makes the compiler output directory.
$(BINDIR) :
cmd.exe /C "if not exist $(BINDIR) mkdir $(BINDIR)"
# Makes the libxslt intermediate directory.
$(XSLT_INTDIR) :
cmd.exe /C "if not exist $(XSLT_INTDIR) mkdir $(XSLT_INTDIR)"
# Makes the static libxslt intermediate directory.
$(XSLT_INTDIR_A) :
cmd.exe /C "if not exist $(XSLT_INTDIR_A) mkdir $(XSLT_INTDIR_A)"
# An implicit rule for libxslt compilation.
$(XSLT_INTDIR)/%.o : $(XSLT_SRCDIR)/%.c
$(CC) $(CFLAGS) -c -o $@ $<
# An implicit rule for static libxslt compilation.
$(XSLT_INTDIR_A)/%.o : $(XSLT_SRCDIR)/%.c
$(CC) $(CFLAGS) -DLIBXML_STATIC -DLIBXSLT_STATIC -o $@ -c $<
# Compiles libxslt source. Uses the implicit rule for commands.
$(XSLT_OBJS) : $(XSLT_INTDIR)
# Compiles static libxslt source. Uses the implicit rule for commands.
$(XSLT_OBJS_A) : $(XSLT_INTDIR_A)
# Creates the libxslt shared object.
XSLTSO_LDFLAGS = $(LDFLAGS) -shared -Wl,--dll -Wl,--out-implib,$(BINDIR)/$(XSLT_IMP)
XSLTSO_LDFLAGS += -Wl,--major-image-version,$(LIBXSLT_MAJOR_VERSION)
XSLTSO_LDFLAGS += -Wl,--minor-image-version,$(LIBXSLT_MINOR_VERSION)
$(BINDIR)\$(XSLT_SO) : $(BINDIR) $(XSLT_OBJS)
$(LD) $(XSLTSO_LDFLAGS) -o $(BINDIR)/$(XSLT_SO) $(XSLT_OBJS) $(LIBS) -llibxml2
# Creates the libxslt archive.
$(BINDIR)\$(XSLT_A) : $(BINDIR) $(XSLT_OBJS_A)
$(AR) $(ARFLAGS) $(BINDIR)/$(XSLT_A) $(XSLT_OBJS_A)
# Creates the libexslt intermediate directory.
$(EXSLT_INTDIR) :
cmd.exe /C "if not exist $(EXSLT_INTDIR) mkdir $(EXSLT_INTDIR)"
# Creates the static libexslt intermediate directory.
$(EXSLT_INTDIR_A) :
cmd.exe /C "if not exist $(EXSLT_INTDIR_A) mkdir $(EXSLT_INTDIR_A)"
# An implicit rule for libexslt compilation.
$(EXSLT_INTDIR)/%.o : $(EXSLT_SRCDIR)/%.c
$(CC) $(CFLAGS) -I$(EXSLT_SRCDIR) -o $@ -c $<
# An implicit rule for static libexslt compilation.
$(EXSLT_INTDIR_A)/%.o : $(EXSLT_SRCDIR)/%.c
$(CC) $(CFLAGS) -DLIBXML_STATIC -DLIBXSLT_STATIC -DLIBEXSLT_STATIC \
-I$(EXSLT_SRCDIR) -o $@ -c $<
# Compiles libxslt source. Uses the implicit rule for commands.
$(EXSLT_OBJS) : $(EXSLT_INTDIR)
# Compiles libxslt source. Uses the implicit rule for commands.
$(EXSLT_OBJS_A) : $(EXSLT_INTDIR_A)
# Creates the libexslt shared object.
EXSLTSO_LDFLAGS = $(LDFLAGS) -shared -Wl,--dll -Wl,--out-implib,$(BINDIR)/$(EXSLT_IMP)
EXSLTSO_LDFLAGS += -Wl,--major-image-version,$(LIBEXSLT_MAJOR_VERSION)
EXSLTSO_LDFLAGS += -Wl,--minor-image-version,$(LIBEXSLT_MINOR_VERSION)
$(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) libxslt
$(LD) $(EXSLTSO_LDFLAGS) -o $(BINDIR)/$(EXSLT_SO) $(EXSLT_OBJS) $(LIBS) -l$(XSLT_BASENAME) -llibxml2
# Creates the libexslt archive.
$(BINDIR)\$(EXSLT_A) : $(BINDIR) $(EXSLT_OBJS_A) libxslta
$(AR) $(ARFLAGS) $(BINDIR)\$(EXSLT_A) $(EXSLT_OBJS_A)
# Creates the utils intermediate directory.
$(UTILS_INTDIR) :
cmd.exe /C "if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR)"
# An implicit rule for xsltproc and friends.
APPLIBS = $(LIBS)
APPLIBS += -llibxml2 -l$(XSLT_BASENAME) -l$(EXSLT_BASENAME)
APP_LDFLAGS = $(LDFLAGS)
APP_LDFLAGS += -Wl,--major-image-version,$(LIBXSLT_MAJOR_VERSION)
APP_LDFLAGS += -Wl,--minor-image-version,$(LIBXSLT_MINOR_VERSION)
ifeq ($(STATIC),1)
CFLAGS += -DLIBXML_STATIC -DLIBXSLT_STATIC -DLIBEXSLT_STATIC
APP_LDFLAGS += -Bstatic
$(BINDIR)/%.exe : $(UTILS_SRCDIR)/%.c
$(CC) $(CFLAGS) -o $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -c $<
$(LD) $(APP_LDFLAGS) -o $@ $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) $(APPLIBS)
else
$(BINDIR)/%.exe : $(UTILS_SRCDIR)/%.c
$(CC) $(CFLAGS) -o $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -c $<
$(LD) $(APP_LDFLAGS) -o $@ $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) $(APPLIBS)
endif
# Builds xsltproc and friends. Uses the implicit rule for commands.
$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta
# Source dependencies, just how?
#-include depends.mingw
|