1# Makefile for libxslt, specific for Windows, MSVC and NMAKE. 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 libxslt 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# March 2002, Igor Zlatkovic <igor@zlatkovic.com> 14 15AUTOCONF = .\config.msvc 16!include $(AUTOCONF) 17 18# There should never be a need to modify anything below this line. 19# ---------------------------------------------------------------- 20 21BASEDIR = .. 22XSLT_SRCDIR = $(BASEDIR)\libxslt 23EXSLT_SRCDIR = $(BASEDIR)\libexslt 24UTILS_SRCDIR = $(BASEDIR)\xsltproc 25BINDIR = bin.msvc 26 27# Names of various input and output components. 28XSLT_NAME = xslt 29XSLT_BASENAME = lib$(XSLT_NAME) 30XSLT_SO = $(XSLT_BASENAME).dll 31XSLT_IMP = $(XSLT_BASENAME).lib 32XSLT_DEF = $(XSLT_BASENAME).def 33XSLT_A = $(XSLT_BASENAME)_a.lib 34EXSLT_NAME = exslt 35EXSLT_BASENAME = lib$(EXSLT_NAME) 36EXSLT_SO = $(EXSLT_BASENAME).dll 37EXSLT_IMP = $(EXSLT_BASENAME).lib 38EXSLT_DEF = $(EXSLT_BASENAME).def 39EXSLT_A = $(EXSLT_BASENAME)_a.lib 40 41# Places where intermediate files produced by the compiler go 42XSLT_INTDIR = int.xslt.msvc 43XSLT_INTDIR_A = int.xslta.msvc 44EXSLT_INTDIR = int.exslt.msvc 45EXSLT_INTDIR_A = int.exslta.msvc 46UTILS_INTDIR = int.utils.msvc 47 48# The preprocessor and its options. 49CPP = cl.exe /EP 50CPPFLAGS = /nologo 51 52# The compiler and its options. 53CC = cl.exe 54CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 $(CRUNTIME) /D "_REENTRANT" 55CFLAGS = $(CFLAGS) /I$(BASEDIR) /I$(XSLT_SRCDIR) /I$(INCPREFIX) 56 57# The linker and its options. 58LD = link.exe 59LDFLAGS = /nologo 60LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX) 61LIBS = wsock32.lib 62 63# The archiver and its options. 64AR = lib.exe 65ARFLAGS = /nologo 66 67# Optimisation and debug symbols. 68!if "$(DEBUG)" == "1" 69CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 70LDFLAGS = $(LDFLAGS) /DEBUG 71!else 72CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 73LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 74!endif 75 76# Libxslt object files. 77XSLT_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 95 96# Static libxslt object files. 97XSLT_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 115 116# Libexslt object files. 117EXSLT_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 127 128# Static libexslt object files. 129EXSLT_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 139 140 141# Xsltproc and friends executables. 142UTILS = $(BINDIR)\xsltproc.exe 143 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 147!else 148_VC_MANIFEST_EMBED_EXE= 149_VC_MANIFEST_EMBED_DLL= 150!endif 151 152all : libxslt libxslta libexslt libexslta utils 153 154libxslt : $(BINDIR)\$(XSLT_SO) 155 156libxslta : $(BINDIR)\$(XSLT_A) 157 158libexslt : $(BINDIR)\$(EXSLT_SO) 159 160libexslta : $(BINDIR)\$(EXSLT_A) 161 162utils : $(UTILS) 163 164clean : 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) 171 172rebuild : clean all 173 174distclean : clean 175 if exist config.* del config.* 176 if exist Makefile del Makefile 177 178install-libs : all 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) 191 192install : install-libs 193 copy $(BINDIR)\*.exe $(BINPREFIX) 194 -copy $(BINDIR)\*.pdb $(BINPREFIX) 195 196install-dist : install 197 198# This is a target for me, to make a binary distribution. Not for the public use, 199# keep your hands off :-) 200BDVERSION = $(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION).$(LIBXSLT_MICRO_VERSION) 201BDPREFIX = $(XSLT_BASENAME)-$(BDVERSION).win32 202bindist : all 203 $(MAKE) /nologo PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)\bin install-dist 204 cscript //NoLogo configure.js genreadme $(XSLT_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt 205 206# Makes the compiler output directory. 207$(BINDIR) : 208 if not exist $(BINDIR) mkdir $(BINDIR) 209 210 211# Makes the libxslt intermediate directory. 212$(XSLT_INTDIR) : 213 if not exist $(XSLT_INTDIR) mkdir $(XSLT_INTDIR) 214 215# Makes the static libxslt intermediate directory. 216$(XSLT_INTDIR_A) : 217 if not exist $(XSLT_INTDIR_A) mkdir $(XSLT_INTDIR_A) 218 219# An implicit rule for libxslt compilation. 220{$(XSLT_SRCDIR)}.c{$(XSLT_INTDIR)}.obj:: 221 $(CC) $(CFLAGS) /Fo$(XSLT_INTDIR)\ /c $< 222 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 $< 227 228# Compiles libxslt source. Uses the implicit rule for commands. 229$(XSLT_OBJS) : $(XSLT_INTDIR) 230 231# Compiles static libxslt source. Uses the implicit rule for commands. 232$(XSLT_OBJS_A) : $(XSLT_INTDIR_A) 233 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) 237 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) 245 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 251 252# Creates the libxslt archive. 253$(BINDIR)\$(XSLT_A) : $(BINDIR) $(XSLT_OBJS_A) 254 $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XSLT_A) $(XSLT_OBJS_A) 255 256 257# Creates the libexslt intermediate directory. 258$(EXSLT_INTDIR) : 259 if not exist $(EXSLT_INTDIR) mkdir $(EXSLT_INTDIR) 260 261# Creates the static libexslt intermediate directory. 262$(EXSLT_INTDIR_A) : 263 if not exist $(EXSLT_INTDIR_A) mkdir $(EXSLT_INTDIR_A) 264 265# An implicit rule for libexslt compilation. 266{$(EXSLT_SRCDIR)}.c{$(EXSLT_INTDIR)}.obj:: 267 $(CC) /I$(EXSLT_SRCDIR) $(CFLAGS) /Fo$(EXSLT_INTDIR)\ /c $< 268 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 $< 273 274# Compiles libxslt source. Uses the implicit rule for commands. 275$(EXSLT_OBJS) : $(EXSLT_INTDIR) 276 277# Compiles libxslt source. Uses the implicit rule for commands. 278$(EXSLT_OBJS_A) : $(EXSLT_INTDIR_A) 279 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) 283 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) 291 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 297 298# Creates the libexslt archive. 299$(BINDIR)\$(EXSLT_A) : $(BINDIR) $(EXSLT_OBJS_A) libxslta 300 $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(EXSLT_A) $(EXSLT_OBJS_A) 301 302 303# Creates the utils intermediate directory. 304$(UTILS_INTDIR) : 305 if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) 306 307# An implicit rule for xsltproc and friends. 308APPLIBS = $(LIBS) 309!if "$(STATIC)" == "1" 310APPLIBS = $(LIBS) libxml2_a.lib 311!if "$(WITH_ICONV)" == "1" 312APPLIBS = $(APPLIBS) iconv.lib 313!endif 314!if "$(WITH_ZLIB)" == "1" 315APPLIBS = $(APPLIBS) zlib.lib 316!endif 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) 322!else 323APPLIBS = $(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) 328!endif 329 330# Builds xsltproc and friends. Uses the implicit rule for commands. 331$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta 332 333# plugins only work with non-static builds currently. 334!if "$(STATIC)" == "0" 335 336TESTPLUGIN_SRCDIR = $(BASEDIR)\tests\plugins 337TESTPLUGIN_DIR = $(TESTPLUGIN_SRCDIR)\plugin 338TESTPLUGIN_SO = xmlsoft_org_xslt_testplugin.dll 339TESTPLUGIN_OBJS = $(TESTPLUGIN_DIR)\testplugin.obj 340 341testplugin: 342 if exist $(TESTPLUGIN_DIR) rmdir /S /Q $(TESTPLUGIN_DIR) 343 $(MAKE) $(TESTPLUGIN_DIR)\$(TESTPLUGIN_SO) 344 345$(TESTPLUGIN_DIR) : 346 if not exist $(TESTPLUGIN_DIR) mkdir $(TESTPLUGIN_DIR) 347 348{$(TESTPLUGIN_SRCDIR)}.c{$(TESTPLUGIN_DIR)}.obj:: 349 $(CC) $(CFLAGS) /Fo$(TESTPLUGIN_DIR)\ /c $< 350 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) \ 355 $(TESTPLUGIN_OBJS) 356 357!else 358 359testplugin: 360 @echo "plugins are disabled with static=yes" 361 362!endif 363 364 365# Source dependences should be autogenerated somehow here, but how to 366# do it? I have no clue. 367 368