chiark / gitweb /
Manpages: Move manpages (back?) into the top-level directory.
[mLib] / Makefile.am
CommitLineData
a0150d8d
MW
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
27pkglibexecdir = $(libexecdir)/$(PACKAGE)
28
29SUBDIRS =
30BUILT_SOURCES =
31bin_PROGRAMS =
8f45ff6c 32check_PROGRAMS =
a0150d8d
MW
33lib_LTLIBRARIES =
34noinst_LTLIBRARIES =
35pkglibexec_PROGRAMS =
36pkginclude_HEADERS =
37EXTRA_DIST =
38CLEANFILES =
39DISTCLEANFILES =
4aee39a1
MW
40PROGMANS =
41LIBMANS =
a0150d8d
MW
42
43confsubst = $(top_srcdir)/config/confsubst
44
45SUBSTITUTIONS = \
46 prefix=$(prefix) exec_prefix=$(exec_prefix) \
47 libdir=$(libdir) includedir=$(includedir) \
48 bindir=$(bindir) sbindir=$(sbindir) \
49 PACKAGE=$(PACKAGE) VERSION=$(VERSION)
50
51###--------------------------------------------------------------------------
52### Library.
53
54lib_LTLIBRARIES += libmLib.la
55libmLib_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO)
56libmLib_la_SOURCES =
57libmLib_la_LIBADD =
58
59pkgconfigdir = $(libdir)/pkgconfig
60pkgconfig_DATA = mLib.pc
61EXTRA_DIST += mLib.pc.in
62CLEANFILES += mLib.pc
63
64mLib.pc: mLib.pc.in Makefile
65 $(confsubst) $(srcdir)/mLib.pc.in >$@.new $(SUBSTITUTIONS) && \
66 mv $@.new $@
67
68###--------------------------------------------------------------------------
69### Testing.
70
71check: tests
72.PHONY: check tests
73
74TEST_CPPFLAGS = -DTEST_RIG -DSRCDIR="\"(srcdir)\"" $(AM_CPPFLAGS)
75
76LDADD = libmLib.la
77
78###--------------------------------------------------------------------------
79### Utilities.
80
81noinst_LTLIBRARIES += libutils.la
82libutils_la_SOURCES =
83libutils_la_LIBADD =
84libmLib_la_LIBADD += libutils.la
85
86## Utility macros.
87pkginclude_HEADERS += macros.h
4aee39a1 88LIBMANS += macros.3
a0150d8d
MW
89
90## Alignment.
91pkginclude_HEADERS += align.h
92
93## Bit manipulation.
94pkginclude_HEADERS += bits.h
4aee39a1 95LIBMANS += bits.3
a0150d8d
MW
96
97EXTRA_DIST += bits.in bits-testgen.c
98tests:: bits.t bits.in
99 ./bits.t -f $(srcdir)/bits.in
b7580524 100
8f45ff6c 101check_PROGRAMS += bits.t
a0150d8d
MW
102bits_t_SOURCES = bits.c
103bits_t_CPPFLAGS = $(TEST_CPPFLAGS)
104bits_t_LDFLAGS = -static
105
106## Exceptions.
107pkginclude_HEADERS += exc.h
108libmLib_la_SOURCES += exc.c
4aee39a1 109LIBMANS += exc.3
a0150d8d
MW
110
111## String handling.
112pkginclude_HEADERS += str.h
113libutils_la_SOURCES += str.c
4aee39a1 114LIBMANS += str.3
a0150d8d
MW
115
116## Version comparison.
117pkginclude_HEADERS += versioncmp.h
118libmLib_la_SOURCES += versioncmp.c
4aee39a1 119LIBMANS += versioncmp.3
a0150d8d
MW
120
121EXTRA_DIST += versioncmp.in
122tests:: versioncmp.t versioncmp.in
123 ./versioncmp.t -f $(srcdir)/versioncmp.in
124
8f45ff6c 125check_PROGRAMS += versioncmp.t
a0150d8d
MW
126versioncmp_t_SOURCES = versioncmp-test.c
127versioncmp_t_CPPFLAGS = $(TEST_CPPFLAGS)
128versioncmp_t_LDFLAGS = -static
129
130###--------------------------------------------------------------------------
131### Memory allocation.
132
133## Memory allocation.
134pkginclude_HEADERS += alloc.h arena.h sub.h
135libmLib_la_SOURCES += alloc.c arena.c sub.c
4aee39a1 136LIBMANS += alloc.3 arena.3 sub.3
a0150d8d
MW
137
138## Pool allocator.
139pkginclude_HEADERS += pool.h
140libmLib_la_SOURCES += pool.c pool-file.c pool-sub.c
4aee39a1 141LIBMANS += pool.3
b7580524 142
a0150d8d
MW
143###--------------------------------------------------------------------------
144### Hashing.
145
146## CRC32.
147pkginclude_HEADERS += crc32.h
148libmLib_la_SOURCES += crc32.c crc32-tab.c
4aee39a1 149LIBMANS += crc32.3
a0150d8d
MW
150
151bin_PROGRAMS += crc-mktab
152crc_mktab_SOURCES = crc-mktab.c $(UTIL_SOURCES)
153crc_mktab_LDADD = libutils.la
4aee39a1 154PROGMANS += crc-mktab.1
a0150d8d
MW
155
156BUILT_SOURCES += crc32-tab.c
157CLEANFILES += crc32-tab.c
158crc32-tab.c: crc-mktab$(EXEEXT)
159 ./crc-mktab -o $@.new \
160 -p0x04c11db7 -b32 -B8 -r -c \
161 -scrc32_table -icrc32.h -tuint32 && \
162 mv $@.new $@
163
164## Universal hashing.
165pkginclude_HEADERS += unihash.h
166libutils_la_SOURCES += unihash.c
167libmLib_la_SOURCES += unihash-global.c
168BUILT_SOURCES += unihash-global.c
4aee39a1 169LIBMANS += unihash.3
a0150d8d
MW
170
171bin_PROGRAMS += unihash-mkstatic
172unihash_mkstatic_SOURCES = unihash-mkstatic.c
173unihash_mkstatic_LDADD = libutils.la
4aee39a1 174PROGMANS += unihash-mkstatic.1
a0150d8d
MW
175
176BUILT_SOURCES += unihash-global.c
177CLEANFILES += unihash-global.c
1a6043f9 178unihash-global.c: unihash-mkstatic$(EXEEXT)
a0150d8d
MW
179 ./unihash-mkstatic -c -sunihash_global -iunihash.h -o$@.new && \
180 mv $@.new $@
181
8f45ff6c 182check_PROGRAMS += unihash.t
a0150d8d
MW
183unihash_t_SOURCES = unihash.c
184unihash_t_CPPFLAGS = $(TEST_CPPFLAGS)
185unihash_t_LDFLAGS = -static
186
187tests:: unihash.t unihash.in
188 ./unihash.t -f unihash.in
189
190EXTRA_DIST += unihash-check.pl
191CLEANFILES += unihash.in
192unihash.in: unihash-check.pl
193 perl $(srcdir)/unihash-check.pl >$@.new && mv $@.new $@
194
195###--------------------------------------------------------------------------
196### Data structures.
197
198## Dynamic strings.
199pkginclude_HEADERS += dstr.h dspool.h
200libmLib_la_SOURCES += dstr.c dputf.c dspool.c
4aee39a1 201LIBMANS += dstr.3 dspool.3
a0150d8d
MW
202
203## Buffers.
204pkginclude_HEADERS += buf.h
205libmLib_la_SOURCES += buf.c buf-dstr.c
4aee39a1 206LIBMANS += buf.3
a0150d8d
MW
207
208## Dynamic arrays.
209pkginclude_HEADERS += darray.h
210libmLib_la_SOURCES += darray.c
4aee39a1 211LIBMANS += darray.3
a0150d8d
MW
212
213CLEANFILES += da.out
214tests:: darray.t da.in da.ref
215 ./darray.t <da.in >da.out
d5679ed0 216 cmp da.out da.ref
a0150d8d
MW
217 @echo "darray OK"
218
8f45ff6c 219check_PROGRAMS += darray.t
a0150d8d
MW
220darray_t_SOURCES = da-test.c
221darray_t_CPPFLAGS = $(TEST_CPPFLAGS)
222darray_t_LDFLAGS = -static
223
224EXTRA_DIST += da-gtest
225CLEANFILES += da.in
226da.in: da-gtest
227 perl $(srcdir)/da-gtest 10000 >$@.new && mv $@.new $@
228
229EXTRA_DIST += da-ref
230CLEANFILES += da.ref
231da.ref: da-ref da.in
232 perl $(srcdir)/da-ref <da.in >$@.new && mv $@.new $@
233
234## Hash tables.
235pkginclude_HEADERS += hash.h
236libmLib_la_SOURCES += hash.c
4aee39a1 237LIBMANS += hash.3
a0150d8d
MW
238
239## Symbol tables.
240pkginclude_HEADERS += sym.h
241libmLib_la_SOURCES += sym.c
4aee39a1 242LIBMANS += sym.3
a0150d8d
MW
243
244CLEANFILES += sym.out
245tests:: sym.t sym.in sym.ref
d5679ed0 246 ./sym.t <sym.in >sym.out
247 cmp sym.out sym.ref
a0150d8d
MW
248 @echo "sym OK"
249
8f45ff6c 250check_PROGRAMS += sym.t
a0150d8d
MW
251sym_t_SOURCES = sym-test.c
252sym_t_CPPFLAGS = $(TEST_CPPFLAGS)
253sym_t_LDFLAGS = -static
21c22b5c 254
a0150d8d
MW
255EXTRA_DIST += sym-gtest
256CLEANFILES += sym.in
257sym.in: sym-gtest
258 perl $(srcdir)/sym-gtest 10000 >$@.new && mv $@.new $@
259
260EXTRA_DIST += sym-ref
261CLEANFILES += sym.ref
262sym.ref: sym-ref sym.in
263 perl $(srcdir)/sym-ref <sym.in >$@.new && mv $@.new $@
264
265## Atoms.
266pkginclude_HEADERS += atom.h
267libmLib_la_SOURCES += atom.c
4aee39a1 268LIBMANS += atom.3
a0150d8d
MW
269
270## Association tables.
271pkginclude_HEADERS += assoc.h
272libmLib_la_SOURCES += assoc.c
4aee39a1 273LIBMANS += assoc.3
a0150d8d
MW
274
275CLEANFILES += assoc.out
276tests:: assoc.t sym.in sym.ref
d5679ed0 277 ./assoc.t <sym.in >assoc.out
278 cmp assoc.out sym.ref
a0150d8d 279 @echo "sym OK"
d5679ed0 280
8f45ff6c 281check_PROGRAMS += assoc.t
a0150d8d
MW
282assoc_t_SOURCES = assoc-test.c
283assoc_t_CPPFLAGS = $(TEST_CPPFLAGS)
284assoc_t_LDFLAGS = -static
285
286###--------------------------------------------------------------------------
287### User interface.
288
289## Option parsing.
290noinst_LTLIBRARIES += libmdwopt.la
291pkginclude_HEADERS += mdwopt.h
292libmdwopt_la_SOURCES = mdwopt.c
293libmdwopt_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_MLIB
294libutils_la_LIBADD += libmdwopt.la
4aee39a1 295LIBMANS += mdwopt.3
a0150d8d
MW
296
297## Program naming.
298pkginclude_HEADERS += quis.h
299libutils_la_SOURCES += quis.c pquis.c
4aee39a1 300LIBMANS += quis.3
a0150d8d
MW
301
302## Error reporting.
303pkginclude_HEADERS += report.h
304libutils_la_SOURCES += report.c
4aee39a1 305LIBMANS += report.3
3048fcf9 306
a0150d8d
MW
307###--------------------------------------------------------------------------
308### Encoding and decoding.
309
310## form-urlencoded
311pkginclude_HEADERS += url.h
312libmLib_la_SOURCES += url.c
4aee39a1 313LIBMANS += url.3
a0150d8d
MW
314
315## base64
316pkginclude_HEADERS += base64.h
317libmLib_la_SOURCES += base64.c
4aee39a1 318LIBMANS += base64.3
a0150d8d
MW
319
320EXTRA_DIST += base64.in base64.ref
321CLEANFILES += base64.out
322tests:: base64.t base64.in base64.ref
d5679ed0 323 ./base64.t <$(srcdir)/base64.in >base64.out
324 cmp base64.out $(srcdir)/base64.ref
325 ./base64.t -d <$(srcdir)/base64.ref >base64.out
326 cmp base64.out $(srcdir)/base64.in
a0150d8d
MW
327 @echo "base64 OK"
328
8f45ff6c 329check_PROGRAMS += base64.t
a0150d8d
MW
330base64_t_SOURCES = base64.c
331base64_t_CPPFLAGS = $(TEST_CPPFLAGS)
332base64_t_LDFLAGS = -static
333
334## base32
335pkginclude_HEADERS += base32.h
336libmLib_la_SOURCES += base32.c
4aee39a1 337LIBMANS += base32.3
a0150d8d
MW
338
339EXTRA_DIST += base32.in base32.ref
340CLEANFILES += base32.out
341tests:: base32.t base32.in base32.ref
1c4fa429 342 ./base32.t <$(srcdir)/base32.in >base32.out
343 cmp base32.out $(srcdir)/base32.ref
344 ./base32.t -d <$(srcdir)/base32.ref >base32.out
345 cmp base32.out $(srcdir)/base32.in
a0150d8d
MW
346 @echo "base32 OK"
347
8f45ff6c 348check_PROGRAMS += base32.t
a0150d8d
MW
349base32_t_SOURCES = base32.c
350base32_t_CPPFLAGS = $(TEST_CPPFLAGS)
351base32_t_LDFLAGS = -static
352
353## hex
354pkginclude_HEADERS += hex.h
355libmLib_la_SOURCES += hex.c
4aee39a1 356LIBMANS += hex.3
a0150d8d
MW
357
358EXTRA_DIST += hex.in hex.ref
359CLEANFILES += hex.out
360tests:: hex.t hex.in hex.ref
d5679ed0 361 ./hex.t <$(srcdir)/hex.in >hex.out
362 cmp hex.out $(srcdir)/hex.ref
363 ./hex.t -d <$(srcdir)/hex.ref >hex.out
364 cmp hex.out $(srcdir)/hex.in
a0150d8d
MW
365 @echo "hex OK"
366
8f45ff6c 367check_PROGRAMS += hex.t
a0150d8d
MW
368hex_t_SOURCES = hex.c
369hex_t_CPPFLAGS = $(TEST_CPPFLAGS)
370hex_t_LDFLAGS = -static
371
372###--------------------------------------------------------------------------
373### System utilities.
374
375## Daemons.
376pkginclude_HEADERS += daemonize.h
377libmLib_la_SOURCES += daemonize.c
4aee39a1 378LIBMANS += daemonize.3
a0150d8d
MW
379
380## Environment variables.
381pkginclude_HEADERS += env.h
382libmLib_la_SOURCES += env.c
4aee39a1 383LIBMANS += env.3
a0150d8d
MW
384
385## File and descriptor flags.
386pkginclude_HEADERS += fdflags.h
387libmLib_la_SOURCES += fdflags.c
4aee39a1 388LIBMANS += fdflags.3
a0150d8d
MW
389
390## File descriptor passing.
391pkginclude_HEADERS += fdpass.h
392libmLib_la_SOURCES += fdpass.c
4aee39a1 393LIBMANS += fdpass.3
a0150d8d
MW
394
395## Watching files for modification.
396pkginclude_HEADERS += fwatch.h
397libmLib_la_SOURCES += fwatch.c
4aee39a1 398LIBMANS += fwatch.3
a0150d8d
MW
399
400## File locking.
401pkginclude_HEADERS += lock.h
402libmLib_la_SOURCES += lock.c
4aee39a1 403LIBMANS += lock.3
a0150d8d
MW
404
405## Time arithmetic.
406pkginclude_HEADERS += tv.h
407libmLib_la_SOURCES += tv.c
4aee39a1 408LIBMANS += tv.3
a0150d8d
MW
409
410###--------------------------------------------------------------------------
411### Buffering.
412
413## Line buffering.
414pkginclude_HEADERS += lbuf.h
415libmLib_la_SOURCES += lbuf.c
4aee39a1 416LIBMANS += lbuf.3
a0150d8d
MW
417
418## Packet buffering.
419pkginclude_HEADERS += pkbuf.h
420libmLib_la_SOURCES += pkbuf.c
4aee39a1 421LIBMANS += pkbuf.3
a0150d8d
MW
422
423###--------------------------------------------------------------------------
424### Network utilities.
425
426## Core event selection.
427pkginclude_HEADERS += sel.h
428libmLib_la_SOURCES += sel.c
4aee39a1 429LIBMANS += sel.3
a0150d8d
MW
430
431## Waiting for buffers to fill.
432pkginclude_HEADERS += selbuf.h selpk.h
433libmLib_la_SOURCES += selbuf.c selpk.c
4aee39a1 434LIBMANS += selbuf.3 selpk.3
a0150d8d
MW
435
436## RFC931 identification.
437pkginclude_HEADERS += ident.h
438libmLib_la_SOURCES += ident.c
4aee39a1 439LIBMANS += ident.3
a0150d8d
MW
440
441## Nonblocking connections.
442pkginclude_HEADERS += conn.h
443libmLib_la_SOURCES += conn.c
4aee39a1 444LIBMANS += conn.3
a0150d8d
MW
445
446## Signal handling
447pkginclude_HEADERS += sig.h
448libmLib_la_SOURCES += sig.c
4aee39a1 449LIBMANS += sig.3
a0150d8d
MW
450
451## Name resolution.
452pkginclude_HEADERS += bres.h
4aee39a1 453LIBMANS += bres.3
a0150d8d
MW
454
455if WITH_ADNS
456libmLib_la_SOURCES += bres-adns.c
457else
458libmLib_la_SOURCES += bres.c
459pkglibexec_PROGRAMS += bres
460bres_SOURCES = bres.c
461bres_CPPFLAGS = -DBRES_STANDALONE $(AM_CPPFLAGS)
462bres_LDADD =
463endif
464
465###--------------------------------------------------------------------------
466### Testing and debugging.
467
468## Tracing.
469pkginclude_HEADERS += trace.h
470libmLib_la_SOURCES += trace.c traceopt.c
4aee39a1 471LIBMANS += trace.3
a0150d8d
MW
472
473## Memory tracking.
474pkginclude_HEADERS += track.h
475libmLib_la_SOURCES += track.c
476
477## Testing.
478pkginclude_HEADERS += testrig.h
479libmLib_la_SOURCES += testrig.c
4aee39a1 480LIBMANS += testrig.3
a0150d8d
MW
481
482###--------------------------------------------------------------------------
483### Manual.
484
4aee39a1
MW
485EXTRA_DIST += $(LIBMANS) $(PROGMANS)
486
487install-data-local: install-man
488install-man: $(LIBMANS) $(PROGMANS)
489 @$(NORMAL_INSTALL)
490 $(mkinstalldirs) $(DESTDIR)$(mandir)
491 $(top_srcdir)/config/maninst \
492 -d $(DESTDIR)$(mandir) -s $(srcdir) \
493 -i "$(INSTALL)" \
494 install $(PROGMANS)
495 $(top_srcdir)/config/maninst \
496 -d $(DESTDIR)$(mandir) -s $(srcdir) \
497 -i "$(INSTALL)" -e $(manext) \
498 install $(LIBMANS)
499.PHONY: install-man
500
501uninstall-local: uninstall-man
c3b137c8 502uninstall-man:
4aee39a1
MW
503 @$(NORMAL_UNINSTALL)
504 $(top_srcdir)/config/maninst \
505 -d $(DESTDIR)$(mandir) -s $(srcdir) \
506 uninstall $(PROGMANS)
507 $(top_srcdir)/config/maninst \
508 -d $(DESTDIR)$(mandir) -s $(srcdir) -e $(manext) \
509 uninstall $(LIBMANS)
510.PHONY: uninstall-man
a0150d8d
MW
511
512###--------------------------------------------------------------------------
513### Distribution.
514
515## Release number.
516dist-hook::
517 echo $(VERSION) >$(distdir)/RELEASE
518
519## Additional build tools.
520EXTRA_DIST += config/confsubst
521EXTRA_DIST += config/auto-version
522EXTRA_DIST += config/maninst
523
524###--------------------------------------------------------------------------
525### Debian.
c255a2ee 526
a0150d8d
MW
527## General stuff.
528EXTRA_DIST += debian/rules debian/copyright
529EXTRA_DIST += debian/control debian/changelog
530EXTRA_DIST += debian/mlib2.install
531EXTRA_DIST += debian/mlib2-adns.install
532EXTRA_DIST += debian/mlib-dev.install
533EXTRA_DIST += debian/mlib-bin.install
21c22b5c 534
8f207948 535##----- That's all, folks ---------------------------------------------------