1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
From: Debian DM Multipath Team <team+linux-blocks@tracker.debian.org>
Date: Wed, 23 Dec 2020 22:52:02 +0000
Subject: Update build flags
We have a few missions:
1) ensure we build using the environment-supplied flags, especially
LDFLAGS, CFLAGS, CPPFLAGS
2) disable -Werror, as this can just break with newer GCC versions.
3) remove EXTRAVERSION, as our git revision is not interesting.
4) add EXTRACFLAGS, so the udeb build can pass in extra flags, like
-static-libgcc.
5) build with libedit instead of libreadline for license reasons.
---
Makefile.inc | 20 ++++++++------------
create-config.mk | 11 +----------
2 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 9e3dc46..6e57deb 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -12,13 +12,13 @@
# Readline library to use, libedit, libreadline, or empty
# Caution: Using libreadline may make the multipathd binary undistributable,
# see https://github.com/opensvc/multipath-tools/issues/36
-READLINE :=
+READLINE := libedit
# List of scsi device handler modules to load on boot, e.g.
# SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac
SCSI_DH_MODULES_PRELOAD :=
-EXTRAVERSION := $(shell rev=$$(git rev-parse --short=7 HEAD 2>/dev/null); echo $${rev:+-g$$rev})
+EXTRAVERSION :=
# PKG_CONFIG must be read from the environment to enable compilation
# in Debian multiarch setups
@@ -32,13 +32,13 @@ include $(TOPDIR)/config.mk
endif
# Paths. All these can be overridden on the "make" command line.
-prefix :=
+prefix := /usr
# Prefix for binaries
exec_prefix := $(prefix)
# Prefix for non-essential libraries (libdmmp)
usr_prefix := $(if $(prefix),$(prefix),/usr)
# Prefix for configuration files (multipath.conf)
-etc_prefix := $(prefix)
+etc_prefix :=
# Where to install systemd-related files. systemd is usually installed under /usr
# Note: systemd installations with "split-usr=true" use separate "prefixdir" and
# "rootprefixdir". Our systemd_prefix corresponds to "prefixdir".
@@ -64,7 +64,7 @@ libudevdir := $(systemd_prefix)lib/udev
udevrulesdir := $(libudevdir)/rules.d
bindir := $(exec_prefix)sbin
mandir := $(usr_prefix)share/man
-LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
+LIB := lib
syslibdir := $(prefix)$(LIB)
usrlibdir := $(usr_prefix)$(LIB)
includedir := $(usr_prefix)include
@@ -82,11 +82,7 @@ sysdir_bin := $(sys_execprefix)bin
abstract_socket := @/org/kernel/linux/storage/multipathd
pathname_socket := /run/multipathd.socket
-ifeq ($(V),)
-Q := @
-# make's "Entering directory" messages are confusing in parallel mode
-#MAKEFLAGS = --no-print-directory
-endif
+MAKEFLAGS = --no-print-directory
GZIP_PROG := gzip -9 -c
RM := rm -f
@@ -107,7 +103,7 @@ OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
# Set WARN_ONLY=1 to avoid compilation erroring out due to warnings. Useful during development.
WARN_ONLY :=
ERROR := $(if $(WARN_ONLY),,error=)
-WERROR := $(if $(WARN_ONLY),,-Werror)
+WERROR :=
WARNFLAGS := $(WERROR) -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -W$(ERROR)implicit-int \
-W$(ERROR)implicit-function-declaration -W$(ERROR)format-security \
$(WNOCLOBBERED) -W$(ERROR)cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS)
@@ -121,7 +117,7 @@ CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) $(D_URCU_VERSION) \
-DABSTRACT_SOCKET=\"$(abstract_socket)\" -DPATHNAME_SOCKET=\"$(pathname_socket)\" \
-DWSTRINGOP_TRUNCATION=$(if $(WSTRINGOP_TRUNCATION),1,0) \
-MMD -MP
-CFLAGS := -std=$(C_STD) $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
+CFLAGS := -std=$(C_STD) $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) $(EXTRACFLAGS) -pipe \
-fexceptions
BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS := -fPIC
diff --git a/create-config.mk b/create-config.mk
index 3c3ba06..68713e1 100644
--- a/create-config.mk
+++ b/create-config.mk
@@ -146,16 +146,7 @@ TEST_CC_OPTION = $(shell \
# Check if _DFORTIFY_SOURCE=3 is supported.
# On some distros (e.g. Debian Buster) it will be falsely reported as supported
# but it doesn't seem to make a difference wrt the compilation result.
-FORTIFY_OPT := $(shell \
- if printf '$(__HASH__)include <string.h>\nint main(void) { return 0; }\n' | \
- $(CC) -o /dev/null $(OPTFLAGS) -c -Werror -D_FORTIFY_SOURCE=3 -xc - 2>/dev/null; \
- then \
- echo "-D_FORTIFY_SOURCE=3"; \
- elif printf '$(__HASH__)include <string.h>\nint main(void) { return 0; }\n' | \
- $(CC) -o /dev/null $(OPTFLAGS) -c -Werror -D_FORTIFY_SOURCE=2 -xc - 2>/dev/null; \
- then \
- echo "-D_FORTIFY_SOURCE=2"; \
- fi)
+FORTIFY_OPT :=
# Check is you can compile with the urcu.h header, using the C99 standard.
# If urcu/config-<arch>.h defines CONFIG_RCU_USE_ATOMIC_BUILTINS, then anything
|