|
|
20abf0 |
From 16cd8fba849d1d95b247025aea7314165ffd8acf Mon Sep 17 00:00:00 2001
|
|
|
20abf0 |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
20abf0 |
Date: Tue, 18 May 2021 17:10:52 +0400
|
|
|
20abf0 |
Subject: [PATCH] build-sys: leave CFLAGS/LDFLAGS for user to be defined
|
|
|
20abf0 |
MIME-Version: 1.0
|
|
|
20abf0 |
Content-Type: text/plain; charset=UTF-8
|
|
|
20abf0 |
Content-Transfer-Encoding: 8bit
|
|
|
20abf0 |
|
|
|
20abf0 |
This allows user to set specific flags during compilation, without
|
|
|
20abf0 |
overriding configure-time cflags necessary for compilation.
|
|
|
20abf0 |
|
|
|
20abf0 |
See also:
|
|
|
20abf0 |
https://www.gnu.org/software/automake/manual/html_node/User-Variables.html
|
|
|
20abf0 |
https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
|
|
|
20abf0 |
|
|
|
20abf0 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
20abf0 |
---
|
|
|
20abf0 |
configure.ac | 13 ++++++++-----
|
|
|
20abf0 |
src/Makefile.am | 16 +++++++++-------
|
|
|
20abf0 |
2 files changed, 17 insertions(+), 12 deletions(-)
|
|
|
20abf0 |
|
|
|
20abf0 |
diff --git a/configure.ac b/configure.ac
|
|
|
20abf0 |
index 8559b66..95deab5 100644
|
|
|
20abf0 |
--- a/configure.ac
|
|
|
20abf0 |
+++ b/configure.ac
|
|
|
20abf0 |
@@ -305,9 +305,12 @@ if test "x$enable_hardening" != "xno"; then
|
|
|
20abf0 |
AC_SUBST([HARDENING_LDFLAGS])
|
|
|
20abf0 |
fi
|
|
|
20abf0 |
|
|
|
20abf0 |
-CFLAGS="$CFLAGS $COVERAGE_CFLAGS -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign"
|
|
|
20abf0 |
-CFLAGS="$CFLAGS -Wmissing-prototypes"
|
|
|
20abf0 |
-LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS"
|
|
|
20abf0 |
+AM_CFLAGS="$CFLAGS $COVERAGE_CFLAGS -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign"
|
|
|
20abf0 |
+AM_CFLAGS="$AM_CFLAGS -Wmissing-prototypes"
|
|
|
20abf0 |
+AM_LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS"
|
|
|
20abf0 |
+
|
|
|
20abf0 |
+AC_SUBST([AM_CFLAGS])
|
|
|
20abf0 |
+AC_SUBST([AM_LDFLAGS])
|
|
|
20abf0 |
|
|
|
20abf0 |
AC_CONFIG_FILES(Makefile \
|
|
|
20abf0 |
dist/libtpms.spec \
|
|
|
20abf0 |
@@ -330,10 +333,10 @@ if test -z "$with_tpm2"; then
|
|
|
20abf0 |
fi
|
|
|
20abf0 |
|
|
|
20abf0 |
echo
|
|
|
20abf0 |
-echo "CFLAGS=$CFLAGS"
|
|
|
20abf0 |
+echo "AM_CFLAGS=$AM_CFLAGS"
|
|
|
20abf0 |
echo "HARDENING_CFLAGS=$HARDENING_CFLAGS"
|
|
|
20abf0 |
echo "HARDENING_LDFLAGS=$HARDENING_LDFLAGS"
|
|
|
20abf0 |
-echo "LDFLAGS=$LDFLAGS"
|
|
|
20abf0 |
+echo "AM_LDFLAGS=$AM_LDFLAGS"
|
|
|
20abf0 |
echo
|
|
|
20abf0 |
echo "Version to build : $PACKAGE_VERSION"
|
|
|
20abf0 |
echo "Crypto library : $cryptolib"
|
|
|
20abf0 |
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
20abf0 |
index 6594ddf..65910d8 100644
|
|
|
20abf0 |
--- a/src/Makefile.am
|
|
|
20abf0 |
+++ b/src/Makefile.am
|
|
|
20abf0 |
@@ -4,18 +4,20 @@
|
|
|
20abf0 |
# For the license, see the LICENSE file in the root directory.
|
|
|
20abf0 |
#
|
|
|
20abf0 |
|
|
|
20abf0 |
+AM_CFLAGS = @AM_CFLAGS@
|
|
|
20abf0 |
+AM_LDFLAGS = @AM_LDFLAGS@ $(HARDENING_LDFLAGS) $(SANITIZERS) $(FUZZER)
|
|
|
20abf0 |
+
|
|
|
20abf0 |
lib_LTLIBRARIES=libtpms.la
|
|
|
20abf0 |
|
|
|
20abf0 |
common_CFLAGS = -include tpm_library_conf.h \
|
|
|
20abf0 |
-I$(top_srcdir)/include/libtpms \
|
|
|
20abf0 |
-I$(top_builddir)/include/libtpms \
|
|
|
20abf0 |
+ $(AM_CFLAGS) \
|
|
|
20abf0 |
$(HARDENING_CFLAGS) \
|
|
|
20abf0 |
$(SANITIZERS) \
|
|
|
20abf0 |
$(FUZZER)
|
|
|
20abf0 |
|
|
|
20abf0 |
|
|
|
20abf0 |
-LDFLAGS += $(HARDENING_LDFLAGS) $(SANITIZERS) $(FUZZER)
|
|
|
20abf0 |
-
|
|
|
20abf0 |
#
|
|
|
20abf0 |
# TPM1.2
|
|
|
20abf0 |
#
|
|
|
20abf0 |
@@ -574,16 +576,16 @@ libtpms_la_SOURCES = \
|
|
|
20abf0 |
libtpms_la_CFLAGS = $(common_CFLAGS)
|
|
|
20abf0 |
|
|
|
20abf0 |
libtpms_la_LDFLAGS = -version-info $(LIBTPMS_VERSION_INFO) \
|
|
|
20abf0 |
- -no-undefined
|
|
|
20abf0 |
+ -no-undefined $(AM_LDFLAGS)
|
|
|
20abf0 |
|
|
|
20abf0 |
if HAVE_VERSION_SCRIPT
|
|
|
20abf0 |
libtpms_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libtpms.syms
|
|
|
20abf0 |
endif
|
|
|
20abf0 |
|
|
|
20abf0 |
-LDFLAGS_ARCH = $(findstring -m32, $(CFLAGS))
|
|
|
20abf0 |
-LDFLAGS_ARCH += $(findstring -m64, $(CFLAGS))
|
|
|
20abf0 |
-LDFLAGS_ARCH += $(findstring -m32, $(LDFLAGS))
|
|
|
20abf0 |
-LDFLAGS_ARCH += $(findstring -m64, $(LDFLAGS))
|
|
|
20abf0 |
+LDFLAGS_ARCH = $(findstring -m32, $(AM_CFLAGS))
|
|
|
20abf0 |
+LDFLAGS_ARCH += $(findstring -m64, $(AM_CFLAGS))
|
|
|
20abf0 |
+LDFLAGS_ARCH += $(findstring -m32, $(AM_LDFLAGS))
|
|
|
20abf0 |
+LDFLAGS_ARCH += $(findstring -m64, $(AM_LDFLAGS))
|
|
|
20abf0 |
|
|
|
20abf0 |
check-local: SHELL?="/usr/bin/env bash"
|
|
|
20abf0 |
check-local:
|
|
|
20abf0 |
--
|
|
|
20abf0 |
2.29.0
|
|
|
20abf0 |
|