3
3
#
4
4
# Makefile for Mini-XML, a small XML-like file parsing library.
5
5
#
6
- # Copyright 2003-2010 by Michael R Sweet.
6
+ # Copyright 2003-2011 by Michael R Sweet.
7
7
#
8
8
# These coded instructions, statements, and computer programs are the
9
9
# property of Michael R Sweet and are protected by Federal copyright
@@ -69,9 +69,11 @@ INSTALL_SCRIPT = $(INSTALL) -m 755
69
69
# Rules...
70
70
#
71
71
72
+ .SILENT :
72
73
.SUFFIXES : .c .man .o
73
74
.c.o :
74
- $(CC ) $(CFLAGS ) -c $<
75
+ echo Compiling $<
76
+ $(CC ) $(CFLAGS ) -c -o $@ $<
75
77
76
78
77
79
#
@@ -101,6 +103,7 @@ all: Makefile config.h $(TARGETS)
101
103
#
102
104
103
105
clean :
106
+ echo Cleaning build files...
104
107
$(RM ) $(OBJS ) $(TARGETS )
105
108
$(RM ) mxmldoc-static libmxml.a
106
109
@@ -110,6 +113,7 @@ clean:
110
113
#
111
114
112
115
distclean : clean
116
+ echo Cleaning distribution files...
113
117
$(RM ) config.cache config.log config.status
114
118
$(RM ) Makefile config.h
115
119
$(RM ) -r autom4te* .cache
@@ -123,9 +127,11 @@ distclean: clean
123
127
124
128
.PHONY : clang clang-changes
125
129
clang :
130
+ echo Doing static code analysis of all code using CLANG...
126
131
$(RM ) -r clang
127
132
scan-build -V -k -o ` pwd` /clang $(MAKE ) $(MFLAGS ) clean all
128
133
clang-changes :
134
+ echo Doing static code analysis of changed code using CLANG...
129
135
scan-build -V -k -o ` pwd` /clang $(MAKE ) $(MFLAGS ) all
130
136
131
137
@@ -134,41 +140,50 @@ clang-changes:
134
140
#
135
141
136
142
install : $(TARGETS ) install-$(LIBMXML ) install-libmxml.a
143
+ echo Installing mxmldoc in $(BUILDROOT )$(bindir ) ...
137
144
$(INSTALL_DIR ) $(BUILDROOT )$(bindir )
138
- $(INSTALL_BIN ) mxmldoc $(BUILDROOT )$(bindir )
145
+ $(INSTALL_BIN ) mxmldoc $(BUILDROOT )$(bindir )
146
+ echo Installing documentation in $(BUILDROOT )$(docdir ) ...
139
147
$(INSTALL_DIR ) $(BUILDROOT )$(docdir )
140
148
for file in $( DOCFILES) ; do \
141
149
$(INSTALL_MAN ) $$ file $(BUILDROOT )$(docdir ) ; \
142
150
done
151
+ echo Installing header files in $(BUILDROOT )$(includedir ) ...
143
152
$(INSTALL_DIR ) $(BUILDROOT )$(includedir )
144
153
$(INSTALL_DATA ) mxml.h $(BUILDROOT )$(includedir )
154
+ echo Installing pkgconfig files in $(BUILDROOT )$(libdir ) /pkgconfig...
145
155
$(INSTALL_DIR ) $(BUILDROOT )$(libdir ) /pkgconfig
146
156
$(INSTALL_DATA ) mxml.pc $(BUILDROOT )$(libdir ) /pkgconfig
157
+ echo Installing man pages in $(BUILDROOT )$(mandir ) ...
147
158
$(INSTALL_DIR ) $(BUILDROOT )$(mandir ) /man1
148
159
$(INSTALL_MAN ) doc/mxmldoc.man $(BUILDROOT )$(mandir ) /man1/mxmldoc.1
149
160
$(INSTALL_DIR ) $(BUILDROOT )$(mandir ) /man3
150
161
$(INSTALL_MAN ) doc/mxml.man $(BUILDROOT )$(mandir ) /man3/mxml.3
151
162
152
163
install-libmxml.a :
164
+ echo Installing libmxml.a to $(BUILDROOT )$(libdir ) ...
153
165
$(INSTALL_DIR ) $(BUILDROOT )$(libdir )
154
166
$(INSTALL_LIB ) libmxml.a $(BUILDROOT )$(libdir )
155
167
$(RANLIB ) $(BUILDROOT )$(libdir ) /libmxml.a
156
168
157
- install-libmxml.so.1.4 :
169
+ install-libmxml.so.1.5 :
170
+ echo Installing libmxml.so to $(BUILDROOT )$(libdir ) ...
158
171
$(INSTALL_DIR ) $(BUILDROOT )$(libdir )
159
- $(INSTALL_LIB ) libmxml.so.1.4 $(BUILDROOT )$(libdir )
172
+ $(INSTALL_LIB ) libmxml.so.1.5 $(BUILDROOT )$(libdir )
160
173
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.so
161
- $(LN ) libmxml.so.1.4 $(BUILDROOT )$(libdir ) /libmxml.so
174
+ $(LN ) libmxml.so.1.5 $(BUILDROOT )$(libdir ) /libmxml.so
162
175
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.so.1
163
- $(LN ) libmxml.so.1.4 $(BUILDROOT )$(libdir ) /libmxml.so.1
176
+ $(LN ) libmxml.so.1.5 $(BUILDROOT )$(libdir ) /libmxml.so.1
164
177
165
178
install-libmxml.sl.1 :
179
+ echo Installing libmxml.sl to $(BUILDROOT )$(libdir ) ...
166
180
$(INSTALL_DIR ) $(BUILDROOT )$(libdir )
167
181
$(INSTALL_LIB ) libmxml.sl.1 $(BUILDROOT )$(libdir )
168
182
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.so
169
183
$(LN ) libmxml.sl.1 $(BUILDROOT )$(libdir ) /libmxml.sl
170
184
171
185
install-libmxml.1.dylib :
186
+ echo Installing libmxml.dylib to $(BUILDROOT )$(libdir ) ...
172
187
$(INSTALL_DIR ) $(BUILDROOT )$(libdir )
173
188
$(INSTALL_LIB ) libmxml.1.dylib $(BUILDROOT )$(libdir )
174
189
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.dylib
@@ -180,35 +195,45 @@ install-libmxml.1.dylib:
180
195
#
181
196
182
197
uninstall : uninstall-$(LIBMXML ) uninstall-libmxml.a
198
+ echo Uninstalling mxmldoc from $(BUILDROOT )$(bindir ) ...
183
199
$(RM ) $(BUILDROOT )$(bindir ) /mxmldoc
200
+ echo Uninstalling documentation from $(BUILDROOT )$(docdir ) ...
184
201
$(RM ) -r $(BUILDROOT )$(docdir )
202
+ echo Uninstalling headers from $(BUILDROOT )$(includedir ) ...
185
203
$(RM ) $(BUILDROOT )$(includedir ) /mxml.h
204
+ echo Uninstalling pkgconfig files from $(BUILDROOT )$(libdir ) /pkgconfig...
186
205
$(RM ) $(BUILDROOT )$(libdir ) /pkgconfig/mxml.pc
206
+ echo Uninstalling man pages from $(BUILDROOT )$(mandir ) ...
187
207
$(RM ) $(BUILDROOT )$(mandir ) /man1/mxmldoc.1
188
208
$(RM ) $(BUILDROOT )$(mandir ) /man3/mxml.3
189
209
190
210
uninstall-libmxml.a :
211
+ echo Uninstalling libmxml.a from $(BUILDROOT )$(libdir ) ...
191
212
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.a
192
213
193
- uninstall-libmxml.so.1.4 :
214
+ uninstall-libmxml.so.1.5 :
215
+ echo Uninstalling libmxml.so from $(BUILDROOT )$(libdir ) ...
194
216
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.so
195
217
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.so.1
196
218
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.so.1.4
197
219
198
220
uninstall-libmxml.sl.1 :
221
+ echo Uninstalling libmxml.sl from $(BUILDROOT )$(libdir ) ...
199
222
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.sl
200
223
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.sl.1
201
224
202
225
uninstall-libmxml.1.dylib :
226
+ echo Uninstalling libmxml.dylib from $(BUILDROOT )$(libdir ) ...
203
227
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.dylib
204
228
$(RM ) $(BUILDROOT )$(libdir ) /libmxml.1.dylib
205
229
206
230
207
231
#
208
- # Make packages using EPM (http://www.easysw.com/epm /)
232
+ # Make packages using EPM (http://www.epmhome.org /)
209
233
#
210
234
211
235
epm : all
236
+ echo Creating distribution packages...
212
237
epm --output-dir dist -v -f native mxml
213
238
epm --output-dir dist -v -f portable mxml
214
239
@@ -218,6 +243,7 @@ epm: all
218
243
#
219
244
220
245
Makefile : configure Makefile.in
246
+ echo Updating makefile...
221
247
if test -f config.status; then \
222
248
./config.status --recheck; \
223
249
./config.status; \
@@ -228,6 +254,7 @@ Makefile: configure Makefile.in
228
254
229
255
230
256
config.h : configure config.h.in
257
+ echo Updating config.h...
231
258
autoconf
232
259
if test -f config.status; then \
233
260
./config.status --recheck; \
@@ -238,11 +265,24 @@ config.h: configure config.h.in
238
265
touch config.h
239
266
240
267
268
+ #
269
+ # Figure out lines-of-code...
270
+ #
271
+
272
+ .PHONY : sloc
273
+
274
+ sloc :
275
+ echo " libmxml: \c"
276
+ sloccount $(LIBOBJS:.o=.c ) mxml-private.c mxml.h 2> /dev/null | \
277
+ grep " Total Physical" | awk ' {print $$9}'
278
+
279
+
241
280
#
242
281
# libmxml.a
243
282
#
244
283
245
284
libmxml.a : $(LIBOBJS )
285
+ echo Creating $@ ...
246
286
$(RM ) $@
247
287
$(AR ) $(ARFLAGS ) $@ $(LIBOBJS )
248
288
$(RANLIB ) $@
@@ -252,21 +292,23 @@ mxml-entity.o mxml-file.o mxml-private.o: mxml-private.h
252
292
253
293
254
294
#
255
- # libmxml.so.1.4
295
+ # libmxml.so.1.5
256
296
#
257
297
258
- libmxml.so.1.4 : $(LIBOBJS )
259
- $(DSO ) $(DSOFLAGS ) -o libmxml.so.1.4 $(LIBOBJS )
298
+ libmxml.so.1.5 : $(LIBOBJS )
299
+ echo Creating $@ ...
300
+ $(DSO ) $(DSOFLAGS ) -o libmxml.so.1.5 $(LIBOBJS )
260
301
$(RM ) libmxml.so libmxml.so.1
261
- $(LN ) libmxml.so.1.4 libmxml.so
262
- $(LN ) libmxml.so.1.4 libmxml.so.1
302
+ $(LN ) libmxml.so.1.5 libmxml.so
303
+ $(LN ) libmxml.so.1.5 libmxml.so.1
263
304
264
305
265
306
#
266
307
# libmxml.sl.1
267
308
#
268
309
269
310
libmxml.sl.1 : $(LIBOBJS )
311
+ echo Creating $@ ...
270
312
$(DSO ) $(DSOFLAGS ) -o libmxml.sl.1 $(LIBOBJS )
271
313
$(RM ) libmxml.sl
272
314
$(LN ) libmxml.sl.1 libmxml.sl
@@ -277,9 +319,10 @@ libmxml.sl.1: $(LIBOBJS)
277
319
#
278
320
279
321
libmxml.1.dylib : $(LIBOBJS )
322
+ echo Creating $@ ...
280
323
$(DSO ) $(DSOFLAGS ) -o libmxml.1.dylib \
281
324
-install_name $(libdir ) /libmxml.dylib \
282
- -current_version 1.4 .0 \
325
+ -current_version 1.5 .0 \
283
326
-compatibility_version 1.0.0 \
284
327
$(LIBOBJS )
285
328
$(RM ) libmxml.dylib
@@ -291,9 +334,11 @@ libmxml.1.dylib: $(LIBOBJS)
291
334
#
292
335
293
336
mxmldoc : $(LIBMXML ) mxmldoc.o
337
+ echo Linking $@ ...
294
338
$(CC ) -L. $(LDFLAGS ) -o $@ mxmldoc.o -lmxml $(LIBS )
295
339
296
340
mxmldoc-static : libmxml.a mxmldoc.o
341
+ echo Linking $@ ...
297
342
$(CC ) $(LDFLAGS ) -o $@ mxmldoc.o libmxml.a $(LIBS )
298
343
299
344
mxmldoc.o : mxml.h
@@ -304,6 +349,7 @@ mxmldoc.o: mxml.h
304
349
#
305
350
306
351
testmxml : libmxml.a testmxml.o
352
+ echo Linking $@ ...
307
353
$(CC ) $(LDFLAGS ) -o $@ testmxml.o libmxml.a $(LIBS )
308
354
@echo Testing library...
309
355
./testmxml test.xml > temp1.xml 2> temp1s.xml
@@ -335,6 +381,7 @@ testmxml.o: mxml.h
335
381
#
336
382
337
383
mxml.xml : mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c )
384
+ echo Generating API documentation...
338
385
$(RM ) mxml.xml
339
386
./mxmldoc-static --header doc/reference.heading mxml.xml mxml.h $(PUBLIBOBJS:.o=.c ) > doc/reference.html
340
387
if test " x` uname` " = xDarwin; then \
@@ -351,6 +398,7 @@ mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c)
351
398
fi
352
399
353
400
valgrind : mxmldoc-static
401
+ echo Doing dynamic code analysis using Valgrind...
354
402
$(RM ) valgrind.xml
355
403
valgrind --tool=memcheck --leak-check=yes ./mxmldoc-static \
356
404
valgrind.xml mxml.h $(PUBLIBOBJS:.o=.c ) \
@@ -362,6 +410,7 @@ valgrind: mxmldoc-static
362
410
#
363
411
364
412
doc/mxml.man : mxmldoc-static mxml.xml
413
+ echo " Generating mxml(3) man page..."
365
414
$(RM ) doc/mxml.man
366
415
./mxmldoc-static --man mxml --title " Mini-XML API" \
367
416
--intro doc/intro.man --footer doc/footer.man \
0 commit comments