summaryrefslogtreecommitdiffstats
path: root/libxslt/win32/Makefile.msvc
blob: 23a02d277d5e098a027e1c750597a2ea860478c3 (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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# Makefile for libxslt, specific for Windows, MSVC and NMAKE.
#
# Take a look at the beginning and modify the variables to suit your 
# environment. Having done that, you can do a
#
# nmake [all]     to build the libxslt and the accompanying utilities.
# nmake clean     to remove all compiler output files and return to a
#                 clean state.
# nmake rebuild   to rebuild everything from scratch. This basically does
#                 a 'nmake clean' and then a 'nmake all'.
# nmake install   to install the library and its header files.
#
# March 2002, Igor Zlatkovic <igor@zlatkovic.com>

AUTOCONF = .\config.msvc
!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.msvc

# 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_DEF = $(XSLT_BASENAME).def
XSLT_A = $(XSLT_BASENAME)_a.lib
EXSLT_NAME = exslt
EXSLT_BASENAME = lib$(EXSLT_NAME)
EXSLT_SO = $(EXSLT_BASENAME).dll
EXSLT_IMP = $(EXSLT_BASENAME).lib
EXSLT_DEF = $(EXSLT_BASENAME).def
EXSLT_A = $(EXSLT_BASENAME)_a.lib

# Places where intermediate files produced by the compiler go
XSLT_INTDIR = int.xslt.msvc
XSLT_INTDIR_A = int.xslta.msvc
EXSLT_INTDIR = int.exslt.msvc
EXSLT_INTDIR_A = int.exslta.msvc
UTILS_INTDIR = int.utils.msvc

# The preprocessor and its options.
CPP = cl.exe /EP
CPPFLAGS = /nologo

# The compiler and its options.
CC = cl.exe
CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 $(CRUNTIME) /D "_REENTRANT"
CFLAGS = $(CFLAGS) /I$(BASEDIR) /I$(XSLT_SRCDIR) /I$(INCPREFIX)
CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE

# The linker and its options.
LD = link.exe
LDFLAGS = /nologo
LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX)
LIBS = wsock32.lib

# The archiver and its options.
AR = lib.exe
ARFLAGS = /nologo

# Optimisation and debug symbols.
!if "$(DEBUG)" == "1"
CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7
LDFLAGS = $(LDFLAGS) /DEBUG
!else
CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 
!endif

# Libxslt object files.
XSLT_OBJS = $(XSLT_INTDIR)\attributes.obj\
	$(XSLT_INTDIR)\documents.obj\
	$(XSLT_INTDIR)\extensions.obj\
	$(XSLT_INTDIR)\extra.obj\
	$(XSLT_INTDIR)\functions.obj\
	$(XSLT_INTDIR)\imports.obj\
	$(XSLT_INTDIR)\keys.obj\
	$(XSLT_INTDIR)\namespaces.obj\
	$(XSLT_INTDIR)\numbers.obj\
	$(XSLT_INTDIR)\pattern.obj\
	$(XSLT_INTDIR)\preproc.obj\
	$(XSLT_INTDIR)\security.obj\
	$(XSLT_INTDIR)\templates.obj\
	$(XSLT_INTDIR)\transform.obj\
	$(XSLT_INTDIR)\variables.obj\
	$(XSLT_INTDIR)\xslt.obj\
	$(XSLT_INTDIR)\xsltlocale.obj\
	$(XSLT_INTDIR)\xsltutils.obj\
	$(XSLT_INTDIR)\attrvt.obj

# Static libxslt object files.
XSLT_OBJS_A = $(XSLT_INTDIR_A)\attributes.obj\
	$(XSLT_INTDIR_A)\documents.obj\
	$(XSLT_INTDIR_A)\extensions.obj\
	$(XSLT_INTDIR_A)\extra.obj\
	$(XSLT_INTDIR_A)\functions.obj\
	$(XSLT_INTDIR_A)\imports.obj\
	$(XSLT_INTDIR_A)\keys.obj\
	$(XSLT_INTDIR_A)\namespaces.obj\
	$(XSLT_INTDIR_A)\numbers.obj\
	$(XSLT_INTDIR_A)\pattern.obj\
	$(XSLT_INTDIR_A)\preproc.obj\
	$(XSLT_INTDIR_A)\security.obj\
	$(XSLT_INTDIR_A)\templates.obj\
	$(XSLT_INTDIR_A)\transform.obj\
	$(XSLT_INTDIR_A)\variables.obj\
	$(XSLT_INTDIR_A)\xslt.obj\
	$(XSLT_INTDIR_A)\xsltlocale.obj\
	$(XSLT_INTDIR_A)\xsltutils.obj\
	$(XSLT_INTDIR_A)\attrvt.obj

# Libexslt object files.
EXSLT_OBJS = $(EXSLT_INTDIR)\common.obj\
	$(EXSLT_INTDIR)\crypto.obj\
	$(EXSLT_INTDIR)\date.obj\
	$(EXSLT_INTDIR)\exslt.obj\
	$(EXSLT_INTDIR)\functions.obj\
	$(EXSLT_INTDIR)\math.obj\
	$(EXSLT_INTDIR)\saxon.obj\
	$(EXSLT_INTDIR)\sets.obj\
	$(EXSLT_INTDIR)\strings.obj\
	$(EXSLT_INTDIR)\dynamic.obj

# Static libexslt object files.
EXSLT_OBJS_A = $(EXSLT_INTDIR_A)\common.obj\
	$(EXSLT_INTDIR_A)\crypto.obj\
	$(EXSLT_INTDIR_A)\date.obj\
	$(EXSLT_INTDIR_A)\exslt.obj\
	$(EXSLT_INTDIR_A)\functions.obj\
	$(EXSLT_INTDIR_A)\math.obj\
	$(EXSLT_INTDIR_A)\saxon.obj\
	$(EXSLT_INTDIR_A)\sets.obj\
	$(EXSLT_INTDIR_A)\strings.obj\
	$(EXSLT_INTDIR_A)\dynamic.obj


# Xsltproc and friends executables.
UTILS = $(BINDIR)\xsltproc.exe

!if "$(VCMANIFEST)" == "1"
_VC_MANIFEST_EMBED_EXE= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1
_VC_MANIFEST_EMBED_DLL= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2
!else
_VC_MANIFEST_EMBED_EXE=
_VC_MANIFEST_EMBED_DLL=
!endif

all : libxslt libxslta libexslt libexslta utils

libxslt : $(BINDIR)\$(XSLT_SO) 

libxslta : $(BINDIR)\$(XSLT_A)

libexslt : $(BINDIR)\$(EXSLT_SO) 

libexslta : $(BINDIR)\$(EXSLT_A)

utils : $(UTILS)

clean :
	if exist $(XSLT_INTDIR) rmdir /S /Q $(XSLT_INTDIR)
	if exist $(XSLT_INTDIR_A) rmdir /S /Q $(XSLT_INTDIR_A)
	if exist $(EXSLT_INTDIR) rmdir /S /Q $(EXSLT_INTDIR)
	if exist $(EXSLT_INTDIR_A) rmdir /S /Q $(EXSLT_INTDIR_A)
	if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
	if exist $(BINDIR) rmdir /S /Q $(BINDIR)

rebuild : clean all

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

install-libs : all
	if not exist $(INCPREFIX)\$(XSLT_BASENAME) mkdir $(INCPREFIX)\$(XSLT_BASENAME)
	if not exist $(INCPREFIX)\$(EXSLT_BASENAME) mkdir $(INCPREFIX)\$(EXSLT_BASENAME)
	if not exist $(BINPREFIX) mkdir $(BINPREFIX)
	if not exist $(LIBPREFIX) mkdir $(LIBPREFIX)
	copy $(XSLT_SRCDIR)\*.h $(INCPREFIX)\$(XSLT_BASENAME)
	copy $(EXSLT_SRCDIR)\*.h $(INCPREFIX)\$(EXSLT_BASENAME)
	copy $(BINDIR)\$(XSLT_SO) $(SOPREFIX)
	copy $(BINDIR)\$(XSLT_A) $(LIBPREFIX)
	copy $(BINDIR)\$(XSLT_IMP) $(LIBPREFIX)
	copy $(BINDIR)\$(EXSLT_SO) $(SOPREFIX)
	copy $(BINDIR)\$(EXSLT_A) $(LIBPREFIX)
	copy $(BINDIR)\$(EXSLT_IMP) $(LIBPREFIX)

install : install-libs
	copy $(BINDIR)\*.exe $(BINPREFIX)
	-copy $(BINDIR)\*.pdb $(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) /nologo PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)\bin install-dist
	cscript //NoLogo configure.js genreadme $(XSLT_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt

# Makes the compiler output directory.
$(BINDIR) :
	if not exist $(BINDIR) mkdir $(BINDIR)


# Makes the libxslt intermediate directory.
$(XSLT_INTDIR) :
	if not exist $(XSLT_INTDIR) mkdir $(XSLT_INTDIR)

# Makes the static libxslt intermediate directory.
$(XSLT_INTDIR_A) :
	if not exist $(XSLT_INTDIR_A) mkdir $(XSLT_INTDIR_A)

# An implicit rule for libxslt compilation.
{$(XSLT_SRCDIR)}.c{$(XSLT_INTDIR)}.obj::
	$(CC) $(CFLAGS) /Fo$(XSLT_INTDIR)\ /c $<

# An implicit rule for static libxslt compilation.
{$(XSLT_SRCDIR)}.c{$(XSLT_INTDIR_A)}.obj::
	$(CC) $(CFLAGS) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" \
		/Fo$(XSLT_INTDIR_A)\ /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 export definition file (DEF) for libxslt.
$(XSLT_INTDIR)\$(XSLT_DEF) : $(XSLT_INTDIR) $(XSLT_DEF).src
	$(CPP) $(CPPFLAGS) $(XSLT_DEF).src > $(XSLT_INTDIR)\$(XSLT_DEF)

# Creates the libxslt shared object.
$(BINDIR)\$(XSLT_SO) : $(BINDIR) $(XSLT_OBJS) $(XSLT_INTDIR)\$(XSLT_DEF)
	$(LD) $(LDFLAGS) /DLL \
		/VERSION:$(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION) \
		/IMPLIB:$(BINDIR)\$(XSLT_IMP) /OUT:$(BINDIR)\$(XSLT_SO) \
		$(XSLT_OBJS) $(LIBS) libxml2.lib
			@$(_VC_MANIFEST_EMBED_DLL)

#$(BINDIR)\$(XSLT_SO) : $(BINDIR) $(XSLT_OBJS) $(XSLT_INTDIR)\$(XSLT_DEF)
#	$(LD) $(LDFLAGS) /DLL /DEF:$(XSLT_INTDIR)\$(XSLT_DEF) \
#		/VERSION:$(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION) \
#		/IMPLIB:$(BINDIR)\$(XSLT_IMP) /OUT:$(BINDIR)\$(XSLT_SO) \
#		$(XSLT_OBJS) $(LIBS) libxml2.lib

# Creates the libxslt archive.
$(BINDIR)\$(XSLT_A) : $(BINDIR) $(XSLT_OBJS_A)
	$(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XSLT_A) $(XSLT_OBJS_A)


# Creates the libexslt intermediate directory.
$(EXSLT_INTDIR) :
	if not exist $(EXSLT_INTDIR) mkdir $(EXSLT_INTDIR)

# Creates the static libexslt intermediate directory.
$(EXSLT_INTDIR_A) :
	if not exist $(EXSLT_INTDIR_A) mkdir $(EXSLT_INTDIR_A)

# An implicit rule for libexslt compilation.
{$(EXSLT_SRCDIR)}.c{$(EXSLT_INTDIR)}.obj::
	$(CC) /I$(EXSLT_SRCDIR) $(CFLAGS) /Fo$(EXSLT_INTDIR)\ /c $<

# An implicit rule for static libexslt compilation.
{$(EXSLT_SRCDIR)}.c{$(EXSLT_INTDIR_A)}.obj::
	$(CC) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" \
		/I$(EXSLT_SRCDIR) $(CFLAGS) /Fo$(EXSLT_INTDIR_A)\ /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 export definition file (DEF) for libxslt.
$(EXSLT_INTDIR)\$(EXSLT_DEF) : $(EXSLT_INTDIR) $(EXSLT_DEF).src
	$(CPP) $(CPPFLAGS) $(EXSLT_DEF).src > $(EXSLT_INTDIR)\$(EXSLT_DEF)

# Creates the libexslt shared object.
$(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) $(EXSLT_INTDIR)\$(EXSLT_DEF) libxslt
	$(LD) $(LDFLAGS) /DLL \
		/VERSION:$(LIBEXSLT_MAJOR_VERSION).$(LIBEXSLT_MINOR_VERSION) \
		/IMPLIB:$(BINDIR)\$(EXSLT_IMP) /OUT:$(BINDIR)\$(EXSLT_SO) \
		$(EXSLT_OBJS) $(XSLT_IMP) $(LIBS) libxml2.lib
			@$(_VC_MANIFEST_EMBED_DLL)

#$(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) $(EXSLT_INTDIR)\$(EXSLT_DEF) libxslt
#	$(LD) $(LDFLAGS) /DLL /DEF:$(EXSLT_INTDIR)\$(EXSLT_DEF) \
#		/VERSION:$(LIBEXSLT_MAJOR_VERSION).$(LIBEXSLT_MINOR_VERSION) \
#		/IMPLIB:$(BINDIR)\$(EXSLT_IMP) /OUT:$(BINDIR)\$(EXSLT_SO) \
#		$(EXSLT_OBJS) $(XSLT_IMP) $(LIBS) libxml2.lib

# Creates the libexslt archive.
$(BINDIR)\$(EXSLT_A) : $(BINDIR) $(EXSLT_OBJS_A) libxslta
	$(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(EXSLT_A) $(EXSLT_OBJS_A)


# Creates the utils intermediate directory.
$(UTILS_INTDIR) :
	if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR)

# An implicit rule for xsltproc and friends.
APPLIBS = $(LIBS)
!if "$(STATIC)" == "1"
APPLIBS = $(LIBS) libxml2_a.lib
!if "$(WITH_ICONV)" == "1"
APPLIBS = $(APPLIBS) iconv.lib
!endif
!if "$(WITH_ZLIB)" == "1"
APPLIBS = $(APPLIBS) zlib.lib
!endif
{$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
	$(CC) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" \
		$(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< 
	$(LD) $(LDFLAGS) /OUT:$@ $(XSLT_A) $(EXSLT_A) $(APPLIBS) $(UTILS_INTDIR)\$(<B).obj
	@$(_VC_MANIFEST_EMBED_EXE)
!else
APPLIBS = $(LIBS) libxml2.lib
{$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
	$(CC) $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< 
	$(LD) $(LDFLAGS) /OUT:$@ $(XSLT_IMP) $(EXSLT_IMP) $(APPLIBS) $(UTILS_INTDIR)\$(<B).obj
	@$(_VC_MANIFEST_EMBED_EXE)
!endif

# Builds xsltproc and friends. Uses the implicit rule for commands.
$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta

# plugins only work with non-static builds currently.
!if "$(STATIC)" == "0"

TESTPLUGIN_SRCDIR = $(BASEDIR)\tests\plugins
TESTPLUGIN_DIR = $(TESTPLUGIN_SRCDIR)\plugin
TESTPLUGIN_SO = xmlsoft_org_xslt_testplugin.dll
TESTPLUGIN_OBJS = $(TESTPLUGIN_DIR)\testplugin.obj

testplugin: 
	if exist $(TESTPLUGIN_DIR) rmdir /S /Q $(TESTPLUGIN_DIR)
	$(MAKE) $(TESTPLUGIN_DIR)\$(TESTPLUGIN_SO)

$(TESTPLUGIN_DIR) :
	if not exist $(TESTPLUGIN_DIR) mkdir $(TESTPLUGIN_DIR)

{$(TESTPLUGIN_SRCDIR)}.c{$(TESTPLUGIN_DIR)}.obj::
	$(CC) $(CFLAGS) /Fo$(TESTPLUGIN_DIR)\ /c $<

# Creates the testplugin archive.
$(TESTPLUGIN_DIR)\$(TESTPLUGIN_SO) : $(TESTPLUGIN_DIR) $(TESTPLUGIN_OBJS) libxslt
	$(LD) $(LDFLAGS) /DLL $(XSLT_IMP) $(APPLIBS) $(LIBS)\
		/OUT:$(TESTPLUGIN_DIR)\$(TESTPLUGIN_SO) \
		$(TESTPLUGIN_OBJS)

!else

testplugin:
	@echo "plugins are disabled with static=yes" 

!endif


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