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