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 | |
---|
15 | AUTOCONF = .\config.msvc |
---|
16 | !include $(AUTOCONF) |
---|
17 | |
---|
18 | # There should never be a need to modify anything below this line. |
---|
19 | # ---------------------------------------------------------------- |
---|
20 | |
---|
21 | BASEDIR = .. |
---|
22 | XSLT_SRCDIR = $(BASEDIR)\libxslt |
---|
23 | EXSLT_SRCDIR = $(BASEDIR)\libexslt |
---|
24 | UTILS_SRCDIR = $(BASEDIR)\xsltproc |
---|
25 | BINDIR = bin.msvc |
---|
26 | |
---|
27 | # Names of various input and output components. |
---|
28 | XSLT_NAME = xslt |
---|
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 |
---|
34 | EXSLT_NAME = exslt |
---|
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 |
---|
40 | |
---|
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 |
---|
47 | |
---|
48 | # The preprocessor and its options. |
---|
49 | CPP = cl.exe /EP |
---|
50 | CPPFLAGS = /nologo |
---|
51 | |
---|
52 | # The compiler and its options. |
---|
53 | CC = cl.exe |
---|
54 | CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 $(CRUNTIME) /D "_REENTRANT" |
---|
55 | CFLAGS = $(CFLAGS) /I$(BASEDIR) /I$(XSLT_SRCDIR) /I$(INCPREFIX) |
---|
56 | |
---|
57 | # The linker and its options. |
---|
58 | LD = link.exe |
---|
59 | LDFLAGS = /nologo |
---|
60 | LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX) |
---|
61 | LIBS = wsock32.lib |
---|
62 | |
---|
63 | # The archiver and its options. |
---|
64 | AR = lib.exe |
---|
65 | ARFLAGS = /nologo |
---|
66 | |
---|
67 | # Optimisation and debug symbols. |
---|
68 | !if "$(DEBUG)" == "1" |
---|
69 | CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 |
---|
70 | LDFLAGS = $(LDFLAGS) /DEBUG |
---|
71 | !else |
---|
72 | CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 |
---|
73 | LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 |
---|
74 | !endif |
---|
75 | |
---|
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 |
---|
95 | |
---|
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 |
---|
115 | |
---|
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 |
---|
127 | |
---|
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 |
---|
139 | |
---|
140 | |
---|
141 | # Xsltproc and friends executables. |
---|
142 | UTILS = $(BINDIR)\xsltproc.exe |
---|
143 | |
---|
144 | all : libxslt libxslta libexslt libexslta utils |
---|
145 | |
---|
146 | libxslt : $(BINDIR)\$(XSLT_SO) |
---|
147 | |
---|
148 | libxslta : $(BINDIR)\$(XSLT_A) |
---|
149 | |
---|
150 | libexslt : $(BINDIR)\$(EXSLT_SO) |
---|
151 | |
---|
152 | libexslta : $(BINDIR)\$(EXSLT_A) |
---|
153 | |
---|
154 | utils : $(UTILS) |
---|
155 | |
---|
156 | clean : |
---|
157 | if exist $(XSLT_INTDIR) rmdir /S /Q $(XSLT_INTDIR) |
---|
158 | if exist $(XSLT_INTDIR_A) rmdir /S /Q $(XSLT_INTDIR_A) |
---|
159 | if exist $(EXSLT_INTDIR) rmdir /S /Q $(EXSLT_INTDIR) |
---|
160 | if exist $(EXSLT_INTDIR_A) rmdir /S /Q $(EXSLT_INTDIR_A) |
---|
161 | if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) |
---|
162 | if exist $(BINDIR) rmdir /S /Q $(BINDIR) |
---|
163 | |
---|
164 | rebuild : clean all |
---|
165 | |
---|
166 | distclean : clean |
---|
167 | if exist config.* del config.* |
---|
168 | if exist Makefile del Makefile |
---|
169 | |
---|
170 | install : all |
---|
171 | if not exist $(INCPREFIX)\$(XSLT_BASENAME) mkdir $(INCPREFIX)\$(XSLT_BASENAME) |
---|
172 | if not exist $(INCPREFIX)\$(EXSLT_BASENAME) mkdir $(INCPREFIX)\$(EXSLT_BASENAME) |
---|
173 | if not exist $(BINPREFIX) mkdir $(BINPREFIX) |
---|
174 | if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) |
---|
175 | copy $(XSLT_SRCDIR)\*.h $(INCPREFIX)\$(XSLT_BASENAME) |
---|
176 | copy $(EXSLT_SRCDIR)\*.h $(INCPREFIX)\$(EXSLT_BASENAME) |
---|
177 | copy $(BINDIR)\$(XSLT_SO) $(SOPREFIX) |
---|
178 | copy $(BINDIR)\$(XSLT_A) $(LIBPREFIX) |
---|
179 | copy $(BINDIR)\$(XSLT_IMP) $(LIBPREFIX) |
---|
180 | copy $(BINDIR)\$(EXSLT_SO) $(SOPREFIX) |
---|
181 | copy $(BINDIR)\$(EXSLT_A) $(LIBPREFIX) |
---|
182 | copy $(BINDIR)\$(EXSLT_IMP) $(LIBPREFIX) |
---|
183 | copy $(BINDIR)\*.exe $(BINPREFIX) |
---|
184 | -copy $(BINDIR)\*.pdb $(BINPREFIX) |
---|
185 | |
---|
186 | install-bindist : all |
---|
187 | if not exist $(INCPREFIX)\$(XSLT_BASENAME) mkdir $(INCPREFIX)\$(XSLT_BASENAME) |
---|
188 | if not exist $(INCPREFIX)\$(EXSLT_BASENAME) mkdir $(INCPREFIX)\$(EXSLT_BASENAME) |
---|
189 | if not exist $(BINPREFIX) mkdir $(BINPREFIX) |
---|
190 | if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) |
---|
191 | copy $(XSLT_SRCDIR)\*.h $(INCPREFIX)\$(XSLT_BASENAME) |
---|
192 | copy $(EXSLT_SRCDIR)\*.h $(INCPREFIX)\$(EXSLT_BASENAME) |
---|
193 | copy $(BINDIR)\$(XSLT_SO) $(SOPREFIX) |
---|
194 | copy $(BINDIR)\$(XSLT_A) $(LIBPREFIX) |
---|
195 | copy $(BINDIR)\$(XSLT_IMP) $(LIBPREFIX) |
---|
196 | copy $(BINDIR)\$(EXSLT_SO) $(SOPREFIX) |
---|
197 | copy $(BINDIR)\$(EXSLT_A) $(LIBPREFIX) |
---|
198 | copy $(BINDIR)\$(EXSLT_IMP) $(LIBPREFIX) |
---|
199 | copy $(BINDIR)\*.exe $(BINPREFIX) |
---|
200 | |
---|
201 | # This is a target for me, to make a binary distribution. Not for the public use, |
---|
202 | # keep your hands off :-) |
---|
203 | BDVERSION = $(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION).$(LIBXSLT_MICRO_VERSION) |
---|
204 | BDPREFIX = $(XSLT_BASENAME)-$(BDVERSION).win32 |
---|
205 | bindist : all |
---|
206 | $(MAKE) /nologo PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)\bin install-bindist |
---|
207 | cscript //NoLogo configure.js genreadme $(XSLT_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt |
---|
208 | |
---|
209 | # Makes the compiler output directory. |
---|
210 | $(BINDIR) : |
---|
211 | if not exist $(BINDIR) mkdir $(BINDIR) |
---|
212 | |
---|
213 | |
---|
214 | # Makes the libxslt intermediate directory. |
---|
215 | $(XSLT_INTDIR) : |
---|
216 | if not exist $(XSLT_INTDIR) mkdir $(XSLT_INTDIR) |
---|
217 | |
---|
218 | # Makes the static libxslt intermediate directory. |
---|
219 | $(XSLT_INTDIR_A) : |
---|
220 | if not exist $(XSLT_INTDIR_A) mkdir $(XSLT_INTDIR_A) |
---|
221 | |
---|
222 | # An implicit rule for libxslt compilation. |
---|
223 | {$(XSLT_SRCDIR)}.c{$(XSLT_INTDIR)}.obj:: |
---|
224 | $(CC) $(CFLAGS) /Fo$(XSLT_INTDIR)\ /c $< |
---|
225 | |
---|
226 | # An implicit rule for static libxslt compilation. |
---|
227 | {$(XSLT_SRCDIR)}.c{$(XSLT_INTDIR_A)}.obj:: |
---|
228 | $(CC) $(CFLAGS) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" \ |
---|
229 | /Fo$(XSLT_INTDIR_A)\ /c $< |
---|
230 | |
---|
231 | # Compiles libxslt source. Uses the implicit rule for commands. |
---|
232 | $(XSLT_OBJS) : $(XSLT_INTDIR) |
---|
233 | |
---|
234 | # Compiles static libxslt source. Uses the implicit rule for commands. |
---|
235 | $(XSLT_OBJS_A) : $(XSLT_INTDIR_A) |
---|
236 | |
---|
237 | # Creates the export definition file (DEF) for libxslt. |
---|
238 | $(XSLT_INTDIR)\$(XSLT_DEF) : $(XSLT_INTDIR) $(XSLT_DEF).src |
---|
239 | $(CPP) $(CPPFLAGS) $(XSLT_DEF).src > $(XSLT_INTDIR)\$(XSLT_DEF) |
---|
240 | |
---|
241 | # Creates the libxslt shared object. |
---|
242 | $(BINDIR)\$(XSLT_SO) : $(BINDIR) $(XSLT_OBJS) $(XSLT_INTDIR)\$(XSLT_DEF) |
---|
243 | $(LD) $(LDFLAGS) /DLL \ |
---|
244 | /VERSION:$(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION) \ |
---|
245 | /IMPLIB:$(BINDIR)\$(XSLT_IMP) /OUT:$(BINDIR)\$(XSLT_SO) \ |
---|
246 | $(XSLT_OBJS) $(LIBS) libxml2.lib |
---|
247 | |
---|
248 | #$(BINDIR)\$(XSLT_SO) : $(BINDIR) $(XSLT_OBJS) $(XSLT_INTDIR)\$(XSLT_DEF) |
---|
249 | # $(LD) $(LDFLAGS) /DLL /DEF:$(XSLT_INTDIR)\$(XSLT_DEF) \ |
---|
250 | # /VERSION:$(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION) \ |
---|
251 | # /IMPLIB:$(BINDIR)\$(XSLT_IMP) /OUT:$(BINDIR)\$(XSLT_SO) \ |
---|
252 | # $(XSLT_OBJS) $(LIBS) libxml2.lib |
---|
253 | |
---|
254 | # Creates the libxslt archive. |
---|
255 | $(BINDIR)\$(XSLT_A) : $(BINDIR) $(XSLT_OBJS_A) |
---|
256 | $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XSLT_A) $(XSLT_OBJS_A) |
---|
257 | |
---|
258 | |
---|
259 | # Creates the libexslt intermediate directory. |
---|
260 | $(EXSLT_INTDIR) : |
---|
261 | if not exist $(EXSLT_INTDIR) mkdir $(EXSLT_INTDIR) |
---|
262 | |
---|
263 | # Creates the static libexslt intermediate directory. |
---|
264 | $(EXSLT_INTDIR_A) : |
---|
265 | if not exist $(EXSLT_INTDIR_A) mkdir $(EXSLT_INTDIR_A) |
---|
266 | |
---|
267 | # An implicit rule for libexslt compilation. |
---|
268 | {$(EXSLT_SRCDIR)}.c{$(EXSLT_INTDIR)}.obj:: |
---|
269 | $(CC) /I$(EXSLT_SRCDIR) $(CFLAGS) /Fo$(EXSLT_INTDIR)\ /c $< |
---|
270 | |
---|
271 | # An implicit rule for static libexslt compilation. |
---|
272 | {$(EXSLT_SRCDIR)}.c{$(EXSLT_INTDIR_A)}.obj:: |
---|
273 | $(CC) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" \ |
---|
274 | /I$(EXSLT_SRCDIR) $(CFLAGS) /Fo$(EXSLT_INTDIR_A)\ /c $< |
---|
275 | |
---|
276 | # Compiles libxslt source. Uses the implicit rule for commands. |
---|
277 | $(EXSLT_OBJS) : $(EXSLT_INTDIR) |
---|
278 | |
---|
279 | # Compiles libxslt source. Uses the implicit rule for commands. |
---|
280 | $(EXSLT_OBJS_A) : $(EXSLT_INTDIR_A) |
---|
281 | |
---|
282 | # Creates the export definition file (DEF) for libxslt. |
---|
283 | $(EXSLT_INTDIR)\$(EXSLT_DEF) : $(EXSLT_INTDIR) $(EXSLT_DEF).src |
---|
284 | $(CPP) $(CPPFLAGS) $(EXSLT_DEF).src > $(EXSLT_INTDIR)\$(EXSLT_DEF) |
---|
285 | |
---|
286 | # Creates the libexslt shared object. |
---|
287 | $(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) $(EXSLT_INTDIR)\$(EXSLT_DEF) libxslt |
---|
288 | $(LD) $(LDFLAGS) /DLL \ |
---|
289 | /VERSION:$(LIBEXSLT_MAJOR_VERSION).$(LIBEXSLT_MINOR_VERSION) \ |
---|
290 | /IMPLIB:$(BINDIR)\$(EXSLT_IMP) /OUT:$(BINDIR)\$(EXSLT_SO) \ |
---|
291 | $(EXSLT_OBJS) $(XSLT_IMP) $(LIBS) libxml2.lib |
---|
292 | |
---|
293 | #$(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) $(EXSLT_INTDIR)\$(EXSLT_DEF) libxslt |
---|
294 | # $(LD) $(LDFLAGS) /DLL /DEF:$(EXSLT_INTDIR)\$(EXSLT_DEF) \ |
---|
295 | # /VERSION:$(LIBEXSLT_MAJOR_VERSION).$(LIBEXSLT_MINOR_VERSION) \ |
---|
296 | # /IMPLIB:$(BINDIR)\$(EXSLT_IMP) /OUT:$(BINDIR)\$(EXSLT_SO) \ |
---|
297 | # $(EXSLT_OBJS) $(XSLT_IMP) $(LIBS) libxml2.lib |
---|
298 | |
---|
299 | # Creates the libexslt archive. |
---|
300 | $(BINDIR)\$(EXSLT_A) : $(BINDIR) $(EXSLT_OBJS_A) libxslta |
---|
301 | $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(EXSLT_A) $(EXSLT_OBJS_A) |
---|
302 | |
---|
303 | |
---|
304 | # Creates the utils intermediate directory. |
---|
305 | $(UTILS_INTDIR) : |
---|
306 | if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) |
---|
307 | |
---|
308 | # An implicit rule for xsltproc and friends. |
---|
309 | APPLIBS = $(LIBS) |
---|
310 | !if "$(STATIC)" == "1" |
---|
311 | APPLIBS = $(LIBS) libxml2_a.lib |
---|
312 | !if "$(WITH_ICONV)" == "1" |
---|
313 | APPLIBS = $(APPLIBS) iconv.lib |
---|
314 | !endif |
---|
315 | !if "$(WITH_ZLIB)" == "1" |
---|
316 | APPLIBS = $(APPLIBS) zlib.lib |
---|
317 | !endif |
---|
318 | {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: |
---|
319 | $(CC) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" \ |
---|
320 | $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< |
---|
321 | $(LD) $(LDFLAGS) /OUT:$@ $(XSLT_A) $(EXSLT_A) $(APPLIBS) $(UTILS_INTDIR)\$(<B).obj |
---|
322 | !else |
---|
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 | !endif |
---|
328 | |
---|
329 | # Builds xsltproc and friends. Uses the implicit rule for commands. |
---|
330 | $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta |
---|
331 | |
---|
332 | # Source dependences should be autogenerated somehow here, but how to |
---|
333 | # do it? I have no clue. |
---|
334 | |
---|