blob: 8fad8d56453ff16a63f46a9d6479468627d10ecf (
plain)
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
|
From c34eca043178e60ff04dc88953a71b36ce9dc1b0 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Mon, 26 Nov 2018 09:19:17 +0800
Subject: [PATCH] RH: use rpm optflags if present
Use the passed in optflags when compiling as an RPM, and keep the
default flags as close as possible to the current fedora flags, while
still being generic.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Upstream-Status: Pending
[OP: Rebase to 0.9.3]
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Rebase to 0.9.8
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Rebase to 0.10.0
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Rebase to 0.12.1
Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
---
Makefile.inc | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index d04a3175..eb339251 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -102,7 +102,15 @@ SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo
MODPROBE_UNIT := $(shell test "0$(SYSTEMD)" -lt 245 2>/dev/null || \
echo "modprobe@dm_multipath.service")
-OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
+ifndef RPM_OPT_FLAGS
+ OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
+else
+ OPTFLAGS = $(RPM_OPT_FLAGS)
+endif
+OPTFLAGS += -Wextra -Wstrict-prototypes -Wformat=0 -Werror=implicit-int \
+ -Werror=implicit-function-declaration -Wno-sign-compare \
+ -Wno-unused-parameter -Werror=cast-qual \
+ -Werror=discarded-qualifiers
# Set WARN_ONLY=1 to avoid compilation erroring out due to warnings. Useful during development.
WARN_ONLY :=
@@ -121,7 +129,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) -pipe \
-fexceptions
BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS := -fPIC
--
2.43.0
|