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