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