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