]> eyrie.org Git - kerberos/krb5-strength.git/blob - Makefile.am
Add DocKnot metadata and regenerate README
[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 docs/krb5-strength.5.in tests/HOWTO tests/TESTS     \
14         tests/data/krb5.conf tests/data/make-krb5-conf tests/data/passwords \
15         tests/data/perl.conf 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 man_MANS = docs/krb5-strength.5
99
100 # Substitute the installation paths into the manual page.
101 docs/krb5-strength.5: $(srcdir)/docs/krb5-strength.5.in
102         [ -d docs ] || mkdir docs
103         sed -e 's%\(\\f(CI\)*\@moduledir\(\\fI\)*\@%$(moduledir)%' \
104             < $(srcdir)/docs/krb5-strength.5.in > $@
105
106 # Handle the standard stuff that make maintainer-clean should probably remove
107 # but doesn't.  This breaks the GNU coding standard, but in this area the GNU
108 # coding standard is dumb.
109 CLEANFILES = docs/krb5-strength.5 tests/data/dictionary.hwm \
110         tests/data/dictionary.pwd tests/data/dictionary.pwi
111 DISTCLEANFILES = tests/data/.placeholder
112 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile         \
113         build-aux/config.guess build-aux/config.sub build-aux/depcomp   \
114         build-aux/install-sh build-aux/ltmain.sh build-aux/missing      \
115         config.h.in config.h.in~ configure docs/krb5-strength.5.in      \
116         m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4     \
117         m4/lt~obsolete.m4 tests/data/wordlist.cdb                       \
118         tests/data/wordlist.sqlite tools/heimdal-history.1              \
119         tools/heimdal-strength.1 tools/krb5-strength-wordlist.1
120
121 # Also remove the generated *.c files from our JSON test data on
122 # maintainer-clean.
123 maintainer-clean-local:
124         rm -f tests/data/passwords/*.c
125
126 warnings:
127         $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
128             KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)'
129         $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
130             KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)' $(check_PROGRAMS)
131
132 # The bits below are for the test suite, not for the main package.
133 check_PROGRAMS = tests/runtests tests/plugin/heimdal-t tests/plugin/mit-t \
134         tests/portable/asprintf-t tests/portable/mkstemp-t                \
135         tests/portable/reallocarray-t tests/portable/snprintf-t           \
136         tests/portable/strndup-t tests/util/messages-krb5-t               \
137         tests/util/messages-t tests/util/xmalloc
138 if EMBEDDED_CRACKLIB
139     check_PROGRAMS += cracklib/packer
140 endif
141 tests_runtests_CPPFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \
142         -DC_TAP_BUILD='"$(abs_top_builddir)/tests"'
143 check_LIBRARIES = tests/tap/libtap.a
144 tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/tests $(KRB5_CPPFLAGS)
145 tests_tap_libtap_a_SOURCES = tests/tap/basic.c tests/tap/basic.h        \
146         tests/tap/kerberos.c tests/tap/kerberos.h tests/tap/macros.h    \
147         tests/tap/process.c tests/tap/process.h tests/tap/string.c      \
148         tests/tap/string.h
149
150 # The actual test programs.
151 tests_plugin_heimdal_t_CPPFLAGS = $(KRB5_CPPFLAGS)
152 tests_plugin_heimdal_t_LDADD = tests/tap/libtap.a portable/libportable.la \
153         $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
154 tests_plugin_mit_t_CPPFLAGS = $(KRB5_CPPFLAGS)
155 tests_plugin_mit_t_LDADD = tests/tap/libtap.a portable/libportable.la \
156         $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
157 tests_portable_asprintf_t_SOURCES = tests/portable/asprintf-t.c \
158         tests/portable/asprintf.c
159 tests_portable_asprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
160 tests_portable_mkstemp_t_SOURCES = tests/portable/mkstemp-t.c \
161         tests/portable/mkstemp.c
162 tests_portable_mkstemp_t_LDADD = tests/tap/libtap.a portable/libportable.la
163 tests_portable_reallocarray_t_SOURCES = tests/portable/reallocarray-t.c \
164         tests/portable/reallocarray.c
165 tests_portable_reallocarray_t_LDADD = tests/tap/libtap.a \
166         portable/libportable.la
167 tests_portable_snprintf_t_SOURCES = tests/portable/snprintf-t.c \
168         tests/portable/snprintf.c
169 tests_portable_snprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
170 tests_portable_strndup_t_SOURCES = tests/portable/strndup-t.c \
171         tests/portable/strndup.c
172 tests_portable_strndup_t_LDADD = tests/tap/libtap.a portable/libportable.la
173 tests_util_messages_t_LDADD = tests/tap/libtap.a util/libutil.a \
174         portable/libportable.la
175 tests_util_messages_krb5_t_LDADD = tests/tap/libtap.a util/libutil.a \
176         portable/libportable.la $(KRB5_LIBS)
177 tests_util_xmalloc_LDADD = util/libutil.a portable/libportable.la
178
179 # The dictionary is used by the tests and needs to be built first.
180 if EMBEDDED_CRACKLIB
181 tests/data/dictionary.pwd: cracklib/packer $(srcdir)/cracklib/mkdict \
182                 $(srcdir)/tests/data/wordlist
183         mkdir -p tests/data
184         $(srcdir)/cracklib/mkdict $(srcdir)/tests/data/wordlist \
185             | cracklib/packer tests/data/dictionary
186 else
187 tests/data/dictionary.pwd: $(srcdir)/tests/data/wordlist
188         mkdir -p tests/data
189         cracklib-format $(srcdir)/tests/data/wordlist \
190             | cracklib-packer tests/data/dictionary
191 endif
192
193 check-local: $(check_PROGRAMS) tests/data/dictionary.pwd
194         cd tests && ./runtests -l $(abs_top_srcdir)/tests/TESTS
195
196 # Used by maintainers to run the main test suite under valgrind.  Suppress
197 # the xmalloc and pod-spelling tests because the former won't work properly
198 # under valgrind (due to increased memory usage) and the latter is pointless
199 # to run under valgrind.  Don't try to trace several of the tests that are
200 # written in Perl or shell and test Perl programs.
201 check-valgrind: $(check_PROGRAMS) tests/data/dictionary.pwd
202         rm -rf $(abs_top_builddir)/tmp-valgrind
203         mkdir $(abs_top_builddir)/tmp-valgrind
204         env RRA_MAINTAINER_TESTS= valgrind --leak-check=full            \
205             --show-reachable=yes --trace-children=yes                   \
206             --log-file=$(abs_top_builddir)/tmp-valgrind/log.%p          \
207             --suppressions=$(abs_top_srcdir)/tests/data/valgrind.supp   \
208             --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" \
209             tests/runtests -l '$(abs_top_srcdir)/tests/TESTS'