1#
2# Copyright (c) 2002, 2007 SuSE Linux AG, Germany
3#
4# Author: Thorsten Kukuk <kukuk@suse.de>
5#
6
7AUTOMAKE_OPTIONS = \
8	1.14 \
9	dist-bzip2 \
10	dist-xz \
11	filename-length-max=99 \
12	gnits \
13	subdir-objects
14
15ACLOCAL_AMFLAGS = -I build-aux/m4
16
17AM_CPPFLAGS = -I$(srcdir)/lib
18AM_CFLAGS = $(WARN_CFLAGS) $(OPTI_FLAGS)
19AM_LDFLAGS = $(RELRO_FLAG) $(BINDNOW_FLAG)
20
21SCRIPTS_AUX = $(srcdir)/build-aux/scripts
22STAMP = echo timestamp >
23
24@VALGRIND_CHECK_RULES@
25
26TEST_EXTENSIONS = .pl
27
28EXTRA_DIST = \
29	LICENSING \
30	THANKS \
31	lib/alg-yescrypt-platform.c \
32	lib/crypt.h.in \
33	lib/hashes.conf \
34	lib/libcrypt.map.in \
35	lib/libcrypt.minver \
36	lib/xcrypt.h.in \
37	build-aux/scripts/BuildCommon.pm \
38	build-aux/scripts/check-perlcritic-config \
39	build-aux/scripts/compute-symver-floor \
40	build-aux/scripts/expand-selected-hashes \
41	build-aux/scripts/gen-crypt-h \
42	build-aux/scripts/gen-crypt-hashes-h \
43	build-aux/scripts/gen-crypt-symbol-vers-h \
44	build-aux/scripts/gen-libcrypt-map \
45	build-aux/scripts/move-if-change \
46	build-aux/scripts/skip-if-exec-format-error \
47	test/TestCommon.pm \
48	test/symbols-compat.pl \
49	test/symbols-renames.pl \
50	test/symbols-static.pl
51
52notrans_dist_man3_MANS = \
53	doc/crypt.3 \
54	doc/crypt_checksalt.3 \
55	doc/crypt_gensalt.3 \
56	doc/crypt_gensalt_ra.3 \
57	doc/crypt_gensalt_rn.3 \
58	doc/crypt_preferred_method.3 \
59	doc/crypt_r.3 \
60	doc/crypt_ra.3 \
61	doc/crypt_rn.3
62notrans_dist_man5_MANS = \
63	doc/crypt.5
64
65nodist_include_HEADERS = \
66	crypt.h
67nodist_noinst_HEADERS = \
68	crypt-hashes.h \
69	crypt-symbol-vers.h
70noinst_HEADERS = \
71	lib/alg-des.h \
72	lib/alg-gost3411-2012-const.h \
73	lib/alg-gost3411-2012-core.h \
74	lib/alg-gost3411-2012-hmac.h \
75	lib/alg-gost3411-2012-precalc.h \
76	lib/alg-gost3411-2012-ref.h \
77	lib/alg-hmac-sha1.h \
78	lib/alg-md4.h \
79	lib/alg-md5.h \
80	lib/alg-sha1.h \
81	lib/alg-sha256.h \
82	lib/alg-sha512.h \
83	lib/alg-yescrypt.h \
84	lib/byteorder.h \
85	lib/crypt-obsolete.h \
86	lib/crypt-port.h \
87	test/des-cases.h \
88	test/ka-table.inc
89
90if ENABLE_XCRYPT_COMPAT_FILES
91nodist_include_HEADERS += xcrypt.h
92endif
93
94noinst_PROGRAMS = \
95	lib/gen-des-tables
96
97lib_LTLIBRARIES = \
98	libcrypt.la
99
100libcrypt_la_SOURCES = \
101	lib/alg-des-tables.c \
102	lib/alg-des.c \
103	lib/alg-gost3411-2012-core.c \
104	lib/alg-gost3411-2012-hmac.c \
105	lib/alg-hmac-sha1.c \
106	lib/alg-md4.c \
107	lib/alg-md5.c \
108	lib/alg-sha1.c \
109	lib/alg-sha256.c \
110	lib/alg-sha512.c \
111	lib/alg-yescrypt-common.c \
112	lib/alg-yescrypt-opt.c \
113	lib/crypt-bcrypt.c \
114	lib/crypt-des.c \
115	lib/crypt-gensalt-static.c \
116	lib/crypt-gost-yescrypt.c \
117	lib/crypt-md5.c \
118	lib/crypt-nthash.c \
119	lib/crypt-pbkdf1-sha1.c \
120	lib/crypt-scrypt.c \
121	lib/crypt-sha256.c \
122	lib/crypt-sha512.c \
123	lib/crypt-static.c \
124	lib/crypt-sunmd5.c \
125	lib/crypt-yescrypt.c \
126	lib/crypt.c \
127	lib/util-base64.c \
128	lib/util-gensalt-sha.c \
129	lib/util-get-random-bytes.c \
130	lib/util-make-failure-token.c \
131	lib/util-xbzero.c \
132	lib/util-xstrcpy.c
133
134pkgconfig_DATA = libxcrypt.pc
135
136# Install libcrypt.pc symlink to libxcrypt.pc file.
137phony_targets = \
138	install-data-hook-pkgconfig uninstall-hook-pkgconfig
139install-data-hook: install-data-hook-pkgconfig
140uninstall_hook_targets = \
141	uninstall-hook-pkgconfig
142install-data-hook-pkgconfig:
143	cd $(DESTDIR)$(pkgconfigdir) && \
144		$(LN_S) -f libxcrypt.pc libcrypt.pc
145uninstall-hook-pkgconfig:
146	-rm -f $(DESTDIR)$(pkgconfigdir)/libcrypt.pc
147
148# Build libcrypt.so.2 if obsolete APIs are excluded, libcrypt.so.1 otherwise.
149if ENABLE_OBSOLETE_API
150libcrypt_la_VERSION = 2:0:1
151else
152libcrypt_la_VERSION = 2:0:0
153endif
154
155libcrypt_la_LDFLAGS = -version-info $(libcrypt_la_VERSION)
156
157if HAVE_VSCRIPT
158libcrypt_la_LDFLAGS += $(VSCRIPT_LDFLAGS),$(builddir)/libcrypt.map
159endif
160
161libcrypt_la_LDFLAGS += $(UNDEF_FLAG) $(TEXT_RELOC_FLAG) $(AM_LDFLAGS)
162
163libcrypt_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_LIBCRYPT
164
165CONFIG_STATUS_DEPENDENCIES = lib/libcrypt.minver
166EXTRA_libcrypt_la_DEPENDENCIES = libcrypt.map
167CLEANFILES = \
168	Makefile.deps Makefile.deps.T \
169	libcrypt.map libcrypt.map.T libcrypt.map.stamp \
170	crypt-symbol-vers.h crypt-symbol-vers.h.T crypt-symbol-vers.h.stamp \
171	crypt-hashes.h crypt-hashes.h.T crypt-hashes.h.stamp \
172	crypt.h crypt.h.T crypt.h.stamp \
173	xcrypt.h xcrypt.h.T xcrypt.h.stamp \
174	./*.gcda ./*.gcno \
175	lib/*.gcda lib/*.gcno \
176	test/*.gcda test/*.gcno
177
178DISTCLEANFILES = .deps/*.Plo
179
180# Force generated headers to be generated before any source files that
181# might depend on them are compiled.
182Makefile.deps: crypt.h crypt-hashes.h crypt-symbol-vers.h
183	$(AM_V_GEN)LC_ALL=C echo "# Deps" > Makefile.deps.T
184	$(AM_V_at)mv -f Makefile.deps.T Makefile.deps
185
186# Almost everything depends on the generated headers; the generated
187# headers depend on the Makefile; *most* changes to the Makefile won't
188# affect the contents of the generated headers.  Arrange for the
189# timestamps of the generated headers not to change if their contents
190# haven't.  The rule idiom used here was borrowed from GCC's Makefile;
191# in https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/Makefile.in;hb=HEAD
192# search for the phrase "On the use of stamps".
193AM_V_GENS = $(am__v_GENS_@AM_V@)
194am__v_GENS_ = $(am__v_GENS_@AM_DEFAULT_V@)
195am__v_GENS_0 = @echo "  GEN     " $(@:.stamp=);
196am__v_GENS_1 =
197
198libcrypt.map: libcrypt.map.stamp; @:
199libcrypt.map.stamp: \
200		lib/libcrypt.map.in $(SCRIPTS_AUX)/gen-libcrypt-map \
201		$(SCRIPTS_AUX)/BuildCommon.pm Makefile
202	$(AM_V_GENS)LC_ALL=C $(PERL) $(SCRIPTS_AUX)/gen-libcrypt-map \
203	  SYMVER_MIN=$(SYMVER_MIN) \
204	  SYMVER_FLOOR=$(SYMVER_FLOOR) \
205	  COMPAT_ABI=$(COMPAT_ABI) \
206	  $(srcdir)/lib/libcrypt.map.in > libcrypt.map.T
207	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change libcrypt.map.T libcrypt.map
208	$(AM_V_at)$(STAMP) libcrypt.map.stamp
209
210crypt-hashes.h: crypt-hashes.h.stamp; @:
211crypt-hashes.h.stamp: \
212		$(SCRIPTS_AUX)/gen-crypt-hashes-h $(SCRIPTS_AUX)/BuildCommon.pm \
213		lib/hashes.conf Makefile
214	$(AM_V_GENS)LC_ALL=C $(PERL) \
215	  $(SCRIPTS_AUX)/gen-crypt-hashes-h \
216	  $(srcdir)/lib/hashes.conf $(hashes_enabled) > crypt-hashes.h.T
217	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change crypt-hashes.h.T crypt-hashes.h
218	$(AM_V_at)$(STAMP) crypt-hashes.h.stamp
219
220crypt-symbol-vers.h: crypt-symbol-vers.h.stamp; @:
221crypt-symbol-vers.h.stamp: \
222		$(SCRIPTS_AUX)/gen-crypt-symbol-vers-h \
223		$(SCRIPTS_AUX)/BuildCommon.pm \
224		lib/libcrypt.map.in Makefile
225	$(AM_V_GENS)LC_ALL=C $(PERL) \
226	  $(SCRIPTS_AUX)/gen-crypt-symbol-vers-h \
227	  SYMVER_MIN=$(SYMVER_MIN) \
228	  SYMVER_FLOOR=$(SYMVER_FLOOR) \
229	  COMPAT_ABI=$(COMPAT_ABI) \
230	     $(srcdir)/lib/libcrypt.map.in > crypt-symbol-vers.h.T
231	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change crypt-symbol-vers.h.T crypt-symbol-vers.h
232	$(AM_V_at)$(STAMP) crypt-symbol-vers.h.stamp
233
234crypt.h: crypt.h.stamp; @:
235crypt.h.stamp: \
236		$(SCRIPTS_AUX)/gen-crypt-h $(SCRIPTS_AUX)/BuildCommon.pm \
237		lib/crypt.h.in lib/hashes.conf config.h Makefile
238	$(AM_V_GENS)LC_ALL=C $(PERL) \
239	  $(SCRIPTS_AUX)/gen-crypt-h \
240	  $(srcdir)/lib/crypt.h.in config.h \
241	  $(srcdir)/lib/hashes.conf $(hashes_enabled) \
242	  > crypt.h.T
243	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change crypt.h.T crypt.h
244	$(AM_V_at)$(STAMP) crypt.h.stamp
245
246xcrypt.h: xcrypt.h.stamp; @:
247xcrypt.h.stamp: \
248		$(SCRIPTS_AUX)/gen-crypt-h $(SCRIPTS_AUX)/BuildCommon.pm \
249		lib/xcrypt.h.in config.h
250	$(AM_V_GENS)LC_ALL=C $(PERL) \
251	  $(SCRIPTS_AUX)/gen-crypt-h \
252	  $(srcdir)/lib/xcrypt.h.in config.h \
253	  > xcrypt.h.T
254	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change xcrypt.h.T xcrypt.h
255	$(AM_V_at)$(STAMP) xcrypt.h.stamp
256
257install_exec_hook_targets =
258
259if ENABLE_XCRYPT_COMPAT_FILES
260if ENABLE_STATIC
261# Install libxcrypt.a symlink to libcrypt.a file.
262phony_targets += \
263	install-exec-hook-xcrypt-static uninstall-hook-xcrypt-static
264install_exec_hook_targets += \
265	install-exec-hook-xcrypt-static
266uninstall_hook_targets += \
267	uninstall-hook-xcrypt-static
268install-exec-hook-xcrypt-static:
269	cd $(DESTDIR)$(libdir) && \
270		$(LN_S) -f libcrypt.a libxcrypt.a
271uninstall-hook-xcrypt-static:
272	-rm -f $(DESTDIR)$(libdir)/libxcrypt.a
273endif
274
275if ENABLE_SHARED
276# Install libxcrypt.so symlink to libcrypt.so file.
277phony_targets += \
278	install-exec-hook-xcrypt-shared uninstall-hook-xcrypt-shared
279install_exec_hook_targets += \
280	install-exec-hook-xcrypt-shared
281uninstall_hook_targets += \
282	uninstall-hook-xcrypt-shared
283install-exec-hook-xcrypt-shared:
284	cd $(DESTDIR)$(libdir) && \
285		$(LN_S) -f libcrypt.so libxcrypt.so
286uninstall-hook-xcrypt-shared:
287	-rm -f $(DESTDIR)$(libdir)/libxcrypt.so
288endif
289endif
290
291if ENABLE_COMPAT_SUSE
292# When we are being binary compatible, also install symbolic links to
293# mimic SUSE's libowcrypt; any program that uses -lowcrypt in its
294# build, or already has a NEEDED entry for libowcrypt.so.1, will be
295# redirected to libcrypt.  The OW_CRYPT_1.0 symbol versions are already
296# present in libcrypt.so.1.
297#
298# Caution: this hardwires the expected (so)names of the shared
299# libraries involved, libcrypt.so.1 and libowcrypt.so.1.  (We should
300# be able to get away with this because in any circumstance where the
301# soname of libcrypt isn't libcrypt.so.1, ENABLE_OBSOLETE_API should
302# be automatically turned off, and as best I can tell, SUSE only ever
303# shipped libowcrypt.so.1.)
304if ENABLE_OBSOLETE_API
305if ENABLE_STATIC
306phony_targets += \
307	install-exec-hook-libstatic uninstall-hook-libstatic
308install_exec_hook_targets += \
309	install-exec-hook-libstatic
310uninstall_hook_targets += \
311	uninstall-hook-libstatic
312install-exec-hook-libstatic:
313	cd $(DESTDIR)$(libdir) && \
314		$(LN_S) -f libcrypt.a libowcrypt.a
315uninstall-hook-libstatic:
316	-rm -f $(DESTDIR)$(libdir)/libowcrypt.a
317endif
318if ENABLE_SHARED
319phony_targets += \
320	install-exec-hook-libshared uninstall-hook-libshared
321install_exec_hook_targets += \
322	install-exec-hook-libshared
323uninstall_hook_targets += \
324	uninstall-hook-libshared
325install-exec-hook-libshared:
326	cd $(DESTDIR)$(libdir) && \
327		$(LN_S) -f libcrypt.so libowcrypt.so && \
328		$(LN_S) -f libcrypt.so.1 libowcrypt.so.1
329uninstall-hook-libshared:
330	-rm -f  $(DESTDIR)$(libdir)/libowcrypt.so \
331		$(DESTDIR)$(libdir)/libowcrypt.so.1
332endif
333endif
334endif
335
336# The ka-* tests are first in this list because they are the slowest.
337# The list should otherwise be kept in alphabetical order.
338
339check_PROGRAMS = \
340	test/ka-bcrypt \
341	test/ka-bcrypt-a \
342	test/ka-bcrypt-x \
343	test/ka-bcrypt-y \
344	test/ka-bigcrypt \
345	test/ka-bsdicrypt \
346	test/ka-descrypt \
347	test/ka-gost-yescrypt \
348	test/ka-md5crypt \
349	test/ka-nt \
350	test/ka-scrypt \
351	test/ka-sha1crypt \
352	test/ka-sha256crypt \
353	test/ka-sha512crypt \
354	test/ka-sunmd5 \
355	test/ka-yescrypt \
356	test/alg-des \
357	test/alg-gost3411-2012 \
358	test/alg-gost3411-2012-hmac \
359	test/alg-hmac-sha1 \
360	test/alg-md4 \
361	test/alg-md5 \
362	test/alg-pbkdf-hmac-sha256 \
363	test/alg-sha1 \
364	test/alg-sha256 \
365	test/alg-sha512 \
366	test/alg-yescrypt \
367	test/badsalt \
368	test/badsetting \
369	test/byteorder \
370	test/checksalt \
371	test/compile-strong-alias \
372	test/crypt-badargs \
373	test/crypt-gost-yescrypt \
374	test/explicit-bzero \
375	test/gensalt \
376	test/gensalt-extradata \
377	test/gensalt-nthash \
378	test/getrandom-fallbacks \
379	test/getrandom-interface \
380	test/preferred-method \
381	test/short-outbuf \
382	test/special-char-salt
383
384# All of the known-answer tests are compiled from the same source file,
385# with different macros defined.
386test_ka_bcrypt_SOURCES		= test/ka-tester.c
387test_ka_bcrypt_a_SOURCES	= test/ka-tester.c
388test_ka_bcrypt_x_SOURCES	= test/ka-tester.c
389test_ka_bcrypt_y_SOURCES	= test/ka-tester.c
390test_ka_bigcrypt_SOURCES	= test/ka-tester.c
391test_ka_bsdicrypt_SOURCES	= test/ka-tester.c
392test_ka_descrypt_SOURCES	= test/ka-tester.c
393test_ka_gost_yescrypt_SOURCES	= test/ka-tester.c
394test_ka_md5crypt_SOURCES	= test/ka-tester.c
395test_ka_nt_SOURCES		= test/ka-tester.c
396test_ka_scrypt_SOURCES		= test/ka-tester.c
397test_ka_sha1crypt_SOURCES	= test/ka-tester.c
398test_ka_sha256crypt_SOURCES	= test/ka-tester.c
399test_ka_sha512crypt_SOURCES	= test/ka-tester.c
400test_ka_sunmd5_SOURCES		= test/ka-tester.c
401test_ka_yescrypt_SOURCES	= test/ka-tester.c
402
403test_ka_bcrypt_CPPFLAGS		= $(AM_CPPFLAGS) -DTEST_bcrypt
404test_ka_bcrypt_a_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_bcrypt_a
405test_ka_bcrypt_x_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_bcrypt_x
406test_ka_bcrypt_y_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_bcrypt_y
407test_ka_bigcrypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_bigcrypt
408test_ka_bsdicrypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_bsdicrypt
409test_ka_descrypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_descrypt
410test_ka_gost_yescrypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_gost_yescrypt
411test_ka_md5crypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_md5crypt
412test_ka_nt_CPPFLAGS		= $(AM_CPPFLAGS) -DTEST_nt
413test_ka_scrypt_CPPFLAGS		= $(AM_CPPFLAGS) -DTEST_scrypt
414test_ka_sha1crypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_sha1crypt
415test_ka_sha256crypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_sha256crypt
416test_ka_sha512crypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_sha512crypt
417test_ka_sunmd5_CPPFLAGS		= $(AM_CPPFLAGS) -DTEST_sunmd5
418test_ka_yescrypt_CPPFLAGS	= $(AM_CPPFLAGS) -DTEST_yescrypt
419
420if ENABLE_KA_TABLE_GEN
421if ENABLE_SHARED
422# test/ka-table.inc can be regenerated by running test/ka-table-gen.py.
423# This is very slow and requires nonstandard Python libraries and a shared
424# library build of libcrypt already present in the build-tree, so we only
425# do it when explicitly requested.
426regen-ka-table: libcrypt.la
427	$(PYTHON) $(srcdir)/test/ka-table-gen.py > ka-table.inc.T
428	@if cmp -s ka-table.inc.T $(srcdir)/test/ka-table.inc; \
429	then echo ka-table.inc is unchanged; rm ka-table.inc.T; \
430	else echo mv -f ka-table.inc.T $(srcdir)/test/ka-table.inc; \
431	mv -f ka-table.inc.T $(srcdir)/test/ka-table.inc; fi
432phony_targets += regen-ka-table
433CLEANFILES += ka-table.inc.T
434endif
435endif
436
437if ENABLE_OBSOLETE_API
438libcrypt_la_SOURCES += lib/crypt-des-obsolete.c
439check_PROGRAMS += test/des-obsolete test/des-obsolete_r
440endif
441
442TESTS = $(check_PROGRAMS)
443
444if ENABLE_STATIC
445TESTS += test/symbols-static.pl test/symbols-renames.pl
446endif
447
448if ENABLE_OBSOLETE_API
449TESTS += test/symbols-compat.pl
450endif
451
452AM_TESTS_ENVIRONMENT = \
453    lib_la="./libcrypt.la"; \
454    lib_map="$(srcdir)/lib/libcrypt.map.in"; \
455    HAVE_CPP_dD="$(HAVE_CPP_dD)"; \
456    SYMBOL_PREFIX="$(SYMBOL_PREFIX)"; \
457    CC="$(CC)"; \
458    CPP="$(CPP)"; \
459    CPPFLAGS="$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)"; \
460    CPPFLAGS="$${CPPFLAGS} $(AM_CPPFLAGS) $(CPPFLAGS)"; \
461    CFLAGS="$(CFLAGS)"; \
462    LDFLAGS="$(LDFLAGS)"; \
463    NM="$(NM)"; \
464    SHELL="$(SHELL)"; \
465    export lib_la lib_map HAVE_CPP_dD SYMBOL_PREFIX; \
466    export CC CPP CPPFLAGS CFLAGS LDFLAGS NM SHELL;
467
468PL_LOG_COMPILER = $(PERL)
469if CROSS_COMPILING
470LOG_COMPILER = $(PERL) $(SCRIPTS_AUX)/skip-if-exec-format-error
471endif
472
473test/symbols-compat.log test/symbols-compat.trs: test/TestCommon.pm
474test/symbols-renames.log test/symbols-renames.trs: test/TestCommon.pm
475test/symbols-static.log test/symbols-static.trs: test/TestCommon.pm
476
477COMMON_TEST_OBJECTS = libcrypt.la
478
479test_badsalt_LDADD = $(COMMON_TEST_OBJECTS)
480test_badsetting_LDADD = $(COMMON_TEST_OBJECTS)
481test_gensalt_nthash_LDADD = $(COMMON_TEST_OBJECTS)
482test_gensalt_extradata_LDADD = $(COMMON_TEST_OBJECTS)
483test_checksalt_LDADD = $(COMMON_TEST_OBJECTS)
484test_des_obsolete_LDADD = $(COMMON_TEST_OBJECTS)
485test_des_obsolete_r_LDADD = $(COMMON_TEST_OBJECTS)
486test_crypt_badargs_LDADD = $(COMMON_TEST_OBJECTS)
487test_short_outbuf_LDADD = $(COMMON_TEST_OBJECTS)
488test_preferred_method_LDADD = $(COMMON_TEST_OBJECTS)
489test_special_char_salt_LDADD = $(COMMON_TEST_OBJECTS)
490
491test_ka_bcrypt_LDADD = $(COMMON_TEST_OBJECTS)
492test_ka_bcrypt_a_LDADD = $(COMMON_TEST_OBJECTS)
493test_ka_bcrypt_x_LDADD = $(COMMON_TEST_OBJECTS)
494test_ka_bcrypt_y_LDADD = $(COMMON_TEST_OBJECTS)
495test_ka_bigcrypt_LDADD = $(COMMON_TEST_OBJECTS)
496test_ka_bsdicrypt_LDADD = $(COMMON_TEST_OBJECTS)
497test_ka_descrypt_LDADD = $(COMMON_TEST_OBJECTS)
498test_ka_gost_yescrypt_LDADD = $(COMMON_TEST_OBJECTS)
499test_ka_md5crypt_LDADD = $(COMMON_TEST_OBJECTS)
500test_ka_nt_LDADD = $(COMMON_TEST_OBJECTS)
501test_ka_scrypt_LDADD = $(COMMON_TEST_OBJECTS)
502test_ka_sha1crypt_LDADD = $(COMMON_TEST_OBJECTS)
503test_ka_sha256crypt_LDADD = $(COMMON_TEST_OBJECTS)
504test_ka_sha512crypt_LDADD = $(COMMON_TEST_OBJECTS)
505test_ka_sunmd5_LDADD = $(COMMON_TEST_OBJECTS)
506test_ka_yescrypt_LDADD = $(COMMON_TEST_OBJECTS)
507
508# These tests call internal APIs that may not be accessible from the
509# fully linked shared library.
510# Refer to object files that are linked into libxcrypt with the
511# qualified name, lib/libcrypt_la-foobar.lo, to prevent them from
512# being compiled a second time.
513test_gensalt_LDADD = \
514	lib/libcrypt_la-util-xstrcpy.lo \
515	$(COMMON_TEST_OBJECTS)
516test_alg_des_LDADD = \
517	lib/libcrypt_la-alg-des.lo \
518	lib/libcrypt_la-alg-des-tables.lo \
519	$(COMMON_TEST_OBJECTS)
520test_alg_gost3411_2012_LDADD = \
521	lib/libcrypt_la-alg-gost3411-2012-core.lo \
522	lib/libcrypt_la-alg-gost3411-2012-hmac.lo \
523	lib/libcrypt_la-util-xbzero.lo \
524	$(COMMON_TEST_OBJECTS)
525test_alg_gost3411_2012_hmac_LDADD = \
526	lib/libcrypt_la-alg-gost3411-2012-core.lo \
527	lib/libcrypt_la-alg-gost3411-2012-hmac.lo \
528	lib/libcrypt_la-util-xbzero.lo \
529	$(COMMON_TEST_OBJECTS)
530test_alg_hmac_sha1_LDADD = \
531	lib/libcrypt_la-alg-sha1.lo \
532	lib/libcrypt_la-alg-hmac-sha1.lo \
533	lib/libcrypt_la-util-xbzero.lo \
534	$(COMMON_TEST_OBJECTS)
535test_alg_md4_LDADD = \
536	lib/libcrypt_la-alg-md4.lo \
537	lib/libcrypt_la-util-xbzero.lo \
538	$(COMMON_TEST_OBJECTS)
539test_alg_md5_LDADD = \
540	lib/libcrypt_la-alg-md5.lo \
541	lib/libcrypt_la-util-xbzero.lo \
542	$(COMMON_TEST_OBJECTS)
543test_alg_pbkdf_hmac_sha256_LDADD = \
544	lib/libcrypt_la-alg-sha256.lo \
545	lib/libcrypt_la-util-xbzero.lo \
546	$(COMMON_TEST_OBJECTS)
547test_alg_sha1_LDADD = \
548	lib/libcrypt_la-alg-sha1.lo \
549	lib/libcrypt_la-util-xbzero.lo \
550	$(COMMON_TEST_OBJECTS)
551test_alg_sha256_LDADD = \
552	lib/libcrypt_la-alg-sha256.lo \
553	lib/libcrypt_la-util-xbzero.lo \
554	$(COMMON_TEST_OBJECTS)
555test_alg_sha512_LDADD = \
556	lib/libcrypt_la-alg-sha512.lo \
557	lib/libcrypt_la-util-xbzero.lo \
558	$(COMMON_TEST_OBJECTS)
559test_alg_yescrypt_LDADD = \
560	lib/libcrypt_la-alg-sha256.lo \
561	lib/libcrypt_la-alg-yescrypt-common.lo \
562	lib/libcrypt_la-alg-yescrypt-opt.lo \
563	lib/libcrypt_la-util-base64.lo \
564	lib/libcrypt_la-util-xbzero.lo \
565	$(COMMON_TEST_OBJECTS)
566test_crypt_gost_yescrypt_LDADD = \
567	lib/libcrypt_la-alg-gost3411-2012-core.lo \
568	lib/libcrypt_la-alg-gost3411-2012-hmac.lo \
569	lib/libcrypt_la-alg-sha256.lo \
570	lib/libcrypt_la-alg-yescrypt-common.lo \
571	lib/libcrypt_la-alg-yescrypt-opt.lo \
572	lib/libcrypt_la-crypt-yescrypt.lo \
573	lib/libcrypt_la-util-base64.lo \
574	lib/libcrypt_la-util-xbzero.lo \
575	lib/libcrypt_la-util-xstrcpy.lo \
576	$(COMMON_TEST_OBJECTS)
577
578test_explicit_bzero_LDADD = \
579	lib/libcrypt_la-util-xbzero.lo
580test_getrandom_interface_LDADD = \
581	lib/libcrypt_la-util-get-random-bytes.lo \
582	lib/libcrypt_la-util-xbzero.lo
583test_getrandom_fallbacks_LDADD = \
584	lib/libcrypt_la-util-get-random-bytes.lo \
585	lib/libcrypt_la-util-xbzero.lo
586
587
588if HAVE_LD_WRAP
589test_getrandom_fallbacks_LDFLAGS = \
590  -Wl,--wrap,getentropy -Wl,--wrap,getrandom -Wl,--wrap,syscall \
591  -Wl,--wrap,open -Wl,--wrap,open64 -Wl,--wrap,read -Wl,--wrap,close \
592  $(AM_LDFLAGS)
593endif
594
595# CI sometimes wants to compile all the test programs but not run them.
596test-programs: $(check_PROGRAMS)
597phony_targets += test-programs
598
599# Additional checks to run in `make distcheck'.
600distcheck-hook:
601	cd $(top_srcdir) && \
602	  $(PERL) ./$(SCRIPTS_AUX)/check-perlcritic-config && \
603	  perlcritic --quiet ./
604
605# Target for generating a signed release tarball.
606release: libxcrypt-$(VERSION).tar.xz.sha256sum libxcrypt-gpgkey.gpg
607phony_targets += release
608
609libxcrypt-$(VERSION).tar.xz.asc: dist-xz
610	$(GPG2) \
611		--quiet \
612		--armor \
613		--detach-sign \
614		--default-key F52E98007594C21D \
615		--output libxcrypt-$(VERSION).tar.xz.asc.T \
616		libxcrypt-$(VERSION).tar.xz
617	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change \
618		libxcrypt-$(VERSION).tar.xz.asc.T \
619		libxcrypt-$(VERSION).tar.xz.asc
620
621libxcrypt-$(VERSION).tar.xz.sha256sum: libxcrypt-$(VERSION).tar.xz.asc
622	$(SHA256SUM) \
623		libxcrypt-$(VERSION).tar.xz \
624		libxcrypt-$(VERSION).tar.xz.asc \
625		> libxcrypt-$(VERSION).tar.xz.sha256sum.T
626	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change \
627		libxcrypt-$(VERSION).tar.xz.sha256sum.T \
628		libxcrypt-$(VERSION).tar.xz.sha256sum
629
630libxcrypt-gpgkey.gpg:
631	$(GPG2) \
632		--export \
633		--export-options \
634			export-minimal \
635			F52E98007594C21D \
636		> libxcrypt-gpgkey.gpg.T
637	$(AM_V_at)$(SCRIPTS_AUX)/move-if-change \
638		libxcrypt-gpgkey.gpg.T \
639		libxcrypt-gpgkey.gpg
640
641CLEANFILES += \
642	libxcrypt-$(VERSION).tar.xz.asc* \
643	libxcrypt-$(VERSION).tar.xz.sha256sum* \
644	libxcrypt-gpgkey.gpg*
645
646# Every object file depends on crypt-symbol-vers.h and crypt-hashes.h,
647# which are generated files, so automatic dependency generation is not
648# sufficient.
649include $(builddir)/Makefile.deps
650
651# Add additional targets
652.PHONY: $(phony_targets)
653install-exec-hook: $(install_exec_hook_targets)
654uninstall-hook: $(uninstall_hook_targets)
655