]> eyrie.org Git - kerberos/krb5-strength.git/blob - Makefile.am
Bump actions/checkout from 2 to 4
[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/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
30
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) \
35         $(SQLITE3_CPPFLAGS)
36 AM_LDFLAGS = $(CRACKLIB_LDFLAGS) $(KRB5_LDFLAGS) $(CDB_LDFLAGS) \
37         $(SQLITE3_LDFLAGS)
38
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            \
43         portable/system.h
44 portable_libportable_la_LIBADD = $(LTLIBOBJS)
45
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 \
50         util/xmalloc.h
51
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
59 if EMBEDDED_CRACKLIB
60     noinst_LTLIBRARIES += cracklib/libcracklib.la
61 endif
62
63 # Put the plugin into $(libdir)/krb5/plugins/pwqual by default,
64 moduledir = $(libdir)/krb5/plugins/pwqual
65
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  \
71         plugin/vector.c
72 plugin_strength_la_LDFLAGS = -module -avoid-version
73 if EMBEDDED_CRACKLIB
74     plugin_strength_la_LIBADD = cracklib/libcracklib.la
75 else
76     plugin_strength_la_LIBADD = $(CRACKLIB_LIBS)
77 endif
78 plugin_strength_la_LIBADD += portable/libportable.la $(KRB5_LIBS) \
79         $(CDB_LIBS) $(SQLITE3_LIBS)
80
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
88 if EMBEDDED_CRACKLIB
89     tools_heimdal_strength_LDADD = cracklib/libcracklib.la
90 else
91     tools_heimdal_strength_LDADD = $(CRACKLIB_LIBS)
92 endif
93 tools_heimdal_strength_LDADD += util/libutil.a portable/libportable.la \
94         $(KRB5_LIBS) $(CDB_LIBS) $(SQLITE3_LIBS)
95
96 # Other tools.
97 dist_bin_SCRIPTS = tools/heimdal-history tools/krb5-strength-wordlist
98
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
103
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 > $@
109
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
124
125 # Also remove the generated *.c files from our JSON test data on
126 # maintainer-clean.
127 maintainer-clean-local:
128         rm -f tests/data/passwords/*.c
129
130 warnings:
131         $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
132             KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_WARNINGS)'
133         $(MAKE) V=0 CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
134             KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_WARNINGS)' $(check_PROGRAMS)
135
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/strndup-t              \
140         tests/util/messages-krb5-t tests/util/messages-t tests/util/xmalloc
141 if EMBEDDED_CRACKLIB
142     check_PROGRAMS += cracklib/packer
143 endif
144 tests_runtests_CPPFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \
145         -DC_TAP_BUILD='"$(abs_top_builddir)/tests"'
146 check_LIBRARIES = tests/tap/libtap.a
147 tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/tests $(KRB5_CPPFLAGS)
148 tests_tap_libtap_a_SOURCES = tests/tap/basic.c tests/tap/basic.h        \
149         tests/tap/kerberos.c tests/tap/kerberos.h tests/tap/macros.h    \
150         tests/tap/process.c tests/tap/process.h tests/tap/string.c      \
151         tests/tap/string.h
152
153 # The actual test programs.
154 tests_plugin_heimdal_t_CPPFLAGS = $(KRB5_CPPFLAGS)
155 tests_plugin_heimdal_t_LDADD = tests/tap/libtap.a portable/libportable.la \
156         $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
157 tests_plugin_mit_t_CPPFLAGS = $(KRB5_CPPFLAGS)
158 tests_plugin_mit_t_LDADD = tests/tap/libtap.a portable/libportable.la \
159         $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
160 tests_portable_asprintf_t_SOURCES = tests/portable/asprintf-t.c \
161         tests/portable/asprintf.c
162 tests_portable_asprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
163 tests_portable_mkstemp_t_SOURCES = tests/portable/mkstemp-t.c \
164         tests/portable/mkstemp.c
165 tests_portable_mkstemp_t_LDADD = tests/tap/libtap.a portable/libportable.la
166 tests_portable_reallocarray_t_SOURCES = tests/portable/reallocarray-t.c \
167         tests/portable/reallocarray.c
168 tests_portable_reallocarray_t_LDADD = tests/tap/libtap.a \
169         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 check the source code with cppcheck.
197 check-cppcheck:
198         cd $(abs_top_srcdir) &&                                         \
199             find . -name .git -prune -o -name '*.[ch]' -print           \
200             | cppcheck -q --force --error-exitcode=2 --file-list=-      \
201                 --suppressions-list=tests/data/cppcheck.supp            \
202                 --enable=warning,performance,portability,style
203
204 # The full path to valgrind and its options, used when doing valgrind
205 # testing.
206 VALGRIND_COMMAND = $(PATH_VALGRIND) --leak-check=full                   \
207         --trace-children=yes --trace-children-skip=/bin/sh              \
208         --suppressions=$(abs_top_srcdir)/tests/data/valgrind.supp       \
209         --log-file=$(abs_top_builddir)/tests/tmp/valgrind/log.%p
210
211 # Used by maintainers to run the main test suite under valgrind.
212 check-valgrind: $(check_PROGRAMS) tests/data/dictionary.pwd
213         rm -rf $(abs_top_builddir)/tests/tmp
214         mkdir $(abs_top_builddir)/tests/tmp
215         mkdir $(abs_top_builddir)/tests/tmp/valgrind
216         C_TAP_VALGRIND="$(VALGRIND_COMMAND)" tests/runtests \
217             -l '$(abs_top_srcdir)/tests/TESTS'
218
219 # Used by maintainers to reformat all source code using clang-format and
220 # excluding some files.
221 reformat:
222         find . -name '*.[ch]' \! -name krb5-profile.c   \
223             \! -path './cracklib/*' -print              \
224             | xargs clang-format -style=file -i