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