debian: Replace Debian build system with CDBS.
[mLib] / Makefile.am
CommitLineData
0875b58f 1## -*-Makefile-*-
2##
1c4fa429 3## $Id$
0875b58f 4##
5## Building the distribution
6##
7## (c) 1998 Straylight/Edgeware
8##
9
10##----- Licensing notice ----------------------------------------------------
11##
12## This file is part of the mLib utilities library.
c846879c 13##
0875b58f 14## mLib is free software; you can redistribute it and/or modify
c846879c 15## it under the terms of the GNU Library General Public License as
16## published by the Free Software Foundation; either version 2 of the
17## License, or (at your option) any later version.
d4efbcd9 18##
0875b58f 19## mLib is distributed in the hope that it will be useful,
20## but WITHOUT ANY WARRANTY; without even the implied warranty of
21## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c846879c 22## GNU Library General Public License for more details.
d4efbcd9 23##
c846879c 24## You should have received a copy of the GNU Library General Public
0bd98442 25## License along with mLib; if not, write to the Free
26## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27## MA 02111-1307, USA.
0875b58f 28
0875b58f 29## --- Options ---
30
31AUTOMAKE_OPTIONS = foreign
32
33## --- What to build ---
34
8f207948 35SUBDIRS = man
18756bee 36bin_PROGRAMS = crc-mktab unihash-mkstatic
ae24fcf7 37
c7f30b36 38lib_LTLIBRARIES = libmLib.la
90a332ae 39pkglibexecdir = $(libexecdir)/$(PACKAGE)
14d7100d 40pkglibexec_PROGRAMS = @BRES_LIBEXEC@
e3afa470
MW
41pkgconfigdir = $(libdir)/pkgconfig
42pkgconfig_DATA = mLib.pc
14d7100d 43EXTRA_PROGRAMS = bres
0875b58f 44
64b4afc3 45pkginclude_HEADERS = \
9b5ac6ff 46 align.h alloc.h arena.h bits.h buf.h exc.h macros.h quis.h \
47 report.h sub.h \
c5775f49 48 trace.h track.h unihash.h \
e9184b1e 49 pool.h \
8c685f42 50 atom.h assoc.h darray.h dstr.h dspool.h hash.h sym.h crc32.h \
0683223a 51 daemonize.h versioncmp.h \
ad61a8f8 52 env.h fdflags.h fdpass.h fwatch.h lock.h \
7b979907 53 bres.h conn.h lbuf.h ident.h pkbuf.h sel.h selbuf.h selpk.h sig.h \
54 tv.h \
1c4fa429 55 base64.h base32.h hex.h mdwopt.h str.h testrig.h url.h
0875b58f 56
57## --- Things to put in the library ---
58
3048fcf9 59libmLib_la_LDFLAGS = -version-info 2:5:0
c7f30b36 60## Middle number is the patchlevel. Final number is the minor version. The
61## difference between the first and last numbers is major version.
0875b58f 62
c7f30b36 63libmLib_la_SOURCES = \
9b5ac6ff 64 alloc.c arena.c buf.c exc.c quis.c pquis.c report.c sub.c trace.c \
18756bee 65 traceopt.c track.c \
e9184b1e 66 pool.c pool-file.c pool-sub.c \
9b5ac6ff 67 atom.c assoc.c buf-dstr.c darray.c dstr.c dputf.c dspool.c hash.c \
68 sym.c \
8c685f42 69 crc32.c crc32-tab.c \
18756bee 70 unihash.c unihash-global.c \
0683223a 71 daemonize.c versioncmp.c \
ad61a8f8 72 env.c fdflags.c fdpass.c fwatch.c lock.c \
14d7100d 73 @BRES_SOURCE@.c \
74 conn.c lbuf.c ident.c pkbuf.c sel.c selbuf.c selpk.c sig.c \
7b979907 75 tv.c \
1c4fa429 76 base64.c base32.c hex.c mdwopt.c str.c testrig.c url.c
14d7100d 77EXTRA_libmLib_la_SOURCES = bres.c bres-adns.c
78libmLib_la_LIBADD = @DEPLIBS@
8f207948 79
18756bee 80BUILT_SOURCES = crc32-tab.c unihash-global.c
b7580524 81
1a6043f9 82crc32-tab.c: crc-mktab$(EXEEXT)
b7580524 83 ./crc-mktab \
84 -p0x04c11db7 -b32 -B8 -r \
75721625 85 -c -scrc32_table -icrc32.h -tuint32 -ocrc32-tab.c.new
86 mv crc32-tab.c.new crc32-tab.c
b7580524 87
1a6043f9 88unihash-global.c: unihash-mkstatic$(EXEEXT)
18756bee 89 ./unihash-mkstatic \
90 -c -sunihash_global -iunihash.h -ounihash-global.c.new
91 mv unihash-global.c.new unihash-global.c
92
93crc_mktab_SOURCES = \
94 crc-mktab.c \
95 mdwopt.c quis.c pquis.c report.c str.c
d6cf7c44 96crc_mktab_CFLAGS = $(AM_CFLAGS)
18756bee 97unihash_mkstatic_SOURCES = \
98 unihash-mkstatic.c \
99 mdwopt.c quis.c pquis.c report.c str.c unihash.c
d6cf7c44 100unihash_mkstatic_CFLAGS = $(AM_CFLAGS)
b7580524 101
21c22b5c 102## --- Test code ---
103
3048fcf9 104noinst_PROGRAMS = da.t sym.t assoc.t bits.t versioncmp.t
d04f4733 105
106check: \
573eadb5 107 da.test sym.test assoc.test bits.test base64.test hex.test \
3048fcf9 108 base32.test versioncmp.test \
573eadb5 109 unihash.test
d04f4733 110
111da_t_SOURCES = da-test.c
112da_t_LDADD = libmLib.la
113da_t_LDFLAGS = -static
114da.in: $(srcdir)/da-gtest
c5775f49 115 perl $(srcdir)/da-gtest 10000 >da.in.new
116 mv da.in.new da.in
d04f4733 117da.ref: da.in $(srcdir)/da-ref
c5775f49 118 perl $(srcdir)/da-ref <da.in >da.ref.new
119 mv da.ref.new da.ref
d04f4733 120da.test: da.t da.in da.ref
d5679ed0 121 ./da.t <da.in >da.out
122 cmp da.out da.ref
21c22b5c 123 @echo "darray tested OK."
124
d04f4733 125sym_t_SOURCES = sym-test.c
126sym_t_LDADD = libmLib.la
127sym_t_LDFLAGS = -static
128sym.in: $(srcdir)/sym-gtest
c5775f49 129 perl $(srcdir)/sym-gtest 10000 >sym.in.new
130 mv sym.in.new sym.in
d04f4733 131sym.ref: sym.in $(srcdir)/sym-ref
c5775f49 132 perl $(srcdir)/sym-ref <sym.in >sym.ref.new
133 mv sym.ref.new sym.ref
d04f4733 134sym.test: sym.t sym.in sym.ref
d5679ed0 135 ./sym.t <sym.in >sym.out
136 cmp sym.out sym.ref
21c22b5c 137 @echo "sym tested OK."
138
d04f4733 139assoc_t_SOURCES = assoc-test.c
140assoc_t_LDADD = libmLib.la
141assoc_t_LDFLAGS = -static
142assoc.test: assoc.t sym.in sym.ref
d5679ed0 143 ./assoc.t <sym.in >assoc.out
144 cmp assoc.out sym.ref
5c5bbeb9 145 @echo "assoc tested OK."
146
e9184b1e 147bits_t_SOURCES = bits.c
c8e26384 148bits_t_LDADD = libmLib.la
149bits_t_LDFLAGS = -static
cb114820 150bits.o: bits.c
90a332ae 151 $(COMPILE) -c -DSRCDIR="\"$(srcdir)\"" $(srcdir)/bits.c -o bits.o
d5679ed0 152bits.test: bits.t
153 ./bits.t -f $(srcdir)/bits.in
154
3048fcf9
MW
155versioncmp_t_SOURCES = versioncmp-test.c
156versioncmp_t_LDADD = libmLib.la
157versioncmp_t_LDFLAGS = -static
158versioncmp-test.o: versioncmp-test.c
159 $(COMPILE) -c -DSRCDIR="\"$(srcdir)\"" $(srcdir)/versioncmp-test.c -o $@
160versioncmp.test: versioncmp.t
161 ./versioncmp.t -f $(srcdir)/versioncmp.in
162
d5679ed0 163base64.to: base64.c
573eadb5 164 $(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" \
165 $(srcdir)/base64.c -o base64.to
d5679ed0 166base64.t: base64.to base64.o libmLib.la
573eadb5 167 $(CC) $(CFLAGS) $(LDFLAGS) \
168 base64.to .libs/libmLib.a $(LIBS) -o base64.t
d5679ed0 169base64.test: base64.t base64.in base64.ref
170 ./base64.t <$(srcdir)/base64.in >base64.out
171 cmp base64.out $(srcdir)/base64.ref
172 ./base64.t -d <$(srcdir)/base64.ref >base64.out
173 cmp base64.out $(srcdir)/base64.in
174 @echo "base64 tested OK."
175
1c4fa429 176base32.to: base32.c
177 $(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" \
178 $(srcdir)/base32.c -o base32.to
179base32.t: base32.to base32.o libmLib.la
180 $(CC) $(CFLAGS) $(LDFLAGS) \
181 base32.to .libs/libmLib.a $(LIBS) -o base32.t
182base32.test: base32.t base32.in base32.ref
183 ./base32.t <$(srcdir)/base32.in >base32.out
184 cmp base32.out $(srcdir)/base32.ref
185 ./base32.t -d <$(srcdir)/base32.ref >base32.out
186 cmp base32.out $(srcdir)/base32.in
187 @echo "base32 tested OK."
188
d5679ed0 189hex.to: hex.c
573eadb5 190 $(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" \
191 $(srcdir)/hex.c -o hex.to
d5679ed0 192hex.t: hex.to hex.o libmLib.la
573eadb5 193 $(CC) $(CFLAGS) $(LDFLAGS) \
194 hex.to .libs/libmLib.a $(LIBS) -o hex.t
d5679ed0 195hex.test: hex.t hex.in hex.ref
196 ./hex.t <$(srcdir)/hex.in >hex.out
197 cmp hex.out $(srcdir)/hex.ref
198 ./hex.t -d <$(srcdir)/hex.ref >hex.out
199 cmp hex.out $(srcdir)/hex.in
200 @echo "hex tested OK."
e9184b1e 201
573eadb5 202unihash.to: unihash.c
203 $(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" \
204 $(srcdir)/unihash.c -o unihash.to
205unihash.t: unihash.to libmLib.la
206 $(CC) $(CFLAGS) $(LDFLAGS) \
207 unihash.to .libs/libmLib.a $(LIBS) -o unihash.t
208unihash.in: unihash-check.pl
209 perl $(srcdir)/unihash-check.pl >unihash.in.new
3cbb08ea 210 mv unihash.in.new $(srcdir)/unihash.in
573eadb5 211unihash.test: unihash.t unihash.in
3cbb08ea 212 ./unihash.t -f $(srcdir)/unihash.in
573eadb5 213
21c22b5c 214TEST_CLEAN = \
1ecb4530 215 *.t *.to assoc.out \
d5679ed0 216 da.in da.ref da.out \
217 sym.in sym.ref sym.out \
1c4fa429 218 base64.out base32.out hex.out unihash.in
21c22b5c 219
220TEST_DIST = \
221 da-gtest da-ref \
e9184b1e 222 sym-gtest sym-ref \
d5679ed0 223 bits.in bits-testgen.c \
3cbb08ea 224 unihash-check.pl unihash.in \
937fe910 225 versioncmp.in \
1c4fa429 226 base64.in base64.ref base32.in base32.ref hex.in hex.ref
21c22b5c 227
891a96e4 228## --- Background resolver ---
229##
230## I must (a) build the standalone version, and (b) inform the client library
231## where the standalone version is.
232
d6cf7c44 233bres_SOURCES = bres.c
234bres_CFLAGS = -DBRES_STANDALONE
891a96e4 235
c7f30b36 236bres.lo: $(srcdir)/bres.c
90a332ae 237 $(LTCOMPILE) -c -DBRES_SERVER="\"$(libexecdir)/$(PACKAGE)/`echo bres|sed '$(transform)'`\"" $(srcdir)/bres.c
891a96e4 238
239## --- Other useful rules ---
c255a2ee 240
241install-man:
a9f61b5f 242 (cd man && $(MAKE) install-man)
c3b137c8 243uninstall-man:
244 (cd man && $(MAKE) uninstall-man)
c255a2ee 245
1ecb4530 246CLEANFILES = $(TEST_CLEAN) crc32-tab.c unihash-global.c
58084d9f 247DISTCLEANFILES = libtool
471f9daa 248EXTRA_DIST = \
e57e2b62 249 $(TEST_DIST) config/maninst \
75721625 250 debian/rules debian/copyright debian/control debian/changelog
21c22b5c 251
8f207948 252##----- That's all, folks ---------------------------------------------------