1 # Makefile for libxslt, specific for Windows, MSVC and NMAKE.
3 # Take a look at the beginning and modify the variables to suit your
4 # environment. Having done that, you can do a
6 # nmake [all] to build the libxslt and the accompanying utilities.
7 # nmake clean to remove all compiler output files and return to a
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.
13 # March 2002, Igor Zlatkovic <igor@zlatkovic.com>
15 AUTOCONF
= .\config.msvc
18 # There should never be a need to modify anything below this line.
19 # ----------------------------------------------------------------
22 XSLT_SRCDIR
= $(BASEDIR
)\libxslt
23 EXSLT_SRCDIR
= $(BASEDIR
)\libexslt
24 UTILS_SRCDIR
= $(BASEDIR
)\xsltproc
27 # Names of various input and output components.
29 XSLT_BASENAME
= lib
$(XSLT_NAME
)
30 XSLT_SO
= $(XSLT_BASENAME
).dll
31 XSLT_IMP
= $(XSLT_BASENAME
).lib
32 XSLT_DEF
= $(XSLT_BASENAME
).def
33 XSLT_A
= $(XSLT_BASENAME
)_a.lib
35 EXSLT_BASENAME
= lib
$(EXSLT_NAME
)
36 EXSLT_SO
= $(EXSLT_BASENAME
).dll
37 EXSLT_IMP
= $(EXSLT_BASENAME
).lib
38 EXSLT_DEF
= $(EXSLT_BASENAME
).def
39 EXSLT_A
= $(EXSLT_BASENAME
)_a.lib
41 # Places where intermediate files produced by the compiler go
42 XSLT_INTDIR
= int.xslt.msvc
43 XSLT_INTDIR_A
= int.xslta.msvc
44 EXSLT_INTDIR
= int.exslt.msvc
45 EXSLT_INTDIR_A
= int.exslta.msvc
46 UTILS_INTDIR
= int.utils.msvc
48 # The preprocessor and its options.
52 # The compiler and its options.
54 CFLAGS
= /nologo
/D
"WIN32" /D
"_WINDOWS" /D
"_MBCS" /W3
$(CRUNTIME
) /D
"_REENTRANT"
55 CFLAGS
= $(CFLAGS
) /I
$(BASEDIR
) /I
$(XSLT_SRCDIR
) /I
$(INCPREFIX
)
57 # The linker and its options.
60 LDFLAGS
= $(LDFLAGS
) /LIBPATH
:$(BINDIR
) /LIBPATH
:$(LIBPREFIX
)
63 # The archiver and its options.
67 # Optimisation and debug symbols.
69 CFLAGS
= $(CFLAGS
) /D
"_DEBUG" /Od
/Z7
70 LDFLAGS
= $(LDFLAGS
) /DEBUG
72 CFLAGS
= $(CFLAGS
) /D
"NDEBUG" /O2
73 LDFLAGS
= $(LDFLAGS
) /OPT
:NOWIN98
76 # Libxslt object files.
77 XSLT_OBJS
= $(XSLT_INTDIR
)\attributes.obj\
78 $(XSLT_INTDIR
)\documents.obj\
79 $(XSLT_INTDIR
)\extensions.obj\
80 $(XSLT_INTDIR
)\extra.obj\
81 $(XSLT_INTDIR
)\functions.obj\
82 $(XSLT_INTDIR
)\imports.obj\
83 $(XSLT_INTDIR
)\keys.obj\
84 $(XSLT_INTDIR
)\namespaces.obj\
85 $(XSLT_INTDIR
)\numbers.obj\
86 $(XSLT_INTDIR
)\pattern.obj\
87 $(XSLT_INTDIR
)\preproc.obj\
88 $(XSLT_INTDIR
)\security.obj\
89 $(XSLT_INTDIR
)\templates.obj\
90 $(XSLT_INTDIR
)\transform.obj\
91 $(XSLT_INTDIR
)\variables.obj\
92 $(XSLT_INTDIR
)\xslt.obj\
93 $(XSLT_INTDIR
)\xsltutils.obj\
94 $(XSLT_INTDIR
)\attrvt.obj
96 # Static libxslt object files.
97 XSLT_OBJS_A
= $(XSLT_INTDIR_A
)\attributes.obj\
98 $(XSLT_INTDIR_A
)\documents.obj\
99 $(XSLT_INTDIR_A
)\extensions.obj\
100 $(XSLT_INTDIR_A
)\extra.obj\
101 $(XSLT_INTDIR_A
)\functions.obj\
102 $(XSLT_INTDIR_A
)\imports.obj\
103 $(XSLT_INTDIR_A
)\keys.obj\
104 $(XSLT_INTDIR_A
)\namespaces.obj\
105 $(XSLT_INTDIR_A
)\numbers.obj\
106 $(XSLT_INTDIR_A
)\pattern.obj\
107 $(XSLT_INTDIR_A
)\preproc.obj\
108 $(XSLT_INTDIR_A
)\security.obj\
109 $(XSLT_INTDIR_A
)\templates.obj\
110 $(XSLT_INTDIR_A
)\transform.obj\
111 $(XSLT_INTDIR_A
)\variables.obj\
112 $(XSLT_INTDIR_A
)\xslt.obj\
113 $(XSLT_INTDIR_A
)\xsltutils.obj\
114 $(XSLT_INTDIR_A
)\attrvt.obj
116 # Libexslt object files.
117 EXSLT_OBJS
= $(EXSLT_INTDIR
)\common.obj\
118 $(EXSLT_INTDIR
)\crypto.obj\
119 $(EXSLT_INTDIR
)\date.obj\
120 $(EXSLT_INTDIR
)\exslt.obj\
121 $(EXSLT_INTDIR
)\functions.obj\
122 $(EXSLT_INTDIR
)\math.obj\
123 $(EXSLT_INTDIR
)\saxon.obj\
124 $(EXSLT_INTDIR
)\sets.obj\
125 $(EXSLT_INTDIR
)\strings.obj\
126 $(EXSLT_INTDIR
)\dynamic.obj
128 # Static libexslt object files.
129 EXSLT_OBJS_A
= $(EXSLT_INTDIR_A
)\common.obj\
130 $(EXSLT_INTDIR_A
)\crypto.obj\
131 $(EXSLT_INTDIR_A
)\date.obj\
132 $(EXSLT_INTDIR_A
)\exslt.obj\
133 $(EXSLT_INTDIR_A
)\functions.obj\
134 $(EXSLT_INTDIR_A
)\math.obj\
135 $(EXSLT_INTDIR_A
)\saxon.obj\
136 $(EXSLT_INTDIR_A
)\sets.obj\
137 $(EXSLT_INTDIR_A
)\strings.obj\
138 $(EXSLT_INTDIR_A
)\dynamic.obj
141 # Xsltproc and friends executables.
142 UTILS
= $(BINDIR
)\xsltproc.exe
144 !if
"$(VCMANIFEST)" == "1"
145 _VC_MANIFEST_EMBED_EXE
= if exist
$@.manifest mt.exe
-nologo
-manifest
$@.manifest
-outputresource
:$@
;1
146 _VC_MANIFEST_EMBED_DLL
= if exist
$@.manifest mt.exe
-nologo
-manifest
$@.manifest
-outputresource
:$@
;2
148 _VC_MANIFEST_EMBED_EXE
=
149 _VC_MANIFEST_EMBED_DLL
=
152 all : libxslt libxslta libexslt libexslta utils
154 libxslt
: $(BINDIR
)\
$(XSLT_SO
)
156 libxslta
: $(BINDIR
)\
$(XSLT_A
)
158 libexslt
: $(BINDIR
)\
$(EXSLT_SO
)
160 libexslta
: $(BINDIR
)\
$(EXSLT_A
)
165 if exist
$(XSLT_INTDIR
) rmdir
/S
/Q
$(XSLT_INTDIR
)
166 if exist
$(XSLT_INTDIR_A
) rmdir
/S
/Q
$(XSLT_INTDIR_A
)
167 if exist
$(EXSLT_INTDIR
) rmdir
/S
/Q
$(EXSLT_INTDIR
)
168 if exist
$(EXSLT_INTDIR_A
) rmdir
/S
/Q
$(EXSLT_INTDIR_A
)
169 if exist
$(UTILS_INTDIR
) rmdir
/S
/Q
$(UTILS_INTDIR
)
170 if exist
$(BINDIR
) rmdir
/S
/Q
$(BINDIR
)
175 if exist config.
* del config.
*
176 if exist Makefile del Makefile
179 if not exist
$(INCPREFIX
)\
$(XSLT_BASENAME
) mkdir
$(INCPREFIX
)\
$(XSLT_BASENAME
)
180 if not exist
$(INCPREFIX
)\
$(EXSLT_BASENAME
) mkdir
$(INCPREFIX
)\
$(EXSLT_BASENAME
)
181 if not exist
$(BINPREFIX
) mkdir
$(BINPREFIX
)
182 if not exist
$(LIBPREFIX
) mkdir
$(LIBPREFIX
)
183 copy
$(XSLT_SRCDIR
)\
*.h
$(INCPREFIX
)\
$(XSLT_BASENAME
)
184 copy
$(EXSLT_SRCDIR
)\
*.h
$(INCPREFIX
)\
$(EXSLT_BASENAME
)
185 copy
$(BINDIR
)\
$(XSLT_SO
) $(SOPREFIX
)
186 copy
$(BINDIR
)\
$(XSLT_A
) $(LIBPREFIX
)
187 copy
$(BINDIR
)\
$(XSLT_IMP
) $(LIBPREFIX
)
188 copy
$(BINDIR
)\
$(EXSLT_SO
) $(SOPREFIX
)
189 copy
$(BINDIR
)\
$(EXSLT_A
) $(LIBPREFIX
)
190 copy
$(BINDIR
)\
$(EXSLT_IMP
) $(LIBPREFIX
)
192 install : install-libs
193 copy
$(BINDIR
)\
*.exe
$(BINPREFIX
)
194 -copy
$(BINDIR
)\
*.pdb
$(BINPREFIX
)
196 install-dist
: install
198 # This is a target for me, to make a binary distribution. Not for the public use,
199 # keep your hands off :-)
200 BDVERSION
= $(LIBXSLT_MAJOR_VERSION
).
$(LIBXSLT_MINOR_VERSION
).
$(LIBXSLT_MICRO_VERSION
)
201 BDPREFIX
= $(XSLT_BASENAME
)-$(BDVERSION
).win32
203 $(MAKE
) /nologo PREFIX
=$(BDPREFIX
) SOPREFIX
=$(BDPREFIX
)\bin install-dist
204 cscript
//NoLogo configure.js genreadme
$(XSLT_BASENAME
) $(BDVERSION
) $(BDPREFIX
)\readme.txt
206 # Makes the compiler output directory.
208 if not exist
$(BINDIR
) mkdir
$(BINDIR
)
211 # Makes the libxslt intermediate directory.
213 if not exist
$(XSLT_INTDIR
) mkdir
$(XSLT_INTDIR
)
215 # Makes the static libxslt intermediate directory.
217 if not exist
$(XSLT_INTDIR_A
) mkdir
$(XSLT_INTDIR_A
)
219 # An implicit rule for libxslt compilation.
220 {$(XSLT_SRCDIR
)}.c
{$(XSLT_INTDIR
)}.obj
::
221 $(CC
) $(CFLAGS
) /Fo
$(XSLT_INTDIR
)\
/c
$<
223 # An implicit rule for static libxslt compilation.
224 {$(XSLT_SRCDIR
)}.c
{$(XSLT_INTDIR_A
)}.obj
::
225 $(CC
) $(CFLAGS
) /D
"LIBXML_STATIC" /D
"LIBXSLT_STATIC" \
226 /Fo
$(XSLT_INTDIR_A
)\
/c
$<
228 # Compiles libxslt source. Uses the implicit rule for commands.
229 $(XSLT_OBJS
) : $(XSLT_INTDIR
)
231 # Compiles static libxslt source. Uses the implicit rule for commands.
232 $(XSLT_OBJS_A
) : $(XSLT_INTDIR_A
)
234 # Creates the export definition file (DEF) for libxslt.
235 $(XSLT_INTDIR
)\
$(XSLT_DEF
) : $(XSLT_INTDIR
) $(XSLT_DEF
).src
236 $(CPP
) $(CPPFLAGS
) $(XSLT_DEF
).src
> $(XSLT_INTDIR
)\
$(XSLT_DEF
)
238 # Creates the libxslt shared object.
239 $(BINDIR
)\
$(XSLT_SO
) : $(BINDIR
) $(XSLT_OBJS
) $(XSLT_INTDIR
)\
$(XSLT_DEF
)
240 $(LD
) $(LDFLAGS
) /DLL \
241 /VERSION
:$(LIBXSLT_MAJOR_VERSION
).
$(LIBXSLT_MINOR_VERSION
) \
242 /IMPLIB
:$(BINDIR
)\
$(XSLT_IMP
) /OUT
:$(BINDIR
)\
$(XSLT_SO
) \
243 $(XSLT_OBJS
) $(LIBS
) libxml2.lib
244 @
$(_VC_MANIFEST_EMBED_DLL
)
246 #$(BINDIR)\$(XSLT_SO) : $(BINDIR) $(XSLT_OBJS) $(XSLT_INTDIR)\$(XSLT_DEF)
247 # $(LD) $(LDFLAGS) /DLL /DEF:$(XSLT_INTDIR)\$(XSLT_DEF) \
248 # /VERSION:$(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION) \
249 # /IMPLIB:$(BINDIR)\$(XSLT_IMP) /OUT:$(BINDIR)\$(XSLT_SO) \
250 # $(XSLT_OBJS) $(LIBS) libxml2.lib
252 # Creates the libxslt archive.
253 $(BINDIR
)\
$(XSLT_A
) : $(BINDIR
) $(XSLT_OBJS_A
)
254 $(AR
) $(ARFLAGS
) /OUT
:$(BINDIR
)\
$(XSLT_A
) $(XSLT_OBJS_A
)
257 # Creates the libexslt intermediate directory.
259 if not exist
$(EXSLT_INTDIR
) mkdir
$(EXSLT_INTDIR
)
261 # Creates the static libexslt intermediate directory.
263 if not exist
$(EXSLT_INTDIR_A
) mkdir
$(EXSLT_INTDIR_A
)
265 # An implicit rule for libexslt compilation.
266 {$(EXSLT_SRCDIR
)}.c
{$(EXSLT_INTDIR
)}.obj
::
267 $(CC
) /I
$(EXSLT_SRCDIR
) $(CFLAGS
) /Fo
$(EXSLT_INTDIR
)\
/c
$<
269 # An implicit rule for static libexslt compilation.
270 {$(EXSLT_SRCDIR
)}.c
{$(EXSLT_INTDIR_A
)}.obj
::
271 $(CC
) /D
"LIBXML_STATIC" /D
"LIBXSLT_STATIC" /D
"LIBEXSLT_STATIC" \
272 /I
$(EXSLT_SRCDIR
) $(CFLAGS
) /Fo
$(EXSLT_INTDIR_A
)\
/c
$<
274 # Compiles libxslt source. Uses the implicit rule for commands.
275 $(EXSLT_OBJS
) : $(EXSLT_INTDIR
)
277 # Compiles libxslt source. Uses the implicit rule for commands.
278 $(EXSLT_OBJS_A
) : $(EXSLT_INTDIR_A
)
280 # Creates the export definition file (DEF) for libxslt.
281 $(EXSLT_INTDIR
)\
$(EXSLT_DEF
) : $(EXSLT_INTDIR
) $(EXSLT_DEF
).src
282 $(CPP
) $(CPPFLAGS
) $(EXSLT_DEF
).src
> $(EXSLT_INTDIR
)\
$(EXSLT_DEF
)
284 # Creates the libexslt shared object.
285 $(BINDIR
)\
$(EXSLT_SO
) : $(BINDIR
) $(EXSLT_OBJS
) $(EXSLT_INTDIR
)\
$(EXSLT_DEF
) libxslt
286 $(LD
) $(LDFLAGS
) /DLL \
287 /VERSION
:$(LIBEXSLT_MAJOR_VERSION
).
$(LIBEXSLT_MINOR_VERSION
) \
288 /IMPLIB
:$(BINDIR
)\
$(EXSLT_IMP
) /OUT
:$(BINDIR
)\
$(EXSLT_SO
) \
289 $(EXSLT_OBJS
) $(XSLT_IMP
) $(LIBS
) libxml2.lib
290 @
$(_VC_MANIFEST_EMBED_DLL
)
292 #$(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) $(EXSLT_INTDIR)\$(EXSLT_DEF) libxslt
293 # $(LD) $(LDFLAGS) /DLL /DEF:$(EXSLT_INTDIR)\$(EXSLT_DEF) \
294 # /VERSION:$(LIBEXSLT_MAJOR_VERSION).$(LIBEXSLT_MINOR_VERSION) \
295 # /IMPLIB:$(BINDIR)\$(EXSLT_IMP) /OUT:$(BINDIR)\$(EXSLT_SO) \
296 # $(EXSLT_OBJS) $(XSLT_IMP) $(LIBS) libxml2.lib
298 # Creates the libexslt archive.
299 $(BINDIR
)\
$(EXSLT_A
) : $(BINDIR
) $(EXSLT_OBJS_A
) libxslta
300 $(AR
) $(ARFLAGS
) /OUT
:$(BINDIR
)\
$(EXSLT_A
) $(EXSLT_OBJS_A
)
303 # Creates the utils intermediate directory.
305 if not exist
$(UTILS_INTDIR
) mkdir
$(UTILS_INTDIR
)
307 # An implicit rule for xsltproc and friends.
309 !if
"$(STATIC)" == "1"
310 APPLIBS
= $(LIBS
) libxml2_a.lib
311 !if
"$(WITH_ICONV)" == "1"
312 APPLIBS
= $(APPLIBS
) iconv.lib
314 !if
"$(WITH_ZLIB)" == "1"
315 APPLIBS
= $(APPLIBS
) zlib.lib
317 {$(UTILS_SRCDIR
)}.c
{$(BINDIR
)}.exe
:
318 $(CC
) /D
"LIBXML_STATIC" /D
"LIBXSLT_STATIC" /D
"LIBEXSLT_STATIC" \
319 $(CFLAGS
) /Fo
$(UTILS_INTDIR
)\
/c
$<
320 $(LD
) $(LDFLAGS
) /OUT
:$@
$(XSLT_A
) $(EXSLT_A
) $(APPLIBS
) $(UTILS_INTDIR
)\
$(<B
).obj
321 @
$(_VC_MANIFEST_EMBED_EXE
)
323 APPLIBS
= $(LIBS
) libxml2.lib
324 {$(UTILS_SRCDIR
)}.c
{$(BINDIR
)}.exe
:
325 $(CC
) $(CFLAGS
) /Fo
$(UTILS_INTDIR
)\
/c
$<
326 $(LD
) $(LDFLAGS
) /OUT
:$@
$(XSLT_IMP
) $(EXSLT_IMP
) $(APPLIBS
) $(UTILS_INTDIR
)\
$(<B
).obj
327 @
$(_VC_MANIFEST_EMBED_EXE
)
330 # Builds xsltproc and friends. Uses the implicit rule for commands.
331 $(UTILS
) : $(UTILS_INTDIR
) $(BINDIR
) libxslt libxslta libexslt libexslta
333 # plugins only work with non-static builds currently.
334 !if
"$(STATIC)" == "0"
336 TESTPLUGIN_SRCDIR
= $(BASEDIR
)\tests\plugins
337 TESTPLUGIN_DIR
= $(TESTPLUGIN_SRCDIR
)\plugin
338 TESTPLUGIN_SO
= xmlsoft_org_xslt_testplugin.dll
339 TESTPLUGIN_OBJS
= $(TESTPLUGIN_DIR
)\testplugin.obj
342 if exist
$(TESTPLUGIN_DIR
) rmdir
/S
/Q
$(TESTPLUGIN_DIR
)
343 $(MAKE
) $(TESTPLUGIN_DIR
)\
$(TESTPLUGIN_SO
)
346 if not exist
$(TESTPLUGIN_DIR
) mkdir
$(TESTPLUGIN_DIR
)
348 {$(TESTPLUGIN_SRCDIR
)}.c
{$(TESTPLUGIN_DIR
)}.obj
::
349 $(CC
) $(CFLAGS
) /Fo
$(TESTPLUGIN_DIR
)\
/c
$<
351 # Creates the testplugin archive.
352 $(TESTPLUGIN_DIR
)\
$(TESTPLUGIN_SO
) : $(TESTPLUGIN_DIR
) $(TESTPLUGIN_OBJS
) libxslt
353 $(LD
) $(LDFLAGS
) /DLL
$(XSLT_IMP
) $(APPLIBS
) $(LIBS
)\
354 /OUT
:$(TESTPLUGIN_DIR
)\
$(TESTPLUGIN_SO
) \
360 @echo
"plugins are disabled with static=yes"
365 # Source dependences should be autogenerated somehow here, but how to
366 # do it? I have no clue.