-## -*-Makefile-*-
-##
-## $Id$
-##
-## Building the distribution
-##
-## (c) 1998 Straylight/Edgeware
-##
-
-##----- Licensing notice ----------------------------------------------------
-##
-## This file is part of the mLib utilities library.
-##
-## mLib is free software; you can redistribute it and/or modify
-## it under the terms of the GNU Library General Public License as
-## published by the Free Software Foundation; either version 2 of the
-## License, or (at your option) any later version.
-##
-## mLib is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Library General Public License for more details.
-##
-## You should have received a copy of the GNU Library General Public
-## License along with mLib; if not, write to the Free
-## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-## MA 02111-1307, USA.
-
-## --- Options ---
-
-AUTOMAKE_OPTIONS = foreign
-
-## --- What to build ---
-
-SUBDIRS = man
-
-bin_SCRIPTS = mLib-config
-bin_PROGRAMS = crc-mktab unihash-mkstatic
-
-lib_LTLIBRARIES = libmLib.la
-pkglibexecdir = $(libexecdir)/$(PACKAGE)
-pkglibexec_PROGRAMS = @BRES_LIBEXEC@
-EXTRA_PROGRAMS = bres
-
-pkginclude_HEADERS = \
- align.h alloc.h arena.h bits.h exc.h macros.h quis.h report.h sub.h \
- trace.h track.h unihash.h \
- pool.h \
- atom.h assoc.h darray.h dstr.h dspool.h hash.h sym.h crc32.h \
- env.h fdflags.h fdpass.h fwatch.h lock.h \
- bres.h conn.h lbuf.h ident.h pkbuf.h sel.h selbuf.h selpk.h sig.h \
- tv.h \
- base64.h base32.h hex.h mdwopt.h str.h testrig.h url.h
-
-## --- Things to put in the library ---
-
-libmLib_la_LDFLAGS = -version-info 2:3:0
-## Middle number is the patchlevel. Final number is the minor version. The
-## difference between the first and last numbers is major version.
-
-libmLib_la_SOURCES = \
- alloc.c arena.c exc.c quis.c pquis.c report.c sub.c trace.c \
- traceopt.c track.c \
- pool.c pool-file.c pool-sub.c \
- atom.c assoc.c darray.c dstr.c dputf.c dspool.c hash.c sym.c \
- crc32.c crc32-tab.c \
- unihash.c unihash-global.c \
- env.c fdflags.c fdpass.c fwatch.c lock.c \
- @BRES_SOURCE@.c \
- conn.c lbuf.c ident.c pkbuf.c sel.c selbuf.c selpk.c sig.c \
- tv.c \
- base64.c base32.c hex.c mdwopt.c str.c testrig.c url.c
-EXTRA_libmLib_la_SOURCES = bres.c bres-adns.c
-libmLib_la_LIBADD = @DEPLIBS@
-
-BUILT_SOURCES = crc32-tab.c unihash-global.c
-
-crc32-tab.c: crc-mktab
- ./crc-mktab \
- -p0x04c11db7 -b32 -B8 -r \
- -c -scrc32_table -icrc32.h -tuint32 -ocrc32-tab.c.new
- mv crc32-tab.c.new crc32-tab.c
-
-unihash-global.c: unihash-mkstatic
- ./unihash-mkstatic \
- -c -sunihash_global -iunihash.h -ounihash-global.c.new
- mv unihash-global.c.new unihash-global.c
-
-crc_mktab_SOURCES = \
- crc-mktab.c \
- mdwopt.c quis.c pquis.c report.c str.c
-unihash_mkstatic_SOURCES = \
- unihash-mkstatic.c \
- mdwopt.c quis.c pquis.c report.c str.c unihash.c
-
-## --- Test code ---
-
-noinst_PROGRAMS = da.t sym.t assoc.t bits.t
-
-check: \
- da.test sym.test assoc.test bits.test base64.test hex.test \
- base32.test \
- unihash.test
-
-da_t_SOURCES = da-test.c
-da_t_LDADD = libmLib.la
-da_t_LDFLAGS = -static
-da.in: $(srcdir)/da-gtest
- perl $(srcdir)/da-gtest 10000 >da.in.new
- mv da.in.new da.in
-da.ref: da.in $(srcdir)/da-ref
- perl $(srcdir)/da-ref <da.in >da.ref.new
- mv da.ref.new da.ref
-da.test: da.t da.in da.ref
- ./da.t <da.in >da.out
+### -*-Makefile-*-
+###
+### Building the distribution
+###
+### (c) 1998 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the mLib utilities library.
+###
+### mLib is free software; you can redistribute it and/or modify
+### it under the terms of the GNU Library General Public License as
+### published by the Free Software Foundation; either version 2 of the
+### License, or (at your option) any later version.
+###
+### mLib is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU Library General Public License for more details.
+###
+### You should have received a copy of the GNU Library General Public
+### License along with mLib; if not, write to the Free
+### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+### MA 02111-1307, USA.
+
+pkglibexecdir = $(libexecdir)/$(PACKAGE)
+
+SUBDIRS =
+BUILT_SOURCES =
+bin_PROGRAMS =
+check_PROGRAMS =
+lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
+pkglibexec_PROGRAMS =
+pkginclude_HEADERS =
+EXTRA_DIST =
+CLEANFILES =
+DISTCLEANFILES =
+PROGMANS =
+LIBMANS =
+
+confsubst = $(top_srcdir)/config/confsubst
+
+SUBSTITUTIONS = \
+ prefix=$(prefix) exec_prefix=$(exec_prefix) \
+ libdir=$(libdir) includedir=$(includedir) \
+ bindir=$(bindir) sbindir=$(sbindir) \
+ PACKAGE=$(PACKAGE) VERSION=$(VERSION)
+
+###--------------------------------------------------------------------------
+### Library.
+
+lib_LTLIBRARIES += libmLib.la
+libmLib_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO)
+libmLib_la_SOURCES =
+libmLib_la_LIBADD =
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = mLib.pc
+EXTRA_DIST += mLib.pc.in
+CLEANFILES += mLib.pc
+
+mLib.pc: mLib.pc.in Makefile
+ $(confsubst) $(srcdir)/mLib.pc.in >$@.new $(SUBSTITUTIONS) && \
+ mv $@.new $@
+
+###--------------------------------------------------------------------------
+### Testing.
+
+check: tests
+.PHONY: check tests
+
+TEST_CPPFLAGS = -DTEST_RIG -DSRCDIR="\"(srcdir)\"" $(AM_CPPFLAGS)
+
+LDADD = libmLib.la
+
+###--------------------------------------------------------------------------
+### Utilities.
+
+noinst_LTLIBRARIES += libutils.la
+libutils_la_SOURCES =
+libutils_la_LIBADD =
+libmLib_la_LIBADD += libutils.la
+
+## Utility macros.
+pkginclude_HEADERS += macros.h
+LIBMANS += macros.3
+
+## Alignment.
+pkginclude_HEADERS += align.h
+
+## Bit manipulation.
+pkginclude_HEADERS += bits.h
+LIBMANS += bits.3
+
+EXTRA_DIST += bits.in bits-testgen.c
+tests:: bits.t bits.in
+ ./bits.t -f $(srcdir)/bits.in
+
+check_PROGRAMS += bits.t
+bits_t_SOURCES = bits.c
+bits_t_CPPFLAGS = $(TEST_CPPFLAGS)
+bits_t_LDFLAGS = -static
+
+## Exceptions.
+pkginclude_HEADERS += exc.h
+libmLib_la_SOURCES += exc.c
+LIBMANS += exc.3
+
+## String handling.
+pkginclude_HEADERS += str.h
+libutils_la_SOURCES += str.c
+LIBMANS += str.3
+
+## Version comparison.
+pkginclude_HEADERS += versioncmp.h
+libmLib_la_SOURCES += versioncmp.c
+LIBMANS += versioncmp.3
+
+EXTRA_DIST += versioncmp.in
+tests:: versioncmp.t versioncmp.in
+ ./versioncmp.t -f $(srcdir)/versioncmp.in
+
+check_PROGRAMS += versioncmp.t
+versioncmp_t_SOURCES = versioncmp-test.c
+versioncmp_t_CPPFLAGS = $(TEST_CPPFLAGS)
+versioncmp_t_LDFLAGS = -static
+
+###--------------------------------------------------------------------------
+### Memory allocation.
+
+## Memory allocation.
+pkginclude_HEADERS += alloc.h arena.h sub.h
+libmLib_la_SOURCES += alloc.c arena.c sub.c
+LIBMANS += alloc.3 arena.3 sub.3
+
+## Pool allocator.
+pkginclude_HEADERS += pool.h
+libmLib_la_SOURCES += pool.c pool-file.c pool-sub.c
+LIBMANS += pool.3
+
+###--------------------------------------------------------------------------
+### Hashing.
+
+## CRC32.
+pkginclude_HEADERS += crc32.h
+libmLib_la_SOURCES += crc32.c crc32-tab.c
+LIBMANS += crc32.3
+
+bin_PROGRAMS += crc-mktab
+crc_mktab_SOURCES = crc-mktab.c $(UTIL_SOURCES)
+crc_mktab_LDADD = libutils.la
+PROGMANS += crc-mktab.1
+
+BUILT_SOURCES += crc32-tab.c
+CLEANFILES += crc32-tab.c
+crc32-tab.c: crc-mktab$(EXEEXT)
+ ./crc-mktab -o $@.new \
+ -p0x04c11db7 -b32 -B8 -r -c \
+ -scrc32_table -icrc32.h -tuint32 && \
+ mv $@.new $@
+
+## Universal hashing.
+pkginclude_HEADERS += unihash.h
+libutils_la_SOURCES += unihash.c
+libmLib_la_SOURCES += unihash-global.c
+BUILT_SOURCES += unihash-global.c
+LIBMANS += unihash.3
+
+bin_PROGRAMS += unihash-mkstatic
+unihash_mkstatic_SOURCES = unihash-mkstatic.c
+unihash_mkstatic_LDADD = libutils.la
+PROGMANS += unihash-mkstatic.1
+
+BUILT_SOURCES += unihash-global.c
+CLEANFILES += unihash-global.c
+unihash-global.c: unihash-mkstatic$(EXEEXT)
+ ./unihash-mkstatic -c -sunihash_global -iunihash.h -o$@.new && \
+ mv $@.new $@
+
+check_PROGRAMS += unihash.t
+unihash_t_SOURCES = unihash.c
+unihash_t_CPPFLAGS = $(TEST_CPPFLAGS)
+unihash_t_LDFLAGS = -static
+
+tests:: unihash.t unihash.in
+ ./unihash.t -f unihash.in
+
+EXTRA_DIST += unihash-check.pl
+CLEANFILES += unihash.in
+unihash.in: unihash-check.pl
+ perl $(srcdir)/unihash-check.pl >$@.new && mv $@.new $@
+
+###--------------------------------------------------------------------------
+### Data structures.
+
+## Dynamic strings.
+pkginclude_HEADERS += dstr.h dspool.h
+libmLib_la_SOURCES += dstr.c dputf.c dspool.c
+LIBMANS += dstr.3 dspool.3
+
+## Buffers.
+pkginclude_HEADERS += buf.h
+libmLib_la_SOURCES += buf.c buf-dstr.c
+LIBMANS += buf.3
+
+## Dynamic arrays.
+pkginclude_HEADERS += darray.h
+libmLib_la_SOURCES += darray.c
+LIBMANS += darray.3
+
+CLEANFILES += da.out
+tests:: darray.t da.in da.ref
+ ./darray.t <da.in >da.out