Merge branch 'master' of /home/mdw/public-git/mLib
[mLib] / Makefile.am
1 ### -*-Makefile-*-
2 ###
3 ### Building the distribution
4 ###
5 ### (c) 1998 Straylight/Edgeware
6 ###
7
8 ###----- Licensing notice ---------------------------------------------------
9 ###
10 ### This file is part of the mLib utilities library.
11 ###
12 ### mLib is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU Library General Public License as
14 ### published by the Free Software Foundation; either version 2 of the
15 ### License, or (at your option) any later version.
16 ###
17 ### mLib is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ### GNU Library General Public License for more details.
21 ###
22 ### You should have received a copy of the GNU Library General Public
23 ### License along with mLib; if not, write to the Free
24 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 ### MA 02111-1307, USA.
26
27 pkglibexecdir = $(libexecdir)/$(PACKAGE)
28
29 SUBDIRS =
30 BUILT_SOURCES =
31 bin_PROGRAMS =
32 check_PROGRAMS =
33 lib_LTLIBRARIES =
34 noinst_LTLIBRARIES =
35 pkglibexec_PROGRAMS =
36 pkginclude_HEADERS =
37 EXTRA_DIST =
38 CLEANFILES =
39 DISTCLEANFILES =
40
41 confsubst = $(top_srcdir)/config/confsubst
42
43 SUBSTITUTIONS = \
44 prefix=$(prefix) exec_prefix=$(exec_prefix) \
45 libdir=$(libdir) includedir=$(includedir) \
46 bindir=$(bindir) sbindir=$(sbindir) \
47 PACKAGE=$(PACKAGE) VERSION=$(VERSION)
48
49 ###--------------------------------------------------------------------------
50 ### Library.
51
52 lib_LTLIBRARIES += libmLib.la
53 libmLib_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO)
54 libmLib_la_SOURCES =
55 libmLib_la_LIBADD =
56
57 pkgconfigdir = $(libdir)/pkgconfig
58 pkgconfig_DATA = mLib.pc
59 EXTRA_DIST += mLib.pc.in
60 CLEANFILES += mLib.pc
61
62 mLib.pc: mLib.pc.in Makefile
63 $(confsubst) $(srcdir)/mLib.pc.in >$@.new $(SUBSTITUTIONS) && \
64 mv $@.new $@
65
66 ###--------------------------------------------------------------------------
67 ### Testing.
68
69 check: tests
70 .PHONY: check tests
71
72 TEST_CPPFLAGS = -DTEST_RIG -DSRCDIR="\"(srcdir)\"" $(AM_CPPFLAGS)
73
74 LDADD = libmLib.la
75
76 ###--------------------------------------------------------------------------
77 ### Utilities.
78
79 noinst_LTLIBRARIES += libutils.la
80 libutils_la_SOURCES =
81 libutils_la_LIBADD =
82 libmLib_la_LIBADD += libutils.la
83
84 ## Utility macros.
85 pkginclude_HEADERS += macros.h
86
87 ## Alignment.
88 pkginclude_HEADERS += align.h
89
90 ## Bit manipulation.
91 pkginclude_HEADERS += bits.h
92
93 EXTRA_DIST += bits.in bits-testgen.c
94 tests:: bits.t bits.in
95 ./bits.t -f $(srcdir)/bits.in
96
97 check_PROGRAMS += bits.t
98 bits_t_SOURCES = bits.c
99 bits_t_CPPFLAGS = $(TEST_CPPFLAGS)
100 bits_t_LDFLAGS = -static
101
102 ## Exceptions.
103 pkginclude_HEADERS += exc.h
104 libmLib_la_SOURCES += exc.c
105
106 ## String handling.
107 pkginclude_HEADERS += str.h
108 libutils_la_SOURCES += str.c
109
110 ## Version comparison.
111 pkginclude_HEADERS += versioncmp.h
112 libmLib_la_SOURCES += versioncmp.c
113
114 EXTRA_DIST += versioncmp.in
115 tests:: versioncmp.t versioncmp.in
116 ./versioncmp.t -f $(srcdir)/versioncmp.in
117
118 check_PROGRAMS += versioncmp.t
119 versioncmp_t_SOURCES = versioncmp-test.c
120 versioncmp_t_CPPFLAGS = $(TEST_CPPFLAGS)
121 versioncmp_t_LDFLAGS = -static
122
123 ###--------------------------------------------------------------------------
124 ### Memory allocation.
125
126 ## Memory allocation.
127 pkginclude_HEADERS += alloc.h arena.h sub.h
128 libmLib_la_SOURCES += alloc.c arena.c sub.c
129
130 ## Pool allocator.
131 pkginclude_HEADERS += pool.h
132 libmLib_la_SOURCES += pool.c pool-file.c pool-sub.c
133
134 ###--------------------------------------------------------------------------
135 ### Hashing.
136
137 ## CRC32.
138 pkginclude_HEADERS += crc32.h
139 libmLib_la_SOURCES += crc32.c crc32-tab.c
140
141 bin_PROGRAMS += crc-mktab
142 crc_mktab_SOURCES = crc-mktab.c $(UTIL_SOURCES)
143 crc_mktab_LDADD = libutils.la
144
145 BUILT_SOURCES += crc32-tab.c
146 CLEANFILES += crc32-tab.c
147 crc32-tab.c: crc-mktab$(EXEEXT)
148 ./crc-mktab -o $@.new \
149 -p0x04c11db7 -b32 -B8 -r -c \
150 -scrc32_table -icrc32.h -tuint32 && \
151 mv $@.new $@
152
153 ## Universal hashing.
154 pkginclude_HEADERS += unihash.h
155 libutils_la_SOURCES += unihash.c
156 libmLib_la_SOURCES += unihash-global.c
157 BUILT_SOURCES += unihash-global.c
158
159 bin_PROGRAMS += unihash-mkstatic
160 unihash_mkstatic_SOURCES = unihash-mkstatic.c
161 unihash_mkstatic_LDADD = libutils.la
162
163 BUILT_SOURCES += unihash-global.c
164 CLEANFILES += unihash-global.c
165 unihash-global.c: unihash-mkstatic$(EXEEXT)
166 ./unihash-mkstatic -c -sunihash_global -iunihash.h -o$@.new && \
167 mv $@.new $@
168
169 check_PROGRAMS += unihash.t
170 unihash_t_SOURCES = unihash.c
171 unihash_t_CPPFLAGS = $(TEST_CPPFLAGS)
172 unihash_t_LDFLAGS = -static
173
174 tests:: unihash.t unihash.in
175 ./unihash.t -f unihash.in
176
177 EXTRA_DIST += unihash-check.pl
178 CLEANFILES += unihash.in
179 unihash.in: unihash-check.pl
180 perl $(srcdir)/unihash-check.pl >$@.new && mv $@.new $@
181
182 ###--------------------------------------------------------------------------
183 ### Data structures.
184
185 ## Dynamic strings.
186 pkginclude_HEADERS += dstr.h dspool.h
187 libmLib_la_SOURCES += dstr.c dputf.c dspool.c
188
189 ## Buffers.
190 pkginclude_HEADERS += buf.h
191 libmLib_la_SOURCES += buf.c buf-dstr.c
192
193 ## Dynamic arrays.
194 pkginclude_HEADERS += darray.h
195 libmLib_la_SOURCES += darray.c
196
197 CLEANFILES += da.out
198 tests:: darray.t da.in da.ref
199 ./darray.t <da.in >da.out
200 cmp da.out da.ref
201 @echo "darray OK"
202
203 check_PROGRAMS += darray.t
204 darray_t_SOURCES = da-test.c
205 darray_t_CPPFLAGS = $(TEST_CPPFLAGS)
206 darray_t_LDFLAGS = -static
207
208 EXTRA_DIST += da-gtest
209 CLEANFILES += da.in
210 da.in: da-gtest
211 perl $(srcdir)/da-gtest 10000 >$@.new && mv $@.new $@
212
213 EXTRA_DIST += da-ref
214 CLEANFILES += da.ref
215 da.ref: da-ref da.in
216 perl $(srcdir)/da-ref <da.in >$@.new && mv $@.new $@
217
218 ## Hash tables.
219 pkginclude_HEADERS += hash.h
220 libmLib_la_SOURCES += hash.c
221
222 ## Symbol tables.
223 pkginclude_HEADERS += sym.h
224 libmLib_la_SOURCES += sym.c
225
226 CLEANFILES += sym.out
227 tests:: sym.t sym.in sym.ref
228 ./sym.t <sym.in >sym.out
229 cmp sym.out sym.ref
230 @echo "sym OK"
231
232 check_PROGRAMS += sym.t
233 sym_t_SOURCES = sym-test.c
234 sym_t_CPPFLAGS = $(TEST_CPPFLAGS)
235 sym_t_LDFLAGS = -static
236
237 EXTRA_DIST += sym-gtest
238 CLEANFILES += sym.in
239 sym.in: sym-gtest
240 perl $(srcdir)/sym-gtest 10000 >$@.new && mv $@.new $@
241
242 EXTRA_DIST += sym-ref
243 CLEANFILES += sym.ref
244 sym.ref: sym-ref sym.in
245 perl $(srcdir)/sym-ref <sym.in >$@.new && mv $@.new $@
246
247 ## Atoms.
248 pkginclude_HEADERS += atom.h
249 libmLib_la_SOURCES += atom.c
250
251 ## Association tables.
252 pkginclude_HEADERS += assoc.h
253 libmLib_la_SOURCES += assoc.c
254
255 CLEANFILES += assoc.out
256 tests:: assoc.t sym.in sym.ref
257 ./assoc.t <sym.in >assoc.out
258 cmp assoc.out sym.ref
259 @echo "sym OK"
260
261 check_PROGRAMS += assoc.t
262 assoc_t_SOURCES = assoc-test.c
263 assoc_t_CPPFLAGS = $(TEST_CPPFLAGS)
264 assoc_t_LDFLAGS = -static
265
266 ###--------------------------------------------------------------------------
267 ### User interface.
268
269 ## Option parsing.
270 noinst_LTLIBRARIES += libmdwopt.la
271 pkginclude_HEADERS += mdwopt.h
272 libmdwopt_la_SOURCES = mdwopt.c
273 libmdwopt_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_MLIB
274 libutils_la_LIBADD += libmdwopt.la
275
276 ## Program naming.
277 pkginclude_HEADERS += quis.h
278 libutils_la_SOURCES += quis.c pquis.c
279
280 ## Error reporting.
281 pkginclude_HEADERS += report.h
282 libutils_la_SOURCES += report.c
283
284 ###--------------------------------------------------------------------------
285 ### Encoding and decoding.
286
287 ## form-urlencoded
288 pkginclude_HEADERS += url.h
289 libmLib_la_SOURCES += url.c
290
291 ## base64
292 pkginclude_HEADERS += base64.h
293 libmLib_la_SOURCES += base64.c
294
295 EXTRA_DIST += base64.in base64.ref
296 CLEANFILES += base64.out
297 tests:: base64.t base64.in base64.ref
298 ./base64.t <$(srcdir)/base64.in >base64.out
299 cmp base64.out $(srcdir)/base64.ref
300 ./base64.t -d <$(srcdir)/base64.ref >base64.out
301 cmp base64.out $(srcdir)/base64.in
302 @echo "base64 OK"
303
304 check_PROGRAMS += base64.t
305 base64_t_SOURCES = base64.c
306 base64_t_CPPFLAGS = $(TEST_CPPFLAGS)
307 base64_t_LDFLAGS = -static
308
309 ## base32
310 pkginclude_HEADERS += base32.h
311 libmLib_la_SOURCES += base32.c
312
313 EXTRA_DIST += base32.in base32.ref
314 CLEANFILES += base32.out
315 tests:: base32.t base32.in base32.ref
316 ./base32.t <$(srcdir)/base32.in >base32.out
317 cmp base32.out $(srcdir)/base32.ref
318 ./base32.t -d <$(srcdir)/base32.ref >base32.out
319 cmp base32.out $(srcdir)/base32.in
320 @echo "base32 OK"
321
322 check_PROGRAMS += base32.t
323 base32_t_SOURCES = base32.c
324 base32_t_CPPFLAGS = $(TEST_CPPFLAGS)
325 base32_t_LDFLAGS = -static
326
327 ## hex
328 pkginclude_HEADERS += hex.h
329 libmLib_la_SOURCES += hex.c
330
331 EXTRA_DIST += hex.in hex.ref
332 CLEANFILES += hex.out
333 tests:: hex.t hex.in hex.ref
334 ./hex.t <$(srcdir)/hex.in >hex.out
335 cmp hex.out $(srcdir)/hex.ref
336 ./hex.t -d <$(srcdir)/hex.ref >hex.out
337 cmp hex.out $(srcdir)/hex.in
338 @echo "hex OK"
339
340 check_PROGRAMS += hex.t
341 hex_t_SOURCES = hex.c
342 hex_t_CPPFLAGS = $(TEST_CPPFLAGS)
343 hex_t_LDFLAGS = -static
344
345 ###--------------------------------------------------------------------------
346 ### System utilities.
347
348 ## Daemons.
349 pkginclude_HEADERS += daemonize.h
350 libmLib_la_SOURCES += daemonize.c
351
352 ## Environment variables.
353 pkginclude_HEADERS += env.h
354 libmLib_la_SOURCES += env.c
355
356 ## File and descriptor flags.
357 pkginclude_HEADERS += fdflags.h
358 libmLib_la_SOURCES += fdflags.c
359
360 ## File descriptor passing.
361 pkginclude_HEADERS += fdpass.h
362 libmLib_la_SOURCES += fdpass.c
363
364 ## Watching files for modification.
365 pkginclude_HEADERS += fwatch.h
366 libmLib_la_SOURCES += fwatch.c
367
368 ## File locking.
369 pkginclude_HEADERS += lock.h
370 libmLib_la_SOURCES += lock.c
371
372 ## Time arithmetic.
373 pkginclude_HEADERS += tv.h
374 libmLib_la_SOURCES += tv.c
375
376 ###--------------------------------------------------------------------------
377 ### Buffering.
378
379 ## Line buffering.
380 pkginclude_HEADERS += lbuf.h
381 libmLib_la_SOURCES += lbuf.c
382
383 ## Packet buffering.
384 pkginclude_HEADERS += pkbuf.h
385 libmLib_la_SOURCES += pkbuf.c
386
387 ###--------------------------------------------------------------------------
388 ### Network utilities.
389
390 ## Core event selection.
391 pkginclude_HEADERS += sel.h
392 libmLib_la_SOURCES += sel.c
393
394 ## Waiting for buffers to fill.
395 pkginclude_HEADERS += selbuf.h selpk.h
396 libmLib_la_SOURCES += selbuf.c selpk.c
397
398 ## RFC931 identification.
399 pkginclude_HEADERS += ident.h
400 libmLib_la_SOURCES += ident.c
401
402 ## Nonblocking connections.
403 pkginclude_HEADERS += conn.h
404 libmLib_la_SOURCES += conn.c
405
406 ## Signal handling
407 pkginclude_HEADERS += sig.h
408 libmLib_la_SOURCES += sig.c
409
410 ## Name resolution.
411 pkginclude_HEADERS += bres.h
412
413 if WITH_ADNS
414 libmLib_la_SOURCES += bres-adns.c
415 else
416 libmLib_la_SOURCES += bres.c
417 pkglibexec_PROGRAMS += bres
418 bres_SOURCES = bres.c
419 bres_CPPFLAGS = -DBRES_STANDALONE $(AM_CPPFLAGS)
420 bres_LDADD =
421 endif
422
423 ###--------------------------------------------------------------------------
424 ### Testing and debugging.
425
426 ## Tracing.
427 pkginclude_HEADERS += trace.h
428 libmLib_la_SOURCES += trace.c traceopt.c
429
430 ## Memory tracking.
431 pkginclude_HEADERS += track.h
432 libmLib_la_SOURCES += track.c
433
434 ## Testing.
435 pkginclude_HEADERS += testrig.h
436 libmLib_la_SOURCES += testrig.c
437
438 ###--------------------------------------------------------------------------
439 ### Manual.
440
441 SUBDIRS += man
442
443 install-man:
444 (cd man && $(MAKE) install-man)
445 uninstall-man:
446 (cd man && $(MAKE) uninstall-man)
447 .PHONY: install-man uninstall-man
448
449
450 ###--------------------------------------------------------------------------
451 ### Distribution.
452
453 ## Release number.
454 dist-hook::
455 echo $(VERSION) >$(distdir)/RELEASE
456
457 ## Additional build tools.
458 EXTRA_DIST += config/confsubst
459 EXTRA_DIST += config/auto-version
460 EXTRA_DIST += config/maninst
461
462 ###--------------------------------------------------------------------------
463 ### Debian.
464
465 ## General stuff.
466 EXTRA_DIST += debian/rules debian/copyright
467 EXTRA_DIST += debian/control debian/changelog
468 EXTRA_DIST += debian/mlib2.install
469 EXTRA_DIST += debian/mlib2-adns.install
470 EXTRA_DIST += debian/mlib-dev.install
471 EXTRA_DIST += debian/mlib-bin.install
472
473 ##----- That's all, folks ---------------------------------------------------