]> eyrie.org Git - kerberos/krb5-strength.git/blob - Makefile.am
Use new support for SPDX check exclusions
[kerberos/krb5-strength.git] / Makefile.am
1 # Automake makefile for krb5-strength.
2 #
3 # Written by Russ Allbery <eagle@eyrie.org>
4 # Copyright 2016, 2020, 2023 Russ Allbery <eagle@eyrie.org>
5 # Copyright 2007, 2009-2010, 2012-2014
6 #     The Board of Trustees of the Leland Stanford Junior University
7 #
8 # SPDX-License-Identifier: MIT
9
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/docknot.yaml docs/krb5-strength.5.in docs/krb5-strength.pod    \
15         krb5-strength.spec tests/README tests/TESTS                         \
16         tests/data/cppcheck.supp tests/data/krb5.conf                       \
17         tests/data/make-krb5-conf tests/data/passwords tests/data/perl.conf \
18         tests/data/perlcriticrc tests/data/perltidyrc                       \
19         tests/data/valgrind.supp tests/data/wordlist                        \
20         tests/data/wordlist.cdb tests/data/wordlist.sqlite                  \
21         tests/docs/pod-spelling-t tests/docs/pod-t                          \
22         tests/docs/spdx-license-t tests/perl/critic-t                       \
23         tests/perl/minimum-version-t tests/perl/strict-t                    \
24         tests/style/obsolete-strings-t tests/tap/libtap.sh                  \
25         tests/tap/perl/Test/RRA.pm tests/tap/perl/Test/RRA/Config.pm        \
26         tests/tap/perl/Test/RRA/Automake.pm tests/tools/heimdal-history-t   \
27         tests/tools/heimdal-strength-t tests/tools/wordlist-cdb-t           \
28         tests/tools/wordlist-sqlite-t tests/tools/wordlist-t                \
29         tests/util/xmalloc-t tests/valgrind/logs-t                          \
30         tools/heimdal-strength.pod
31
32 # Do this globally.  Everything needs to find the Kerberos headers and
33 # libraries, and if we're using the system CrackLib, TinyCDB, or SQLite, add
34 # its location unconditionally as well.
35 AM_CPPFLAGS = $(CRACKLIB_CPPFLAGS) $(KRB5_CPPFLAGS) $(CDB_CPPFLAGS) \
36         $(SQLITE3_CPPFLAGS)
37 AM_LDFLAGS = $(CRACKLIB_LDFLAGS) $(KRB5_LDFLAGS) $(CDB_LDFLAGS) \
38         $(SQLITE3_LDFLAGS)
39
40 # Build our portability library.
41 noinst_LTLIBRARIES = portable/libportable.la
42 portable_libportable_la_SOURCES = portable/dummy.c portable/kadmin.h    \
43         portable/krb5.h portable/macros.h portable/stdbool.h            \
44         portable/system.h
45 portable_libportable_la_LIBADD = $(LTLIBOBJS)
46
47 # Build our command-line utility library.
48 noinst_LIBRARIES = util/libutil.a
49 util_libutil_a_SOURCES = util/macros.h util/messages-krb5.c                 \
50         util/messages-krb5.h util/messages.c util/messages.h util/xmalloc.c \
51         util/xmalloc.h
52
53 # If we're building with the embedded cracklib, build cracklib as a helper
54 # library and build (but don't install) the packer program.
55 cracklib_libcracklib_la_SOURCES = cracklib/fascist.c cracklib/packlib.c \
56         cracklib/rules.c cracklib/stringlib.c
57 cracklib_libcracklib_la_CPPFLAGS = -DIN_CRACKLIB
58 cracklib_packer_SOURCES = cracklib/packer.c cracklib/packer.h
59 cracklib_packer_LDADD = cracklib/libcracklib.la
60 if EMBEDDED_CRACKLIB
61     noinst_LTLIBRARIES += cracklib/libcracklib.la
62 endif
63
64 # Put the plugin into $(libdir)/krb5/plugins/pwqual by default,
65 moduledir = $(libdir)/krb5/plugins/pwqual
66
67 # Rules for building the password strength plugin.
68 module_LTLIBRARIES = plugin/strength.la
69 plugin_strength_la_SOURCES = plugin/cdb.c plugin/classes.c plugin/config.c \
70         plugin/cracklib.c plugin/error.c plugin/general.c plugin/heimdal.c \
71         plugin/internal.h plugin/mit.c plugin/principal.c plugin/sqlite.c  \
72         plugin/vector.c
73 plugin_strength_la_LDFLAGS = -module -avoid-version
74 if EMBEDDED_CRACKLIB
75     plugin_strength_la_LIBADD = cracklib/libcracklib.la
76 else
77     plugin_strength_la_LIBADD = $(CRACKLIB_LIBS)
78 endif
79 plugin_strength_la_LIBADD += portable/libportable.la $(KRB5_LIBS) \
80         $(CDB_LIBS) $(SQLITE3_LIBS)
81
82 # The Heimdal external check program.
83 bin_PROGRAMS = tools/heimdal-strength
84 tools_heimdal_strength_CFLAGS = $(AM_CFLAGS)
85 tools_heimdal_strength_SOURCES = plugin/cdb.c plugin/classes.c            \
86         plugin/config.c plugin/cracklib.c plugin/error.c plugin/general.c \
87         plugin/internal.h plugin/principal.c plugin/sqlite.c              \
88         plugin/vector.c tools/heimdal-strength.c
89 if EMBEDDED_CRACKLIB
90     tools_heimdal_strength_LDADD = cracklib/libcracklib.la
91 else
92     tools_heimdal_strength_LDADD = $(CRACKLIB_LIBS)
93 endif
94 tools_heimdal_strength_LDADD += util/libutil.a portable/libportable.la \
95         $(KRB5_LIBS) $(CDB_LIBS) $(SQLITE3_LIBS)
96
97 # Other tools.
98 dist_bin_SCRIPTS = tools/heimdal-history tools/krb5-strength-wordlist
99
100 # Man pages for all tools.
101 dist_man_MANS = tools/heimdal-history.1 tools/heimdal-strength.1 \
102         tools/krb5-strength-wordlist.1
103 man_MANS = docs/krb5-strength.5
104
105 # Substitute the installation paths into the manual page.
106 docs/krb5-strength.5: $(srcdir)/docs/krb5-strength.5.in
107         [ -d docs ] || mkdir docs
108         sed -e 's%\(\\f(CI\)*\@moduledir\(\\fI\)*\@%$(moduledir)%' \
109             < $(srcdir)/docs/krb5-strength.5.in > $@
110
111 # Handle the standard stuff that make maintainer-clean should probably remove
112 # but doesn't.  This breaks the GNU coding standard, but in this area the GNU
113 # coding standard is dumb.
114 CLEANFILES = docs/krb5-strength.5 tests/data/dictionary.hwm \
115         tests/data/dictionary.pwd tests/data/dictionary.pwi
116 DISTCLEANFILES = tests/data/.placeholder
117 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile         \
118         build-aux/config.guess build-aux/config.sub build-aux/depcomp   \
119         build-aux/install-sh build-aux/ltmain.sh build-aux/missing      \
120         config.h.in config.h.in~ configure docs/krb5-strength.5.in      \
121         m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4     \
122         m4/lt~obsolete.m4 tests/data/wordlist.cdb                       \
123         tests/data/wordlist.sqlite tools/heimdal-history.1              \
124         tools/heimdal-strength.1 tools/krb5-strength-wordlist.1
125
126 # Also remove the generated *.c files from our JSON test data on
127 # maintainer-clean.
128 maintainer-clean-local:
129         rm -f tests/data/passwords/*.c
130
131 warnings:
132         $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
133             KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_WARNINGS)'
134         $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
135             KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_WARNINGS)' $(check_PROGRAMS)
136
137 # The bits below are for the test suite, not for the main package.
138 check_PROGRAMS = tests/runtests tests/plugin/heimdal-t tests/plugin/mit-t   \
139         tests/portable/asprintf-t tests/portable/mkstemp-t                  \
140         tests/portable/reallocarray-t tests/portable/strndup-t              \
141         tests/util/messages-krb5-t tests/util/messages-t tests/util/xmalloc
142 if EMBEDDED_CRACKLIB
143     check_PROGRAMS += cracklib/packer
144 endif
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      \
152         tests/tap/string.h
153
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_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 check the source code with cppcheck.
198 check-cppcheck:
199         cd $(abs_top_srcdir) &&                                         \
200             find . -name .git -prune -o -name '*.[ch]' -print           \
201             | cppcheck -q --force --error-exitcode=2 --file-list=-      \
202                 --suppressions-list=tests/data/cppcheck.supp            \
203                 --enable=warning,performance,portability,style
204
205 # The full path to valgrind and its options, used when doing valgrind
206 # testing.
207 VALGRIND_COMMAND = $(PATH_VALGRIND) --leak-check=full                   \
208         --trace-children=yes --trace-children-skip=/bin/sh              \
209         --suppressions=$(abs_top_srcdir)/tests/data/valgrind.supp       \
210         --log-file=$(abs_top_builddir)/tests/tmp/valgrind/log.%p
211
212 # Used by maintainers to run the main test suite under valgrind.
213 check-valgrind: $(check_PROGRAMS) tests/data/dictionary.pwd
214         rm -rf $(abs_top_builddir)/tests/tmp
215         mkdir $(abs_top_builddir)/tests/tmp
216         mkdir $(abs_top_builddir)/tests/tmp/valgrind
217         C_TAP_VALGRIND="$(VALGRIND_COMMAND)" tests/runtests \
218             -l '$(abs_top_srcdir)/tests/TESTS'
219
220 # Used by maintainers to reformat all source code using clang-format and
221 # excluding some files.
222 reformat:
223         find . -name '*.[ch]' \! -name krb5-profile.c   \
224             \! -path './cracklib/*' -print              \
225             | xargs clang-format -style=file -i