Makefile: Add security compiling option (RELRO, SC, and FORTIFY)
[platform/upstream/cryptsetup.git] / Makefile.am
1 EXTRA_DIST = README.md COPYING.LGPL FAQ.md docs misc autogen.sh
2 SUBDIRS = po tests tests/fuzz
3 CLEANFILES =
4 DISTCLEAN_TARGETS =
5
6 AM_CPPFLAGS = \
7         -include config.h \
8         -I$(top_srcdir)/lib \
9         -DDATADIR=\""$(datadir)"\"              \
10         -DLOCALEDIR=\""$(datadir)/locale"\"     \
11         -DLIBDIR=\""$(libdir)"\"                \
12         -DPREFIX=\""$(prefix)"\"                \
13         -DSYSCONFDIR=\""$(sysconfdir)"\"        \
14         -DVERSION=\""$(VERSION)"\"              \
15         -DEXTERNAL_LUKS2_TOKENS_PATH=\"${EXTERNAL_LUKS2_TOKENS_PATH}\" \
16         -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wl,-z,relro
17 AM_CFLAGS = -Wall -fPIE \
18             -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wl,-z,relro
19 AM_CXXFLAGS = -Wall
20 AM_LDFLAGS = -pie \
21              -Wl,-z,relro
22
23 if ENABLE_FUZZ_TARGETS
24 AM_CFLAGS += -fsanitize=fuzzer-no-link
25 AM_CXXFLAGS += -fsanitize=fuzzer-no-link
26 endif
27
28 LDADD = $(LTLIBINTL)
29
30 tmpfilesddir = @DEFAULT_TMPFILESDIR@
31
32 include_HEADERS =
33 lib_LTLIBRARIES =
34 noinst_LTLIBRARIES =
35 sbin_PROGRAMS =
36 man8_MANS =
37 tmpfilesd_DATA =
38 pkgconfig_DATA =
39 dist_noinst_DATA =
40
41 include man/Makemodule.am
42
43 include scripts/Makemodule.am
44
45 if CRYPTO_INTERNAL_ARGON2
46 include lib/crypto_backend/argon2/Makemodule.am
47 endif
48 include lib/crypto_backend/Makemodule.am
49 include lib/Makemodule.am
50
51 include src/Makemodule.am
52 include tokens/Makemodule.am
53
54 ACLOCAL_AMFLAGS = -I m4
55
56 DISTCHECK_CONFIGURE_FLAGS =     \
57         --with-tmpfilesdir=$$dc_install_base/usr/lib/tmpfiles.d \
58         --enable-internal-argon2 --enable-internal-sse-argon2 \
59         --enable-external-tokens --enable-ssh-token --enable-asciidoc
60
61 distclean-local:
62         -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
63         rm -rf autom4te.cache
64
65 clean-local:
66         -rm -rf docs/doxygen_api_docs libargon2.la
67
68 install-data-local:
69         $(MKDIR_P) -m 0755 $(DESTDIR)/${EXTERNAL_LUKS2_TOKENS_PATH}
70
71 uninstall-local:
72         rmdir $(DESTDIR)/${EXTERNAL_LUKS2_TOKENS_PATH} 2>/dev/null || :
73
74 check-programs: libcryptsetup.la
75         $(MAKE) -C tests $@
76
77 if ENABLE_FUZZ_TARGETS
78 fuzz-targets: libcryptsetup.la libcrypto_backend.la
79         $(MAKE) -C tests/fuzz $@
80 endif