xref: /freebsd/contrib/pam-krb5/Makefile.am (revision bf6873c5786e333d679a7838d28812febf479a8a)
1*bf6873c5SCy Schubert# Automake makefile for pam-krb5.
2*bf6873c5SCy Schubert#
3*bf6873c5SCy Schubert# Written by Russ Allbery <eagle@eyrie.org>
4*bf6873c5SCy Schubert# Copyright 2005-2007, 2014, 2017, 2020-2021 Russ Allbery <eagle@eyrie.org>
5*bf6873c5SCy Schubert# Copyright 2009, 2011-2012
6*bf6873c5SCy Schubert#     The Board of Trustees of the Leland Stanford Junior University
7*bf6873c5SCy Schubert# Copyright 2005 Andres Salomon <dilinger@debian.org>
8*bf6873c5SCy Schubert# Copyright 1999-2000 Frank Cusack <fcusack@fcusack.com>
9*bf6873c5SCy Schubert#
10*bf6873c5SCy Schubert# SPDX-License-Identifier: BSD-3-clause or GPL-1+
11*bf6873c5SCy Schubert
12*bf6873c5SCy SchubertACLOCAL_AMFLAGS = -I m4
13*bf6873c5SCy SchubertEXTRA_DIST = .clang-format .gitignore .github LICENSE README.md bootstrap   \
14*bf6873c5SCy Schubert	ci/README.md ci/files/heimdal/heimdal-kdc			    \
15*bf6873c5SCy Schubert	ci/files/heimdal/kadmind.acl ci/files/heimdal/kdc.conf		    \
16*bf6873c5SCy Schubert	ci/files/heimdal/krb5.conf ci/files/heimdal/pki-mapping		    \
17*bf6873c5SCy Schubert	ci/files/mit/extensions.client ci/files/mit/extensions.kdc	    \
18*bf6873c5SCy Schubert	ci/files/mit/kadm5.acl ci/files/mit/kdc.conf ci/files/mit/krb5.conf \
19*bf6873c5SCy Schubert	ci/kdc-setup-heimdal ci/kdc-setup-mit ci/install ci/test	    \
20*bf6873c5SCy Schubert	docs/docknot.yaml docs/pam_krb5.pod module/pam_krb5.map		    \
21*bf6873c5SCy Schubert	module/pam_krb5.sym tests/README tests/TESTS tests/config/README    \
22*bf6873c5SCy Schubert	tests/data/cppcheck.supp tests/data/generate-krb5-conf		    \
23*bf6873c5SCy Schubert	tests/data/krb5-pam.conf tests/data/krb5.conf tests/data/perl.conf  \
24*bf6873c5SCy Schubert	tests/data/scripts tests/data/valgrind.supp			    \
25*bf6873c5SCy Schubert	tests/docs/pod-spelling-t tests/docs/pod-t			    \
26*bf6873c5SCy Schubert	tests/docs/spdx-license-t tests/fakepam/README tests/tap/libtap.sh  \
27*bf6873c5SCy Schubert	tests/tap/perl/Test/RRA.pm tests/tap/perl/Test/RRA/Automake.pm	    \
28*bf6873c5SCy Schubert	tests/tap/perl/Test/RRA/Config.pm tests/style/obsolete-strings-t    \
29*bf6873c5SCy Schubert	tests/valgrind/logs-t
30*bf6873c5SCy Schubert
31*bf6873c5SCy Schubert# Everything we build needs the Kerbeors headers and library flags.
32*bf6873c5SCy SchubertAM_CPPFLAGS = $(KRB5_CPPFLAGS)
33*bf6873c5SCy SchubertAM_LDFLAGS  = $(KRB5_LDFLAGS)
34*bf6873c5SCy Schubert
35*bf6873c5SCy Schubertnoinst_LTLIBRARIES = pam-util/libpamutil.la portable/libportable.la
36*bf6873c5SCy Schubertportable_libportable_la_SOURCES = portable/dummy.c portable/kadmin.h	    \
37*bf6873c5SCy Schubert        portable/krb5.h portable/macros.h portable/pam.h portable/stdbool.h \
38*bf6873c5SCy Schubert        portable/system.h
39*bf6873c5SCy Schubertportable_libportable_la_LIBADD = $(LTLIBOBJS)
40*bf6873c5SCy Schubertpam_util_libpamutil_la_SOURCES = pam-util/args.c pam-util/args.h	\
41*bf6873c5SCy Schubert	pam-util/logging.c pam-util/logging.h pam-util/options.c	\
42*bf6873c5SCy Schubert	pam-util/options.h pam-util/vector.c pam-util/vector.h
43*bf6873c5SCy Schubert
44*bf6873c5SCy Schubertif HAVE_LD_VERSION_SCRIPT
45*bf6873c5SCy Schubert    VERSION_LDFLAGS = -Wl,--version-script=${srcdir}/module/pam_krb5.map
46*bf6873c5SCy Schubertelse
47*bf6873c5SCy Schubert    VERSION_LDFLAGS = -export-symbols ${srcdir}/module/pam_krb5.sym
48*bf6873c5SCy Schubertendif
49*bf6873c5SCy Schubert
50*bf6873c5SCy Schubertpamdir = $(libdir)/security
51*bf6873c5SCy Schubertpam_LTLIBRARIES = module/pam_krb5.la
52*bf6873c5SCy Schubertmodule_pam_krb5_la_SOURCES = module/account.c module/alt-auth.c		\
53*bf6873c5SCy Schubert	module/auth.c module/cache.c module/context.c module/fast.c	\
54*bf6873c5SCy Schubert	module/internal.h module/options.c module/password.c		\
55*bf6873c5SCy Schubert	module/prompting.c module/public.c module/setcred.c		\
56*bf6873c5SCy Schubert	module/support.c
57*bf6873c5SCy Schubertmodule_pam_krb5_la_LDFLAGS = -module -shared \
58*bf6873c5SCy Schubert	-avoid-version $(VERSION_LDFLAGS) $(AM_LDFLAGS)
59*bf6873c5SCy Schubertmodule_pam_krb5_la_LIBADD = pam-util/libpamutil.la portable/libportable.la \
60*bf6873c5SCy Schubert	$(KRB5_LIBS)
61*bf6873c5SCy Schubertdist_man_MANS = docs/pam_krb5.5
62*bf6873c5SCy Schubert
63*bf6873c5SCy Schubert# The manual page is normally generated by the bootstrap script, but add a
64*bf6873c5SCy Schubert# Makefile rule to regenerate it if it is modified.
65*bf6873c5SCy Schubertdocs/pam_krb5.5: $(srcdir)/docs/pam_krb5.pod
66*bf6873c5SCy Schubert	pod2man --release="$(VERSION)" --center=pam-krb5 -s 5 \
67*bf6873c5SCy Schubert	    $(srcdir)/docs/pam_krb5.pod > $@
68*bf6873c5SCy Schubert
69*bf6873c5SCy Schubert# Work around the GNU Coding Standards, which leave all the Autoconf and
70*bf6873c5SCy Schubert# Automake stuff around after make maintainer-clean, thus making that command
71*bf6873c5SCy Schubert# mostly worthless.
72*bf6873c5SCy SchubertDISTCLEANFILES = config.h.in~ configure~
73*bf6873c5SCy SchubertMAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile		    \
74*bf6873c5SCy Schubert	build-aux/config.guess build-aux/config.sub build-aux/depcomp	    \
75*bf6873c5SCy Schubert	build-aux/install-sh build-aux/ltmain.sh build-aux/missing	    \
76*bf6873c5SCy Schubert	config.h.in configure docs/pam_krb5.5 m4/libtool.m4 m4/ltoptions.m4 \
77*bf6873c5SCy Schubert	m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4
78*bf6873c5SCy Schubert
79*bf6873c5SCy Schubert# Separate target for a human to request building everything with as many
80*bf6873c5SCy Schubert# compiler warnings enabled as possible.
81*bf6873c5SCy Schubertwarnings:
82*bf6873c5SCy Schubert	$(MAKE) V=0 AM_CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
83*bf6873c5SCy Schubert	    KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_WARNINGS)'
84*bf6873c5SCy Schubert	$(MAKE) V=0 AM_CFLAGS='$(WARNINGS_CFLAGS) $(AM_CFLAGS)' \
85*bf6873c5SCy Schubert	    KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_WARNINGS)' $(check_PROGRAMS)
86*bf6873c5SCy Schubert
87*bf6873c5SCy Schubert# The bits below are for the test suite, not for the main package.
88*bf6873c5SCy Schubertcheck_PROGRAMS = tests/runtests tests/module/alt-auth-t			    \
89*bf6873c5SCy Schubert	tests/module/bad-authtok-t tests/module/basic-t			    \
90*bf6873c5SCy Schubert	tests/module/cache-cleanup-t tests/module/cache-t		    \
91*bf6873c5SCy Schubert	tests/module/expired-t tests/module/fast-anon-t tests/module/fast-t \
92*bf6873c5SCy Schubert	tests/module/long-t tests/module/no-cache-t tests/module/pam-user-t \
93*bf6873c5SCy Schubert	tests/module/password-t tests/module/pkinit-t tests/module/realm-t  \
94*bf6873c5SCy Schubert	tests/module/stacked-t tests/module/trace-t tests/pam-util/args-t   \
95*bf6873c5SCy Schubert	tests/pam-util/fakepam-t tests/pam-util/logging-t		    \
96*bf6873c5SCy Schubert	tests/pam-util/options-t tests/pam-util/vector-t		    \
97*bf6873c5SCy Schubert	tests/portable/asprintf-t tests/portable/mkstemp-t		    \
98*bf6873c5SCy Schubert	tests/portable/strndup-t
99*bf6873c5SCy Schuberttests_runtests_CPPFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \
100*bf6873c5SCy Schubert	-DC_TAP_BUILD='"$(abs_top_builddir)/tests"'
101*bf6873c5SCy Schubertcheck_LIBRARIES = tests/fakepam/libfakepam.a tests/tap/libtap.a
102*bf6873c5SCy Schuberttests_fakepam_libfakepam_a_SOURCES = tests/fakepam/config.c		   \
103*bf6873c5SCy Schubert	tests/fakepam/data.c tests/fakepam/general.c			   \
104*bf6873c5SCy Schubert	tests/fakepam/internal.h tests/fakepam/kuserok.c		   \
105*bf6873c5SCy Schubert	tests/fakepam/logging.c tests/fakepam/pam.h tests/fakepam/script.c \
106*bf6873c5SCy Schubert	tests/fakepam/script.h
107*bf6873c5SCy Schuberttests_tap_libtap_a_CPPFLAGS = $(KADM5CLNT_CPPFLAGS) $(AM_CPPFLAGS)
108*bf6873c5SCy Schuberttests_tap_libtap_a_SOURCES = tests/tap/basic.c tests/tap/basic.h	\
109*bf6873c5SCy Schubert	tests/tap/kadmin.c tests/tap/kadmin.h tests/tap/kerberos.c	\
110*bf6873c5SCy Schubert	tests/tap/kerberos.h tests/tap/macros.h tests/tap/process.c	\
111*bf6873c5SCy Schubert	tests/tap/process.h tests/tap/string.c tests/tap/string.h
112*bf6873c5SCy Schubert
113*bf6873c5SCy Schubert# The list of objects and libraries used for module testing by programs that
114*bf6873c5SCy Schubert# link with the fake PAM library or with both it and the module.
115*bf6873c5SCy SchubertMODULE_OBJECTS = module/account.lo module/alt-auth.lo module/auth.lo	   \
116*bf6873c5SCy Schubert	module/cache.lo module/context.lo module/fast.lo module/options.lo \
117*bf6873c5SCy Schubert	module/password.lo module/prompting.lo module/public.lo		   \
118*bf6873c5SCy Schubert	module/setcred.lo module/support.lo pam-util/libpamutil.la	   \
119*bf6873c5SCy Schubert	tests/fakepam/libfakepam.a
120*bf6873c5SCy Schubert
121*bf6873c5SCy Schubert# The test programs themselves.
122*bf6873c5SCy Schuberttests_module_alt_auth_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
123*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
124*bf6873c5SCy Schuberttests_module_bad_authtok_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
125*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
126*bf6873c5SCy Schuberttests_module_basic_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
127*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
128*bf6873c5SCy Schuberttests_module_cache_cleanup_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
129*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
130*bf6873c5SCy Schuberttests_module_cache_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
131*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
132*bf6873c5SCy Schuberttests_module_expired_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a	\
133*bf6873c5SCy Schubert	portable/libportable.la $(KADM5CLNT_LDFLAGS) $(KADM5CLNT_LIBS)	\
134*bf6873c5SCy Schubert	$(KRB5_LIBS)
135*bf6873c5SCy Schuberttests_module_fast_anon_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
136*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
137*bf6873c5SCy Schuberttests_module_fast_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
138*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
139*bf6873c5SCy Schuberttests_module_long_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
140*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
141*bf6873c5SCy Schuberttests_module_no_cache_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
142*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
143*bf6873c5SCy Schuberttests_module_pam_user_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
144*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
145*bf6873c5SCy Schuberttests_module_password_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
146*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
147*bf6873c5SCy Schuberttests_module_pkinit_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
148*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
149*bf6873c5SCy Schuberttests_module_realm_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
150*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
151*bf6873c5SCy Schuberttests_module_stacked_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
152*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
153*bf6873c5SCy Schuberttests_module_trace_t_LDADD = $(MODULE_OBJECTS) tests/tap/libtap.a \
154*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
155*bf6873c5SCy Schuberttests_pam_util_args_t_LDADD = pam-util/libpamutil.la	\
156*bf6873c5SCy Schubert	tests/fakepam/libfakepam.a tests/tap/libtap.a	\
157*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
158*bf6873c5SCy Schuberttests_pam_util_fakepam_t_LDADD = tests/fakepam/libfakepam.a	\
159*bf6873c5SCy Schubert	tests/tap/libtap.a portable/libportable.la
160*bf6873c5SCy Schuberttests_pam_util_logging_t_LDADD = pam-util/libpamutil.la	\
161*bf6873c5SCy Schubert	tests/fakepam/libfakepam.a tests/tap/libtap.a	\
162*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
163*bf6873c5SCy Schuberttests_pam_util_options_t_LDADD = pam-util/libpamutil.la	\
164*bf6873c5SCy Schubert	tests/fakepam/libfakepam.a tests/tap/libtap.a	\
165*bf6873c5SCy Schubert	portable/libportable.la $(KRB5_LIBS)
166*bf6873c5SCy Schuberttests_pam_util_vector_t_LDADD = pam-util/libpamutil.la	\
167*bf6873c5SCy Schubert	tests/fakepam/libfakepam.a tests/tap/libtap.a	\
168*bf6873c5SCy Schubert	portable/libportable.la
169*bf6873c5SCy Schuberttests_portable_asprintf_t_SOURCES = tests/portable/asprintf-t.c \
170*bf6873c5SCy Schubert	tests/portable/asprintf.c
171*bf6873c5SCy Schuberttests_portable_asprintf_t_LDADD = tests/tap/libtap.a portable/libportable.la
172*bf6873c5SCy Schuberttests_portable_mkstemp_t_SOURCES = tests/portable/mkstemp-t.c \
173*bf6873c5SCy Schubert	tests/portable/mkstemp.c
174*bf6873c5SCy Schuberttests_portable_mkstemp_t_LDADD = tests/tap/libtap.a portable/libportable.la
175*bf6873c5SCy Schuberttests_portable_strndup_t_SOURCES = tests/portable/strndup-t.c \
176*bf6873c5SCy Schubert	tests/portable/strndup.c
177*bf6873c5SCy Schuberttests_portable_strndup_t_LDADD = tests/tap/libtap.a portable/libportable.la
178*bf6873c5SCy Schubert
179*bf6873c5SCy Schubertcheck-local: $(check_PROGRAMS)
180*bf6873c5SCy Schubert	cd tests && ./runtests -l '$(abs_top_srcdir)/tests/TESTS'
181*bf6873c5SCy Schubert
182*bf6873c5SCy Schubert# Used by maintainers to check the source code with cppcheck.
183*bf6873c5SCy Schubertcheck-cppcheck:
184*bf6873c5SCy Schubert	cd $(abs_top_srcdir) &&						\
185*bf6873c5SCy Schubert	    find . -name .git -prune -o -name '*.[ch]' -print		\
186*bf6873c5SCy Schubert	    | cppcheck -q --force --error-exitcode=2 --file-list=-	\
187*bf6873c5SCy Schubert		--suppressions-list=tests/data/cppcheck.supp		\
188*bf6873c5SCy Schubert		--enable=warning,performance,portability,style
189*bf6873c5SCy Schubert
190*bf6873c5SCy Schubert# The full path to valgrind and its options, used when doing valgrind
191*bf6873c5SCy Schubert# testing.
192*bf6873c5SCy SchubertVALGRIND_COMMAND = $(PATH_VALGRIND) --leak-check=full			\
193*bf6873c5SCy Schubert        --trace-children=yes						\
194*bf6873c5SCy Schubert	--trace-children-skip=/bin/sh,*/generate-krb5-conf		\
195*bf6873c5SCy Schubert	--suppressions=$(abs_top_srcdir)/tests/data/valgrind.supp	\
196*bf6873c5SCy Schubert        --log-file=$(abs_top_builddir)/tests/tmp/valgrind/log.%p
197*bf6873c5SCy Schubert
198*bf6873c5SCy Schubert# Used by maintainers to run the main test suite under valgrind.
199*bf6873c5SCy Schubertcheck-valgrind: $(check_PROGRAMS)
200*bf6873c5SCy Schubert	rm -rf $(abs_top_builddir)/tests/tmp
201*bf6873c5SCy Schubert	mkdir $(abs_top_builddir)/tests/tmp
202*bf6873c5SCy Schubert	mkdir $(abs_top_builddir)/tests/tmp/valgrind
203*bf6873c5SCy Schubert	C_TAP_VALGRIND="$(VALGRIND_COMMAND)" tests/runtests \
204*bf6873c5SCy Schubert	    -l '$(abs_top_srcdir)/tests/TESTS'
205*bf6873c5SCy Schubert
206*bf6873c5SCy Schubert# Used by maintainers to reformat all source code using clang-format and
207*bf6873c5SCy Schubert# excluding some files.
208*bf6873c5SCy Schubertreformat:
209*bf6873c5SCy Schubert	find . -name '*.[ch]' \! -name krb5-profile.c -print \
210*bf6873c5SCy Schubert	    | xargs clang-format -style=file -i
211