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