1 # Automake makefile for krb5-strength.
3 # Written by Russ Allbery <rra@stanford.edu>
4 # Copyright 2007, 2009, 2010, 2012, 2013
5 # The Board of Trustees of the Leland Stanford Junior University
7 # See LICENSE for licensing terms.
9 ACLOCAL_AMFLAGS = -I m4
10 EXTRA_DIST = .gitignore LICENSE autogen cracklib/HISTORY cracklib/LICENCE \
11 cracklib/README cracklib/genrules.pl cracklib/mkdict \
12 external/heimdal-strength.pod tests/HOWTO tests/TESTS \
13 tests/data/wordlist tests/heimdal/external-t \
14 tests/heimdal/pod-spelling-t tests/heimdal/pod-t \
15 tests/tap/libtap.sh tests/tools/cdbmake-wordlist
17 # Do this globally. Everything needs to find the Kerberos headers and
18 # libraries, and if we're using the system CrackLib or libcdb, add its
19 # location unconditionally as well.
20 AM_CPPFLAGS = $(CRACKLIB_CPPFLAGS) $(KRB5_CPPFLAGS) $(CDB_CPPFLAGS)
21 AM_LDFLAGS = $(CRACKLIB_LDFLAGS) $(KRB5_LDFLAGS) $(CDB_LDFLAGS)
23 # Put the module into /usr/local/lib/kadmind by default, relative to --libdir.
24 moduledir = $(libdir)/kadmind
26 # Build our portability library.
27 noinst_LTLIBRARIES = portable/libportable.la
28 portable_libportable_la_SOURCES = portable/dummy.c portable/kadmin.h \
29 portable/krb5.h portable/macros.h portable/stdbool.h \
31 portable_libportable_la_LIBADD = $(LTLIBOBJS)
33 # Build our command-line utility library.
34 noinst_LIBRARIES = util/libutil.a
35 util_libutil_a_SOURCES = util/macros.h util/messages-krb5.c \
36 util/messages-krb5.h util/messages.c util/messages.h util/xmalloc.c \
39 # If we're building with the embedded cracklib, build cracklib as a helper
40 # library and build (but don't install) the packer program.
41 cracklib_libcracklib_la_SOURCES = cracklib/fascist.c cracklib/packlib.c \
42 cracklib/rules.c cracklib/stringlib.c
43 cracklib_libcracklib_la_CPPFLAGS = -DIN_CRACKLIB
44 cracklib_packer_SOURCES = cracklib/packer.c cracklib/packer.h
45 cracklib_packer_LDADD = cracklib/libcracklib.la
47 noinst_LTLIBRARIES += cracklib/libcracklib.la
50 # Rules for building the password strength plugin.
51 module_LTLIBRARIES = plugin/passwd_strength.la
52 plugin_passwd_strength_la_SOURCES = plugin/api.c plugin/cdb.c \
53 plugin/heimdal.c plugin/mit.c
54 plugin_passwd_strength_la_LDFLAGS = -module -avoid-version
56 plugin_passwd_strength_la_LIBADD = cracklib/libcracklib.la
58 plugin_passwd_strength_la_LIBADD = $(CRACKLIB_LIBS)
60 plugin_passwd_strength_la_LIBADD += portable/libportable.la $(KRB5_LIBS) \
63 # The Heimdal external-check program.
64 bin_PROGRAMS = external/heimdal-strength
65 external_heimdal_strength_CFLAGS = $(AM_CFLAGS)
66 external_heimdal_strength_SOURCES = plugin/api.c plugin/api.h plugin/cdb.c \
67 external/heimdal-strength.c
69 external_heimdal_strength_LDADD = cracklib/libcracklib.la
71 external_heimdal_strength_LDADD = $(CRACKLIB_LIBS)
73 external_heimdal_strength_LDADD += util/libutil.a portable/libportable.la \
74 $(KRB5_LIBS) $(CDB_LIBS)
77 dist_bin_SCRIPTS = tools/cdbmake-wordlist
79 # Man pages for all tools.
80 dist_man_MANS = external/heimdal-strength.1 tools/cdbmake-wordlist.1
82 # Handle the standard stuff that make maintainer-clean should probably remove
83 # but doesn't. This breaks the GNU coding standard, but in this area the GNU
84 # coding standard is dumb.
85 CLEANFILES = tests/data/dictionary.hwm tests/data/dictionary.pwd \
86 tests/data/dictionary.pwi
87 DISTCLEANFILES = tests/data/.placeholder
88 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile \
89 build-aux/config.guess build-aux/config.sub build-aux/depcomp \
90 build-aux/install-sh build-aux/ltmain.sh build-aux/missing \
91 config.h.in config.h.in~ configure m4/libtool.m4 m4/ltoptions.m4 \
92 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4
94 # A set of flags for warnings. Add -O because gcc won't find some warnings
95 # without optimization turned on. Desirable warnings that can't be turned
96 # on due to other problems:
98 # -Wconversion http://bugs.debian.org/488884 (htons warnings)
100 # Last checked against gcc 4.7.2 (2013-04-22). -D_FORTIFY_SOURCE=2 enables
101 # warn_unused_result attribute markings on glibc functions on Linux, which
102 # catches a few more issues.
103 WARNINGS = -g -O -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wendif-labels \
104 -Wformat=2 -Winit-self -Wswitch-enum -Wuninitialized -Wfloat-equal \
105 -Wdeclaration-after-statement -Wshadow -Wpointer-arith \
106 -Wbad-function-cast -Wcast-align -Wwrite-strings \
107 -Wjump-misses-init -Wlogical-op -Wstrict-prototypes \
108 -Wold-style-definition -Wmissing-prototypes -Wnormalized=nfc \
109 -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wvla -Werror
112 $(MAKE) V=0 CFLAGS='$(WARNINGS)'
113 $(MAKE) V=0 CFLAGS='$(WARNINGS)' $(check_PROGRAMS)
115 # The bits below are for the test suite, not for the main package.
116 check_PROGRAMS = tests/heimdal/plugin-t tests/mit/plugin-t \
117 tests/portable/asprintf-t tests/portable/snprintf-t \
118 tests/portable/strlcat-t tests/portable/strlcpy-t tests/runtests \
119 tests/util/messages-t tests/util/xmalloc
121 check_PROGRAMS += cracklib/packer
123 tests_runtests_CPPFLAGS = -DSOURCE='"$(abs_top_srcdir)/tests"' \
124 -DBUILD='"$(abs_top_builddir)/tests"'
125 check_LIBRARIES = tests/tap/libtap.a
126 tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/tests $(KRB5_CPPFLAGS)
127 tests_tap_libtap_a_SOURCES = tests/tap/basic.c tests/tap/basic.h \
128 tests/tap/kerberos.c tests/tap/kerberos.h tests/tap/macros.h \
129 tests/tap/process.c tests/tap/process.h tests/tap/string.c \
132 # The actual test programs.
133 tests_heimdal_plugin_t_CPPFLAGS = $(KRB5_CPPFLAGS)
134 tests_heimdal_plugin_t_LDADD = tests/tap/libtap.a portable/libportable.la \
135 $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
136 tests_mit_plugin_t_CPPFLAGS = $(KRB5_CPPFLAGS)
137 tests_mit_plugin_t_LDADD = tests/tap/libtap.a portable/libportable.la \
138 $(KRB5_LIBS) $(CDB_LIBS) $(DL_LIBS)
139 tests_portable_asprintf_t_SOURCES = tests/portable/asprintf-t.c \
140 tests/portable/asprintf.c
141 tests_portable_asprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
142 tests_portable_snprintf_t_SOURCES = tests/portable/snprintf-t.c \
143 tests/portable/snprintf.c
144 tests_portable_snprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
145 tests_portable_strlcat_t_SOURCES = tests/portable/strlcat-t.c \
146 tests/portable/strlcat.c
147 tests_portable_strlcat_t_LDADD = tests/tap/libtap.a portable/libportable.la
148 tests_portable_strlcpy_t_SOURCES = tests/portable/strlcpy-t.c \
149 tests/portable/strlcpy.c
150 tests_portable_strlcpy_t_LDADD = tests/tap/libtap.a portable/libportable.la
151 tests_util_messages_t_LDADD = tests/tap/libtap.a util/libutil.a \
152 portable/libportable.la
153 tests_util_xmalloc_LDADD = util/libutil.a portable/libportable.la
155 # The dictionary is used by the tests and needs to be built first.
157 tests/data/dictionary.pwd: cracklib/packer $(srcdir)/cracklib/mkdict \
158 $(srcdir)/tests/data/wordlist
160 $(srcdir)/cracklib/mkdict $(srcdir)/tests/data/wordlist \
161 | cracklib/packer tests/data/dictionary
163 tests/data/dictionary.pwd: $(srcdir)/tests/data/wordlist
165 cracklib-format $(srcdir)/tests/data/wordlist \
166 | cracklib-packer tests/data/dictionary
169 check-local: $(check_PROGRAMS) tests/data/dictionary.pwd
170 cd tests && ./runtests -l $(abs_top_srcdir)/tests/TESTS