Makefile.am 15 KB
Newer Older
1
# Automake makefile for wallet.
2
#
3
# Written by Russ Allbery <eagle@eyrie.org>
4
# Copyright 2016 Russ Allbery <eagle@eyrie.org>
5
# Copyright 2006, 2007, 2008, 2010, 2013, 2014
6
#     The Board of Trustees of the Leland Stanford Junior University
7
#
8
# See LICENSE for licensing terms.
9

10
11
12
13
14
15
16
17
# These variables exist only for the use of the Debian packaging and similar
# situations and aren't normally set.  We want to honor them if they're set
# in the environment, as well as via make arguments.
#
# WALLET_PERL_FLAGS are additional flags to pass to Build.PL when building
# the Makefile.
WALLET_PERL_FLAGS ?=

18
19
20
21
# These two lists of files are needed for Perl builds and for the test suite
# and are not generated or touched by configure.  They're listed here to be
# added to EXTRA_DIST and so that they can be copied over properly for
# builddir != srcdir builds.
22
PERL_FILES = perl/Build.PL perl/MANIFEST perl/MANIFEST.SKIP perl/create-ddl \
23
24
25
26
27
28
29
	perl/lib/Wallet/ACL.pm perl/lib/Wallet/ACL/Base.pm		    \
	perl/lib/Wallet/ACL/Krb5.pm perl/lib/Wallet/ACL/Krb5/Regex.pm	    \
	perl/lib/Wallet/ACL/LDAP/Attribute.pm perl/lib/Wallet/ACL/NetDB.pm  \
	perl/lib/Wallet/ACL/NetDB/Root.pm perl/lib/Wallet/Admin.pm	    \
	perl/lib/Wallet/Config.pm perl/lib/Wallet/Database.pm		    \
	perl/lib/Wallet/Kadmin.pm perl/lib/Wallet/Kadmin/Heimdal.pm	    \
	perl/lib/Wallet/Kadmin/MIT.pm perl/lib/Wallet/Object/Base.pm	    \
30
31
32
33
34
	perl/lib/Wallet/Object/Duo.pm					    \
	perl/lib/Wallet/Object/Duo/LDAPProxy.pm				    \
	perl/lib/Wallet/Object/Duo/PAM.pm perl/lib/Wallet/Object/Duo/RDP.pm \
	perl/lib/Wallet/Object/Duo/RadiusProxy.pm			    \
	perl/lib/Wallet/Object/File.pm perl/lib/Wallet/Object/Keytab.pm	    \
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	perl/lib/Wallet/Object/WAKeyring.pm				    \
	perl/lib/Wallet/Policy/Stanford.pm perl/lib/Wallet/Report.pm	    \
	perl/lib/Wallet/Schema.pm perl/lib/Wallet/Server.pm		    \
	perl/lib/Wallet/Schema/Result/Acl.pm				    \
	perl/lib/Wallet/Schema/Result/AclEntry.pm			    \
	perl/lib/Wallet/Schema/Result/AclHistory.pm			    \
	perl/lib/Wallet/Schema/Result/AclScheme.pm			    \
	perl/lib/Wallet/Schema/Result/Duo.pm				    \
	perl/lib/Wallet/Schema/Result/Enctype.pm			    \
	perl/lib/Wallet/Schema/Result/Flag.pm				    \
	perl/lib/Wallet/Schema/Result/KeytabEnctype.pm			    \
	perl/lib/Wallet/Schema/Result/KeytabSync.pm			    \
	perl/lib/Wallet/Schema/Result/Object.pm				    \
	perl/lib/Wallet/Schema/Result/ObjectHistory.pm			    \
	perl/lib/Wallet/Schema/Result/SyncTarget.pm			    \
	perl/lib/Wallet/Schema/Result/Type.pm				    \
	perl/sql/Wallet-Schema-0.07-0.08-MySQL.sql			    \
	perl/sql/Wallet-Schema-0.07-0.08-SQLite.sql			    \
	perl/sql/Wallet-Schema-0.07-MySQL.sql				    \
	perl/sql/Wallet-Schema-0.07-SQLite.sql				    \
	perl/sql/Wallet-Schema-0.08-0.09-MySQL.sql			    \
	perl/sql/Wallet-Schema-0.08-0.09-PostgreSQL.sql			    \
	perl/sql/Wallet-Schema-0.08-0.09-SQLite.sql			    \
	perl/sql/Wallet-Schema-0.08-MySQL.sql				    \
	perl/sql/Wallet-Schema-0.08-PostgreSQL.sql			    \
	perl/sql/Wallet-Schema-0.08-SQLite.sql				    \
	perl/sql/Wallet-Schema-0.09-MySQL.sql				    \
	perl/sql/Wallet-Schema-0.09-PostgreSQL.sql			    \
63
64
65
66
67
68
69
70
71
72
73
	perl/sql/Wallet-Schema-0.09-SQLite.sql				    \
	perl/sql/Wallet-Schema-0.09-0.10-MySQL.sql			    \
	perl/sql/Wallet-Schema-0.09-0.10-PostgreSQL.sql			    \
	perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql			    \
	perl/sql/Wallet-Schema-0.10-MySQL.sql				    \
	perl/sql/Wallet-Schema-0.10-PostgreSQL.sql			    \
	perl/sql/Wallet-Schema-0.10-SQLite.sql perl/t/data/README	    \
	perl/t/data/duo/integration.json				    \
	perl/t/data/duo/integration-ldap.json				    \
	perl/t/data/duo/integration-radius.json				    \
	perl/t/data/duo/integration-rdp.json perl/t/data/duo/keys.json	    \
74
75
76
77
78
79
	perl/t/data/keytab-fake perl/t/data/keytab.conf			    \
	perl/t/data/netdb-fake perl/t/data/netdb.conf perl/t/data/perl.conf \
	perl/t/docs/pod-spelling.t perl/t/docs/pod.t perl/t/general/acl.t   \
	perl/t/general/admin.t perl/t/general/config.t			    \
	perl/t/general/init.t perl/t/general/report.t			    \
	perl/t/general/server.t perl/t/lib/Util.pm perl/t/object/base.t	    \
80
81
82
	perl/t/object/duo.t perl/t/object/duo-ldap.t			    \
	perl/t/object/duo-pam.t perl/t/object/duo-radius.t		    \
	perl/t/object/duo-rdp.t perl/t/object/file.t perl/t/object/keytab.t \
83
84
85
	perl/t/object/wa-keyring.t perl/t/policy/stanford.t		    \
	perl/t/style/minimum-version.t perl/t/style/strict.t		    \
	perl/t/util/kadmin.t perl/t/verifier/basic.t			    \
86
87
88
89
	perl/t/verifier/ldap-attr.t perl/t/verifier/netdb.t

# Directories that have to be created in builddir != srcdir builds before
# copying PERL_FILES over.
90
91
92
93
94
95
96
97
PERL_DIRECTORIES = perl perl/lib perl/lib/Wallet perl/lib/Wallet/ACL	    \
	perl/lib/Wallet/ACL/Krb5 perl/lib/Wallet/ACL/LDAP		    \
	perl/lib/Wallet/ACL/NetDB perl/lib/Wallet/Kadmin		    \
	perl/lib/Wallet/Object perl/lib/Wallet/Object/Duo		    \
	perl/lib/Wallet/Policy perl/lib/Wallet/Schema			    \
	perl/lib/Wallet/Schema/Result perl/sql perl/t perl/t/data	    \
	perl/t/data/duo perl/t/docs perl/t/general perl/t/lib perl/t/object \
	perl/t/policy perl/t/style perl/t/util perl/t/verifier
98

99
ACLOCAL_AMFLAGS = -I m4
100
101
102
103
104
EXTRA_DIST = .gitignore LICENSE autogen client/wallet.pod		   \
	client/wallet-rekey.pod config/allow-extract config/keytab	   \
	config/keytab.acl config/wallet config/wallet-report.acl	   \
	docs/design contrib/README contrib/convert-srvtab-db		   \
	contrib/used-principals contrib/wallet-contacts			   \
105
	contrib/wallet-rekey-periodic contrib/wallet-rekey-periodic.8	   \
106
	contrib/wallet-summary contrib/wallet-summary.8			   \
107
108
109
	contrib/wallet-unknown-hosts contrib/wallet-unknown-hosts.8	   \
	docs/design-acl docs/design-api docs/netdb-role-api docs/notes	   \
	docs/objects-and-schemes docs/setup docs/stanford-naming	   \
110
111
112
113
114
115
	examples/stanford.conf tests/HOWTO tests/TESTS tests/config/README \
	tests/data/allow-extract tests/data/basic.conf tests/data/cmd-fake \
	tests/data/cmd-wrapper tests/data/fake-data tests/data/fake-kadmin \
	tests/data/fake-keytab tests/data/fake-keytab-2			   \
	tests/data/fake-keytab-foreign tests/data/fake-keytab-merge	   \
	tests/data/fake-keytab-old tests/data/fake-keytab-partial	   \
116
117
	tests/data/fake-keytab-partial-result tests/data/fake-keytab-rekey \
	tests/data/fake-keytab-unknown tests/data/fake-srvtab		   \
118
	tests/data/full.conf tests/data/perl.conf tests/data/wallet.conf   \
119
120
121
122
	tests/docs/pod-spelling-t tests/docs/pod-t			   \
	tests/perl/minimum-version-t tests/perl/strict-t		   \
	tests/server/admin-t tests/server/backend-t tests/server/keytab-t  \
	tests/server/report-t tests/tap/kerberos.sh tests/tap/libtap.sh	   \
123
124
	tests/tap/perl/Test/RRA.pm tests/tap/perl/Test/RRA/Automake.pm	   \
	tests/tap/perl/Test/RRA/Config.pm tests/tap/remctl.sh		   \
125
	tests/util/xmalloc-t $(PERL_FILES)
126

127
# Supporting convenience libraries used by other targets.
128
noinst_LIBRARIES = portable/libportable.a util/libutil.a
129
130
portable_libportable_a_SOURCES = portable/dummy.c portable/krb5-extra.c	\
	portable/krb5.h portable/macros.h portable/stdbool.h		\
131
	portable/system.h portable/uio.h
132
portable_libportable_a_CPPFLAGS = $(KRB5_CPPFLAGS)
133
portable_libportable_a_LIBADD = $(LIBOBJS)
134
135
136
util_libutil_a_SOURCES = util/macros.h util/messages-krb5.c		    \
	util/messages-krb5.h util/messages.c util/messages.h util/xmalloc.c \
	util/xmalloc.h
137
util_libutil_a_CPPFLAGS = $(KRB5_CPPFLAGS)
138

139
# The private library used by both wallet and wallet-rekey.
140
141
142
143
144
noinst_LIBRARIES += client/libwallet.a
client_libwallet_a_SOURCES = client/file.c client/internal.h client/keytab.c \
	client/krb5.c client/options.c client/remctl.c client/srvtab.c
client_libwallet_a_CPPFLAGS = $(REMCTL_CPPFLAGS) $(KRB5_CPPFLAGS)

145
# The client and server programs.
146
bin_PROGRAMS = client/wallet client/wallet-rekey
147
dist_sbin_SCRIPTS = server/keytab-backend server/wallet-admin \
148
	server/wallet-backend server/wallet-report
149
150
client_wallet_CPPFLAGS = $(REMCTL_CPPFLAGS) $(KRB5_CPPFLAGS)
client_wallet_LDFLAGS = $(REMCTL_LDFLAGS) $(KRB5_LDFLAGS)
151
152
153
154
155
156
client_wallet_LDADD = client/libwallet.a util/libutil.a \
	portable/libportable.a $(REMCTL_LIBS) $(KRB5_LIBS)
client_wallet_rekey_CPPFLAGS = $(REMCTL_CPPFLAGS) $(KRB5_CPPFLAGS)
client_wallet_rekey_LDFLAGS = $(REMCTL_LDFLAGS) $(KRB5_LDFLAGS)
client_wallet_rekey_LDADD = client/libwallet.a util/libutil.a \
	portable/libportable.a $(REMCTL_LIBS) $(KRB5_LIBS)
157

158
# The manual pages.
159
dist_man_MANS = client/wallet.1 client/wallet-rekey.1 server/keytab-backend.8 \
160
	server/wallet-admin.8 server/wallet-backend.8 server/wallet-report.8
161

162
163
164
165
166
# Install the SQL files that are used by the server code to do upgrades.
dist_pkgdata_DATA = perl/sql/Wallet-Schema-0.07-0.08-MySQL.sql	\
	perl/sql/Wallet-Schema-0.07-0.08-SQLite.sql		\
	perl/sql/Wallet-Schema-0.07-MySQL.sql			\
	perl/sql/Wallet-Schema-0.07-SQLite.sql			\
167
168
169
	perl/sql/Wallet-Schema-0.08-0.09-MySQL.sql		\
	perl/sql/Wallet-Schema-0.08-0.09-PostgreSQL.sql		\
	perl/sql/Wallet-Schema-0.08-0.09-SQLite.sql		\
170
171
	perl/sql/Wallet-Schema-0.08-MySQL.sql			\
	perl/sql/Wallet-Schema-0.08-PostgreSQL.sql		\
172
173
174
175
	perl/sql/Wallet-Schema-0.08-SQLite.sql			\
	perl/sql/Wallet-Schema-0.09-MySQL.sql			\
	perl/sql/Wallet-Schema-0.09-PostgreSQL.sql		\
	perl/sql/Wallet-Schema-0.09-SQLite.sql
176

177
# A set of flags for warnings.  Add -O because gcc won't find some warnings
Russ Allbery's avatar
Russ Allbery committed
178
179
180
# without optimization turned on.  Desirable warnings that can't be turned
# on due to other problems:
#
181
#     -Wconversion      http://bugs.debian.org/488884 (htons warnings)
Russ Allbery's avatar
Russ Allbery committed
182
#
183
# Last checked against gcc 4.8.2 (2014-04-12).  -D_FORTIFY_SOURCE=2 enables
184
185
# warn_unused_result attribute markings on glibc functions on Linux, which
# catches a few more issues.
186
187
188
189
190
191
192
193
194
195
196
197
198
if WARNINGS_GCC
    WARNINGS = -g -O -fstrict-overflow -fstrict-aliasing -D_FORTIFY_SOURCE=2 \
        -Wall -Wextra -Wendif-labels -Wformat=2 -Winit-self -Wswitch-enum    \
        -Wstrict-overflow=5 -Wmissing-format-attribute -Wfloat-equal         \
        -Wdeclaration-after-statement -Wshadow -Wpointer-arith               \
        -Wbad-function-cast -Wcast-align -Wwrite-strings -Wjump-misses-init  \
        -Wlogical-op -Wstrict-prototypes -Wold-style-definition              \
        -Wmissing-prototypes -Wnormalized=nfc -Wpacked -Wredundant-decls     \
        -Wnested-externs -Winline -Wvla -Werror
endif
if WARNINGS_CLANG
    WARNINGS = -Weverything -Wno-padded
endif
199

200
warnings:
201
202
203
	$(MAKE) V=0 CFLAGS='$(WARNINGS)' KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)'
	$(MAKE) V=0 CFLAGS='$(WARNINGS)' \
	    KRB5_CPPFLAGS='$(KRB5_CPPFLAGS_GCC)' $(check_PROGRAMS)
204

205
# Remove some additional files.
206
207
CLEANFILES = perl/t/lib/Test/RRA.pm perl/t/lib/Test/RRA/Automake.pm \
	perl/t/lib/Test/RRA/Config.pm
208
209
210
211
212
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile		     \
	build-aux/depcomp build-aux/install-sh build-aux/missing	     \
	client/wallet.1 config.h.in config.h.in~ configure		     \
	contrib/wallet-report.8 server/keytab-backend.8			     \
	server/wallet-admin.8 server/wallet-backend.8 server/wallet-report.8
213

214
215
216
217
218
219
# Take appropriate actions in the Perl directory as well.  We don't want to
# always build the Perl directory in all-local, since otherwise Automake does
# this for every target, which overrides some hacks we have to do for Debian
# packaging.
all-local: perl/blib/lib/Wallet/Config.pm

220
221
222
223
224
225
226
227
perl/blib/lib/Wallet/Config.pm: $(srcdir)/perl/lib/Wallet/Config.pm
	set -e; if [ x"$(builddir)" != x"$(srcdir)" ] ; then		\
	    for d in $(PERL_DIRECTORIES) ; do				\
		[ -d "$(builddir)/$$d" ] || mkdir "$(builddir)/$$d" ;	\
	    done ;							\
	    for f in $(PERL_FILES) ; do					\
		cp "$(srcdir)/$$f" "$(builddir)/$$f" ;			\
	    done ;							\
228
	fi
229
	$(MKDIR_P) perl/t/lib/Test/RRA
230
231
232
	$(INSTALL_DATA) $(srcdir)/tests/tap/perl/Test/RRA.pm perl/t/lib/Test/
	$(INSTALL_DATA) $(srcdir)/tests/tap/perl/Test/RRA/Config.pm \
	    perl/t/lib/Test/RRA/
233
234
	cd perl && perl Build.PL $(WALLET_PERL_FLAGS)
	cd perl && ./Build
235

236
237
238
239
240
241
242
243
# This is a really ugly hack to only honor prefix when running make install
# under Automake's distcheck.
#
# Automake insists on not using DESTDIR for distcheck and instead relying on
# prefix, but we don't want Perl module installation to follow prefix since
# that may result in a module install directory that isn't in Perl's search
# path.  So, if and only if we're running under distcheck, we pass the
# prefix in as --install_base.
244
install-data-local:
245
246
247
248
249
	set -e; flags= ;						\
	case "$(prefix)" in						\
	    */_inst) flags="--install_base $(prefix)" ;;		\
	esac ;								\
	cd perl && ./Build install $$flags --destdir '$(DESTDIR)'
250

251
# ExtUtils::MakeMaker really likes moving the Makefile aside.
252
clean-local:
253
254
255
	set -e; if [ -f "perl/Build" ] ; then		\
	    cd perl && ./Build realclean ;		\
	fi
256

257
258
# Remove the files that we copy over if and only if builddir != srcdir.
distclean-local:
259
	set -e; if [ x"$(builddir)" != x"$(srcdir)" ] ; then	\
260
261
262
	    for f in $(PERL_FILES) ; do				\
		rm -f "$(builddir)/$$f" ;			\
	    done ;						\
263
264
	fi

265
# The bits below are for the test suite, not for the main package.
266
267
268
269
270
check_PROGRAMS = tests/runtests tests/portable/asprintf-t	\
	tests/portable/mkstemp-t tests/portable/setenv-t	\
	tests/portable/snprintf-t tests/portable/strlcat-t	\
	tests/portable/strlcpy-t tests/util/messages-krb5-t	\
	tests/util/messages-t tests/util/xmalloc
271
272
273
274
275
tests_runtests_CPPFLAGS = -DSOURCE='"$(abs_top_srcdir)/tests"' \
	-DBUILD='"$(abs_top_builddir)/tests"'
check_LIBRARIES = tests/tap/libtap.a
tests_tap_libtap_a_CPPFLAGS = -I$(abs_top_srcdir)/tests $(KRB5_CPPFLAGS)
tests_tap_libtap_a_SOURCES = tests/tap/basic.c tests/tap/basic.h	\
276
277
278
	tests/tap/kerberos.c tests/tap/kerberos.h tests/tap/macros.h	\
	tests/tap/messages.c tests/tap/messages.h tests/tap/process.c	\
	tests/tap/process.h tests/tap/string.c tests/tap/string.h
279
280
281

# All of the test programs.
tests_portable_asprintf_t_SOURCES = tests/portable/asprintf-t.c \
282
283
284
285
286
287
288
289
	tests/portable/asprintf.c
tests_portable_asprintf_t_LDADD = tests/tap/libtap.a portable/libportable.a
tests_portable_mkstemp_t_SOURCES = tests/portable/mkstemp-t.c \
	tests/portable/mkstemp.c
tests_portable_mkstemp_t_LDADD = tests/tap/libtap.a portable/libportable.a
tests_portable_setenv_t_SOURCES = tests/portable/setenv-t.c \
	tests/portable/setenv.c
tests_portable_setenv_t_LDADD = tests/tap/libtap.a portable/libportable.a
290
tests_portable_snprintf_t_SOURCES = tests/portable/snprintf-t.c \
291
292
	tests/portable/snprintf.c
tests_portable_snprintf_t_LDADD = tests/tap/libtap.a portable/libportable.a
293
tests_portable_strlcat_t_SOURCES = tests/portable/strlcat-t.c \
294
295
	tests/portable/strlcat.c
tests_portable_strlcat_t_LDADD = tests/tap/libtap.a portable/libportable.a
296
tests_portable_strlcpy_t_SOURCES = tests/portable/strlcpy-t.c \
297
298
299
300
301
302
303
	tests/portable/strlcpy.c
tests_portable_strlcpy_t_LDADD = tests/tap/libtap.a portable/libportable.a
tests_util_messages_krb5_t_CPPFLAGS = $(KRB5_CPPFLAGS)
tests_util_messages_krb5_t_LDFLAGS = $(KRB5_LDFLAGS)
tests_util_messages_krb5_t_LDADD = tests/tap/libtap.a util/libutil.a \
	portable/libportable.a $(KRB5_LIBS)
tests_util_messages_t_LDADD = tests/tap/libtap.a util/libutil.a \
304
	portable/libportable.a
305
tests_util_xmalloc_LDADD = util/libutil.a portable/libportable.a
306
307

check-local: $(check_PROGRAMS)
308
	cd tests && ./runtests -l $(abs_top_srcdir)/tests/TESTS
309
	@echo ''
310
	cd perl && ./Build test
311
312
313
314
315

# Alas, we have to disable this check because there's no way to do an
# uninstall from Perl.
distuninstallcheck:
	@: