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
|
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) remove EXTRAVERSION, as our git revision is not interesting.
3) add EXTRACFLAGS, so the udeb build can pass in extra flags, like
-static-libgcc.
4) build with libedit instead of libreadline for license reasons.
---
Makefile.inc | 18 +++++++-----------
create-config.mk | 11 +----------
2 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index c6aa6ed..e6502b2 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -18,13 +18,13 @@ OPT := -O2
# 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
@@ -38,13 +38,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".
@@ -70,7 +70,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
@@ -88,11 +88,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
@@ -127,7 +123,7 @@ CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) $(D_URCU_VERSION) $(D_CMOCKA_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 -fno-strict-aliasing $(if $(ASAN),-fsanitize=address)
BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS := -fPIC
diff --git a/create-config.mk b/create-config.mk
index 712cef0..bd4e251 100644
--- a/create-config.mk
+++ b/create-config.mk
@@ -150,16 +150,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
|