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 # SPDX-License-Identifier: MIT
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/cppcheck.supp \
16 tests/data/krb5.conf tests/data/make-krb5-conf tests/data/passwords \
17 tests/data/perl.conf 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 \
21 tests/docs/spdx-license-t tests/perl/critic-t \
22 tests/perl/minimum-version-t tests/perl/strict-t \
23 tests/style/obsolete-strings-t tests/tap/libtap.sh \
24 tests/tap/perl/Test/RRA.pm tests/tap/perl/Test/RRA/Config.pm \
25 tests/tap/perl/Test/RRA/Automake.pm tests/tools/heimdal-history-t \
26 tests/tools/heimdal-strength-t tests/tools/wordlist-cdb-t \
27 tests/tools/wordlist-sqlite-t tests/tools/wordlist-t \
28 tests/util/xmalloc-t tests/valgrind/logs-t \
29 tools/heimdal-strength.pod
31 # Do this globally. Everything needs to find the Kerberos headers and
32 # libraries, and if we're using the system CrackLib, TinyCDB, or SQLite, add
33 # its location unconditionally as well.
34 AM_CPPFLAGS = $(CRACKLIB_CPPFLAGS) $(KRB5_CPPFLAGS) $(CDB_CPPFLAGS) \
36 AM_LDFLAGS = $(CRACKLIB_LDFLAGS) $(KRB5_LDFLAGS) $(CDB_LDFLAGS) \
39 # Build our portability library.
40 noinst_LTLIBRARIES = portable/libportable.la
41 portable_libportable_la_SOURCES = portable/dummy.c portable/kadmin.h \
42 portable/krb5.h portable/macros.h portable/stdbool.h \
44 portable_libportable_la_LIBADD = $(LTLIBOBJS)
46 # Build our command-line utility library.
47 noinst_LIBRARIES = util/libutil.a
48 util_libutil_a_SOURCES = util/macros.h util/messages-krb5.c \
49 util/messages-krb5.h util/messages.c util/messages.h util/xmalloc.c \
52 # If we're building with the embedded cracklib, build cracklib as a helper
53 # library and build (but don't install) the packer program.
54 cracklib_libcracklib_la_SOURCES = cracklib/fascist.c cracklib/packlib.c \
55 cracklib/rules.c cracklib/stringlib.c
56 cracklib_libcracklib_la_CPPFLAGS = -DIN_CRACKLIB
57 cracklib_packer_SOURCES = cracklib/packer.c cracklib/packer.h
58 cracklib_packer_LDADD = cracklib/libcracklib.la
60 noinst_LTLIBRARIES += cracklib/libcracklib.la
63 # Put the plugin into $(libdir)/krb5/plugins/pwqual by default,
64 moduledir = $(libdir)/krb5/plugins/pwqual
66 # Rules for building the password strength plugin.
67 module_LTLIBRARIES = plugin/strength.la
68 plugin_strength_la_SOURCES = plugin/cdb.c plugin/classes.c plugin/config.c \
69 plugin/cracklib.c plugin/error.c plugin/general.c plugin/heimdal.c \
70 plugin/internal.h plugin/mit.c plugin/principal.c plugin/sqlite.c \
72 plugin_strength_la_LDFLAGS = -module -avoid-version
74 plugin_strength_la_LIBADD = cracklib/libcracklib.la
76 plugin_strength_la_LIBADD = $(CRACKLIB_LIBS)
78 plugin_strength_la_LIBADD += portable/libportable.la $(KRB5_LIBS) \
79 $(CDB_LIBS) $(SQLITE_LIBS)
81 # The Heimdal external check program.
82 bin_PROGRAMS = tools/heimdal-strength
83 tools_heimdal_strength_CFLAGS = $(AM_CFLAGS)
84 tools_heimdal_strength_SOURCES = plugin/cdb.c plugin/classes.c \
85 plugin/config.c plugin/cracklib.c plugin/error.c plugin/general.c \
86 plugin/internal.h plugin/principal.c plugin/sqlite.c \
87 plugin/vector.c tools/heimdal-strength.c
89 tools_heimdal_strength_LDADD = cracklib/libcracklib.la
91 tools_heimdal_strength_LDADD = $(CRACKLIB_LIBS)
93 tools_heimdal_strength_LDADD += util/libutil.a portable/libportable.la \
94 $(KRB5_LIBS) $(CDB_LIBS) $(SQLITE_LIBS)
97 dist_bin_SCRIPTS = tools/heimdal-history tools/krb5-strength-wordlist
99 # Man pages for all tools.
100 dist_man_MANS = tools/heimdal-history.1 tools/heimdal-strength.1 \
101 tools/krb5-strength-wordlist.1
102 man_MANS = docs/krb5-strength.5
104 # Substitute the installation paths into the manual page.
105 docs/krb5-strength.5: $(srcdir)/docs/krb5-strength.5.in
106 [ -d docs ] || mkdir docs
107 sed -e 's%\(\\f(CI\)*\@moduledir\(\\fI\)*\@%$(moduledir)%' \
108 < $(srcdir)/docs/krb5-strength.5.in > $@
110 # Handle the standard stuff that make maintainer-clean should probably remove
111 # but doesn't. This breaks the GNU coding standard, but in this area the GNU
112 # coding standard is dumb.
113 CLEANFILES = docs/krb5-strength.5 tests/data/dictionary.hwm \
114 tests/data/dictionary.pwd tests/data/dictionary.pwi
115 DISTCLEANFILES = tests/data/.placeholder
116 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile \
117 build-aux/config.guess build-aux/config.sub build-aux/depcomp \
118 build-aux/install-sh build-aux/ltmain.sh build-aux/missing \
119 config.h.in config.h.in~ configure docs/krb5-strength.5.in \
120 m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
121 m4/lt~obsolete.m4 tests/data/wordlist.cdb \
122 tests/data/wordlist.sqlite tools/heimdal-history.1 \
123 tools/heimdal-strength.1 tools/krb5-strength-wordlist.1
125 # Also remove the generated *.c files from our JSON test data on
127 maintainer-clean-local:
128 rm -f tests/data/passwords/*.c
131 $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
132 KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)'
133 $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
134 KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)' $(check_PROGRAMS)
136 # The bits below are for the test suite, not for the main package.
137 check_PROGRAMS = tests/runtests tests/plugin/heimdal-t tests/plugin/mit-t \
138 tests/portable/asprintf-t tests/portable/mkstemp-t \
139 tests/portable/reallocarray-t tests/portable/snprintf-t \
140 tests/portable/strndup-t tests/util/messages-krb5-t \
141 tests/util/messages-t tests/util/xmalloc
143 check_PROGRAMS += cracklib/packer
145 tests_runtests_CPPFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \
146 -DC_TAP_BUILD='"$(abs_top_builddir)/tests"'
147 check_LIBRARIES = tests/tap/libtap.a
148 tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/tests $(KRB5_CPPFLAGS)
149 tests_tap_libtap_a_SOURCES = tests/tap/basic.c tests/tap/basic.h \
150 tests/tap/kerberos.c tests/tap/kerberos.h tests/tap/macros.h \
151 tests/tap/process.c tests/tap/process.h tests/tap/string.c \
154 # The actual test programs.
155 tests_plugin_heimdal_t_CPPFLAGS = $(KRB5_CPPFLAGS)
156 tests_plugin_heimdal_t_LDADD = tests/tap/libtap.a portable/libportable.la \
157 $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
158 tests_plugin_mit_t_CPPFLAGS = $(KRB5_CPPFLAGS)
159 tests_plugin_mit_t_LDADD = tests/tap/libtap.a portable/libportable.la \
160 $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
161 tests_portable_asprintf_t_SOURCES = tests/portable/asprintf-t.c \
162 tests/portable/asprintf.c
163 tests_portable_asprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
164 tests_portable_mkstemp_t_SOURCES = tests/portable/mkstemp-t.c \
165 tests/portable/mkstemp.c
166 tests_portable_mkstemp_t_LDADD = tests/tap/libtap.a portable/libportable.la
167 tests_portable_reallocarray_t_SOURCES = tests/portable/reallocarray-t.c \
168 tests/portable/reallocarray.c
169 tests_portable_reallocarray_t_LDADD = tests/tap/libtap.a \
170 portable/libportable.la
171 tests_portable_snprintf_t_SOURCES = tests/portable/snprintf-t.c \
172 tests/portable/snprintf.c
173 tests_portable_snprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
174 tests_portable_strndup_t_SOURCES = tests/portable/strndup-t.c \
175 tests/portable/strndup.c
176 tests_portable_strndup_t_LDADD = tests/tap/libtap.a portable/libportable.la
177 tests_util_messages_t_LDADD = tests/tap/libtap.a util/libutil.a \
178 portable/libportable.la
179 tests_util_messages_krb5_t_LDADD = tests/tap/libtap.a util/libutil.a \
180 portable/libportable.la $(KRB5_LIBS)
181 tests_util_xmalloc_LDADD = util/libutil.a portable/libportable.la
183 # The dictionary is used by the tests and needs to be built first.
185 tests/data/dictionary.pwd: cracklib/packer $(srcdir)/cracklib/mkdict \
186 $(srcdir)/tests/data/wordlist
188 $(srcdir)/cracklib/mkdict $(srcdir)/tests/data/wordlist \
189 | cracklib/packer tests/data/dictionary
191 tests/data/dictionary.pwd: $(srcdir)/tests/data/wordlist
193 cracklib-format $(srcdir)/tests/data/wordlist \
194 | cracklib-packer tests/data/dictionary
197 check-local: $(check_PROGRAMS) tests/data/dictionary.pwd
198 cd tests && ./runtests -l $(abs_top_srcdir)/tests/TESTS
200 # Used by maintainers to check the source code with cppcheck.
202 cd $(abs_top_srcdir) && \
203 find . -name .git -prune -o -name '*.[ch]' -print \
204 | cppcheck -q --force --error-exitcode=2 --file-list=- \
205 --suppressions-list=tests/data/cppcheck.supp \
206 --enable=warning,performance,portability,style
208 # The full path to valgrind and its options, used when doing valgrind
210 VALGRIND_COMMAND = $(PATH_VALGRIND) --leak-check=full \
211 --trace-children=yes --trace-children-skip=/bin/sh \
212 --suppressions=$(abs_top_srcdir)/tests/data/valgrind.supp \
213 --log-file=$(abs_top_builddir)/tests/tmp/valgrind/log.%p
215 # Used by maintainers to run the main test suite under valgrind.
216 check-valgrind: $(check_PROGRAMS) tests/data/dictionary.pwd
217 rm -rf $(abs_top_builddir)/tests/tmp
218 mkdir $(abs_top_builddir)/tests/tmp
219 mkdir $(abs_top_builddir)/tests/tmp/valgrind
220 C_TAP_VALGRIND="$(VALGRIND_COMMAND)" tests/runtests \
221 -l '$(abs_top_srcdir)/tests/TESTS'
223 # Used by maintainers to reformat all source code using clang-format and
224 # excluding some files.
226 find . -name '*.[ch]' \! -name snprintf.c \! -name krb5-profile.c \
227 \! -path './cracklib/*' -print \
228 | xargs clang-format-10 -style=file -i