From c52b0c85d80c912817a45c49262fb919835ab3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 18 May 2021 17:18:55 +0400 Subject: [PATCH] build-sys: leave CFLAGS/LDFLAGS for user to be defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows user to set specific flags during compilation, without overriding configure-time cflags necessary for compilation. See also: https://www.gnu.org/software/automake/manual/html_node/User-Variables.html https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html Signed-off-by: Marc-André Lureau --- configure.ac | 9 +++++++-- src/swtpm/Makefile.am | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 45f4324..e550e74 100644 --- a/configure.ac +++ b/configure.ac @@ -535,6 +535,11 @@ if test "$with_seccomp" != "no"; then [whether to build in seccomp profile (Linux only)]) fi +AM_CFLAGS="$CFLAGS" +AM_LDFLAGS="$LDFLAGS" +AC_SUBST([AM_CFLAGS]) +AC_SUBST([AM_LDFLAGS]) + AC_CONFIG_FILES([Makefile \ debian/swtpm-tools.postinst \ dist/swtpm.spec \ @@ -586,10 +591,10 @@ echo echo "Version to build : $PACKAGE_VERSION" echo "Crypto library : $cryptolib" echo -echo "CFLAGS=$CFLAGS" +echo "AM_CFLAGS=$AM_CFLAGS" echo "HARDENING_CFLAGS=$HARDENING_CFLAGS" echo "HARDENING_LDFLAGS=$HARDENING_LDFLAGS" -echo "LDFLAGS=$LDFLAGS" +echo "AM_LDFLAGS=$AM_LDFLAGS" echo "LIBSECCOMP_LIBS=$LIBSECCOMP_LIBS" echo echo "TSS_USER=$TSS_USER" diff --git a/src/swtpm/Makefile.am b/src/swtpm/Makefile.am index a9f3f25..bc0a3d1 100644 --- a/src/swtpm/Makefile.am +++ b/src/swtpm/Makefile.am @@ -4,6 +4,9 @@ # For the license, see the COPYING file in the root directory. # +AM_CFLAGS = @AM_CFLAGS@ +AM_LDFLAGS = @AM_LDFLAGS@ + noinst_HEADERS = \ capabilities.h \ common.h \ @@ -61,11 +64,13 @@ libswtpm_libtpms_la_CFLAGS = \ -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/swtpm \ + $(AM_CFLAGS) \ $(HARDENING_CFLAGS) \ $(GLIB_CFLAGS) \ $(LIBSECCOMP_CFLAGS) libswtpm_libtpms_la_LDFLAGS = \ + $(AM_LDFLAGS) \ $(HARDENING_LDFLAGS) libswtpm_libtpms_la_LIBADD = \ @@ -95,12 +100,14 @@ swtpm_CFLAGS = \ -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/swtpm \ + $(AM_CFLAGS) \ $(HARDENING_CFLAGS) \ $(GLIB_CFLAGS) \ $(LIBFUSE_CFLAGS) \ -DHAVE_SWTPM_CUSE_MAIN swtpm_LDFLAGS = \ + $(AM_LDFLAGS) \ $(HARDENING_LDFLAGS) swtpm_LDADD = \ @@ -118,11 +125,13 @@ swtpm_cuse_SOURCES = \ swtpm_cuse_CFLAGS = \ -I$(top_builddir)/include \ -I$(top_srcdir)/include/swtpm \ + $(AM_CFLAGS) \ $(GLIB_CFLAGS) \ $(LIBFUSE_CFLAGS) \ $(HARDENING_CFLAGS) swtpm_cuse_LDFLAGS = \ + $(AM_LDFLAGS) \ $(HARDENING_LDFLAGS) swtpm_cuse_LDADD = \ -- 2.29.0