]> eyrie.org Git - kerberos/krb5-strength.git/blob - Makefile.am
Merge branch 'debian' into squeeze
[kerberos/krb5-strength.git] / Makefile.am
1 # Automake makefile for krb5-strength.
2 #
3 # Written by Russ Allbery <eagle@eyrie.org>
4 # Copyright 2007, 2009, 2010, 2012, 2013, 2014
5 #     The Board of Trustees of the Leland Stanford Junior University
6 #
7 # See LICENSE for licensing terms.
8
9 ACLOCAL_AMFLAGS = -I m4
10 EXTRA_DIST = .gitignore LICENSE autogen cracklib/HISTORY cracklib/LICENCE  \
11         cracklib/README cracklib/genrules.pl cracklib/mkdict tests/HOWTO   \
12         tests/TESTS tests/data/krb5.conf tests/data/make-krb5-conf         \
13         tests/data/passwords tests/data/perl.conf tests/data/perlcriticrc  \
14         tests/data/perltidyrc tests/data/valgrind.supp tests/data/wordlist \
15         tests/data/wordlist.cdb tests/data/wordlist.sqlite                 \
16         tests/docs/pod-spelling-t tests/docs/pod-t tests/perl/critic-t     \
17         tests/perl/minimum-version-t tests/perl/strict-t                   \
18         tests/tap/libtap.sh tests/tap/perl/Test/RRA.pm                     \
19         tests/tap/perl/Test/RRA/Config.pm                                  \
20         tests/tap/perl/Test/RRA/Automake.pm tests/tools/heimdal-history-t  \
21         tests/tools/heimdal-strength-t tests/tools/wordlist-cdb-t          \
22         tests/tools/wordlist-sqlite-t tests/tools/wordlist-t               \
23         tests/util/xmalloc-t tools/heimdal-strength.pod
24
25 # Do this globally.  Everything needs to find the Kerberos headers and
26 # libraries, and if we're using the system CrackLib, TinyCDB, or SQLite, add
27 # its location unconditionally as well.
28 AM_CPPFLAGS = $(CRACKLIB_CPPFLAGS) $(KRB5_CPPFLAGS) $(CDB_CPPFLAGS) \
29         $(SQLITE_CPPFLAGS)
30 AM_LDFLAGS = $(CRACKLIB_LDFLAGS) $(KRB5_LDFLAGS) $(CDB_LDFLAGS) \
31         $(SQLITE_LDFLAGS)
32
33 # Build our portability library.
34 noinst_LTLIBRARIES = portable/libportable.la
35 portable_libportable_la_SOURCES = portable/dummy.c portable/kadmin.h    \
36         portable/krb5.h portable/macros.h portable/stdbool.h            \
37         portable/system.h
38 portable_libportable_la_LIBADD = $(LTLIBOBJS)
39
40 # Build our command-line utility library.
41 noinst_LIBRARIES = util/libutil.a
42 util_libutil_a_SOURCES = util/macros.h util/messages-krb5.c                 \
43         util/messages-krb5.h util/messages.c util/messages.h util/xmalloc.c \
44         util/xmalloc.h
45
46 # If we're building with the embedded cracklib, build cracklib as a helper
47 # library and build (but don't install) the packer program.
48 cracklib_libcracklib_la_SOURCES = cracklib/fascist.c cracklib/packlib.c \
49         cracklib/rules.c cracklib/stringlib.c
50 cracklib_libcracklib_la_CPPFLAGS = -DIN_CRACKLIB
51 cracklib_packer_SOURCES = cracklib/packer.c cracklib/packer.h
52 cracklib_packer_LDADD = cracklib/libcracklib.la
53 if EMBEDDED_CRACKLIB
54     noinst_LTLIBRARIES += cracklib/libcracklib.la
55 endif
56
57 # Put the plugin into $(libdir)/krb5/plugins/pwqual by default,
58 moduledir = $(libdir)/krb5/plugins/pwqual
59
60 # Rules for building the password strength plugin.
61 module_LTLIBRARIES = plugin/strength.la
62 plugin_strength_la_SOURCES = plugin/cdb.c plugin/classes.c plugin/config.c \
63         plugin/cracklib.c plugin/error.c plugin/general.c plugin/heimdal.c \
64         plugin/internal.h plugin/mit.c plugin/principal.c plugin/sqlite.c  \
65         plugin/vector.c
66 plugin_strength_la_LDFLAGS = -module -avoid-version
67 if EMBEDDED_CRACKLIB
68     plugin_strength_la_LIBADD = cracklib/libcracklib.la
69 else
70     plugin_strength_la_LIBADD = $(CRACKLIB_LIBS)
71 endif
72 plugin_strength_la_LIBADD += portable/libportable.la $(KRB5_LIBS) \
73         $(CDB_LIBS) $(SQLITE_LIBS)
74
75 # The Heimdal external check program.
76 bin_PROGRAMS = tools/heimdal-strength
77 tools_heimdal_strength_CFLAGS = $(AM_CFLAGS)
78 tools_heimdal_strength_SOURCES = plugin/cdb.c plugin/classes.c            \
79         plugin/config.c plugin/cracklib.c plugin/error.c plugin/general.c \
80         plugin/internal.h plugin/principal.c plugin/sqlite.c              \
81         plugin/vector.c tools/heimdal-strength.c
82 if EMBEDDED_CRACKLIB
83     tools_heimdal_strength_LDADD = cracklib/libcracklib.la
84 else
85     tools_heimdal_strength_LDADD = $(CRACKLIB_LIBS)
86 endif
87 tools_heimdal_strength_LDADD += util/libutil.a portable/libportable.la \
88         $(KRB5_LIBS) $(CDB_LIBS) $(SQLITE_LIBS)
89
90 # Other tools.
91 dist_bin_SCRIPTS = tools/heimdal-history tools/krb5-strength-wordlist
92
93 # Man pages for all tools.
94 dist_man_MANS = tools/heimdal-history.1 tools/heimdal-strength.1 \
95         tools/krb5-strength-wordlist.1
96
97 # Handle the standard stuff that make maintainer-clean should probably remove
98 # but doesn't.  This breaks the GNU coding standard, but in this area the GNU
99 # coding standard is dumb.
100 CLEANFILES = tests/data/dictionary.hwm tests/data/dictionary.pwd \
101         tests/data/dictionary.pwi
102 DISTCLEANFILES = tests/data/.placeholder
103 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile          \
104         build-aux/config.guess build-aux/config.sub build-aux/depcomp    \
105         build-aux/install-sh build-aux/ltmain.sh build-aux/missing       \
106         config.h.in config.h.in~ configure m4/libtool.m4 m4/ltoptions.m4 \
107         m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4                  \
108         tests/data/wordlist.cdb tests/data/wordlist.sqlite               \
109         tools/heimdal-history.1 tools/heimdal-strength.1                 \
110         tools/krb5-strength-wordlist.1
111
112 # Also remove the generated *.c files from our JSON test data on
113 # maintainer-clean.
114 maintainer-clean-local:
115         rm -f tests/data/passwords/*.c
116
117 # A set of flags for warnings.  Add -O because gcc won't find some warnings
118 # without optimization turned on.  Desirable warnings that can't be turned
119 # on due to other problems:
120 #
121 #     -Wconversion      http://bugs.debian.org/488884 (htons warnings)
122 #
123 # Last checked against gcc 4.7.2 (2013-04-22).  -D_FORTIFY_SOURCE=2 enables
124 # warn_unused_result attribute markings on glibc functions on Linux, which
125 # catches a few more issues.
126 WARNINGS = -g -O -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wendif-labels          \
127         -Wformat=2 -Winit-self -Wswitch-enum -Wuninitialized -Wfloat-equal \
128         -Wdeclaration-after-statement -Wshadow -Wpointer-arith             \
129         -Wbad-function-cast -Wcast-align -Wwrite-strings                   \
130         -Wjump-misses-init -Wlogical-op -Wstrict-prototypes                \
131         -Wold-style-definition -Wmissing-prototypes -Wnormalized=nfc       \
132         -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wvla -Werror
133
134 warnings:
135         $(MAKE) V=0 CFLAGS='$(WARNINGS)'
136         $(MAKE) V=0 CFLAGS='$(WARNINGS)' $(check_PROGRAMS)
137
138 # The bits below are for the test suite, not for the main package.
139 check_PROGRAMS = tests/runtests tests/plugin/heimdal-t tests/plugin/mit-t   \
140         tests/portable/asprintf-t tests/portable/mkstemp-t                  \
141         tests/portable/snprintf-t tests/portable/strndup-t                  \
142         tests/util/messages-krb5-t tests/util/messages-t tests/util/xmalloc
143 if EMBEDDED_CRACKLIB
144     check_PROGRAMS += cracklib/packer
145 endif
146 tests_runtests_CPPFLAGS = -DSOURCE='"$(abs_top_srcdir)/tests"' \
147         -DBUILD='"$(abs_top_builddir)/tests"'
148 check_LIBRARIES = tests/tap/libtap.a
149 tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/tests $(KRB5_CPPFLAGS)
150 tests_tap_libtap_a_SOURCES = tests/tap/basic.c tests/tap/basic.h        \
151         tests/tap/kerberos.c tests/tap/kerberos.h tests/tap/macros.h    \
152         tests/tap/process.c tests/tap/process.h tests/tap/string.c      \
153         tests/tap/string.h
154
155 # The actual test programs.
156 tests_plugin_heimdal_t_CPPFLAGS = $(KRB5_CPPFLAGS)
157 tests_plugin_heimdal_t_LDADD = tests/tap/libtap.a portable/libportable.la \
158         $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
159 tests_plugin_mit_t_CPPFLAGS = $(KRB5_CPPFLAGS)
160 tests_plugin_mit_t_LDADD = tests/tap/libtap.a portable/libportable.la \
161         $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
162 tests_portable_asprintf_t_SOURCES = tests/portable/asprintf-t.c \
163         tests/portable/asprintf.c
164 tests_portable_asprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
165 tests_portable_mkstemp_t_SOURCES = tests/portable/mkstemp-t.c \
166         tests/portable/mkstemp.c
167 tests_portable_mkstemp_t_LDADD = tests/tap/libtap.a portable/libportable.la
168 tests_portable_snprintf_t_SOURCES = tests/portable/snprintf-t.c \
169         tests/portable/snprintf.c
170 tests_portable_snprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
171 tests_portable_strndup_t_SOURCES = tests/portable/strndup-t.c \
172         tests/portable/strndup.c
173 tests_portable_strndup_t_LDADD = tests/tap/libtap.a portable/libportable.la
174 tests_util_messages_t_LDADD = tests/tap/libtap.a util/libutil.a \
175         portable/libportable.la
176 tests_util_messages_krb5_t_LDADD = tests/tap/libtap.a util/libutil.a \
177         portable/libportable.la $(KRB5_LIBS)
178 tests_util_xmalloc_LDADD = util/libutil.a portable/libportable.la
179
180 # The dictionary is used by the tests and needs to be built first.
181 if EMBEDDED_CRACKLIB
182 tests/data/dictionary.pwd: cracklib/packer $(srcdir)/cracklib/mkdict \
183                 $(srcdir)/tests/data/wordlist
184         mkdir -p tests/data
185         $(srcdir)/cracklib/mkdict $(srcdir)/tests/data/wordlist \
186             | cracklib/packer tests/data/dictionary
187 else
188 tests/data/dictionary.pwd: $(srcdir)/tests/data/wordlist
189         mkdir -p tests/data
190         cracklib-format $(srcdir)/tests/data/wordlist \
191             | cracklib-packer tests/data/dictionary
192 endif
193
194 check-local: $(check_PROGRAMS) tests/data/dictionary.pwd
195         cd tests && ./runtests -l $(abs_top_srcdir)/tests/TESTS
196
197 # Used by maintainers to run the main test suite under valgrind.  Suppress
198 # the xmalloc and pod-spelling tests because the former won't work properly
199 # under valgrind (due to increased memory usage) and the latter is pointless
200 # to run under valgrind.  Don't try to trace several of the tests that are
201 # written in Perl or shell and test Perl programs.
202 check-valgrind: $(check_PROGRAMS) tests/data/dictionary.pwd
203         rm -rf $(abs_top_builddir)/tmp-valgrind
204         mkdir $(abs_top_builddir)/tmp-valgrind
205         env RRA_MAINTAINER_TESTS= valgrind --leak-check=full            \
206             --show-reachable=yes --trace-children=yes                   \
207             --log-file=$(abs_top_builddir)/tmp-valgrind/log.%p          \
208             --suppressions=$(abs_top_srcdir)/tests/data/valgrind.supp   \
209             --trace-children-skip="/bin/sh,*/cat,*/diff,*/expr,*/grep,*/mkdir,*/rm,*/rmdir,*/sed,*/sleep,*/true,*/wc,*/docs/*-t,*/perl/*-t,*/data/make-krb5-conf,*/tools/heimdal-history-t,*/tools/wordlist*-t" \
210             tests/runtests -l '$(abs_top_srcdir)/tests/TESTS'