From: Michael Tremer Date: Mon, 12 Dec 2022 17:06:21 +0000 (+0000) Subject: macros: Move CFLAGS/CXXFLAGS/LDFLAGS into the build section X-Git-Tag: 0.9.29~430 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36bd8319a30ecfe0601cd308fe808cd0ab3167f8;p=pakfire.git macros: Move CFLAGS/CXXFLAGS/LDFLAGS into the build section This is where they belong and it makes it easier to modify them in the build section of individual packages. Signed-off-by: Michael Tremer --- diff --git a/macros/cflags.macro b/macros/cflags.macro index 1175d95f1..8635a3c3e 100644 --- a/macros/cflags.macro +++ b/macros/cflags.macro @@ -1,45 +1,47 @@ -# Export CFLAGS -export CFLAGS = # empty +build + # Export CFLAGS + export CFLAGS = # empty -# Export CXXFLAGS -export CXXFLAGS = %{CFLAGS} + # Export CXXFLAGS + export CXXFLAGS = %{CFLAGS} -# Export LDFLAGS -export LDFLAGS = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now + # Export LDFLAGS + export LDFLAGS = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -# Enable optimisation and compile in debugging information -CFLAGS = -O2 -g + # Enable optimisation and compile in debugging information + CFLAGS = -O2 -g -# Enable all compiler warnings -CFLAGS += -Wall -Werror=format-security + # Enable all compiler warnings + CFLAGS += -Wall -Werror=format-security -# Fortify Source -CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 + # Fortify Source + CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -# Build Position Independent Code -CFLAGS += -fPIC + # Build Position Independent Code + CFLAGS += -fPIC -# Enable Stack Smashing Protection -CFLAGS += -fstack-protector-strong + # Enable Stack Smashing Protection + CFLAGS += -fstack-protector-strong -# Enable unwind tables -CFLAGS += -funwind-tables -fasynchronous-unwind-tables + # Enable unwind tables + CFLAGS += -funwind-tables -fasynchronous-unwind-tables -# Enable Stack Clash Protection -CFLAGS += -fstack-clash-protection + # Enable Stack Clash Protection + CFLAGS += -fstack-clash-protection -# Tell the compiler where the source will be put -CFLAGS += -fdebug-prefix-map=%{DIR_SRC}=%{debugsourcedir} + # Tell the compiler where the source will be put + CFLAGS += -fdebug-prefix-map=%{DIR_SRC}=%{debugsourcedir} -# Arch: x86_64 -CFLAGS_x86_64 = -m64 -march=x86-64-v2 -mtune=generic + # Arch: x86_64 + CFLAGS_x86_64 = -m64 -march=x86-64-v2 -mtune=generic -# Arch: aarch64 -CFLAGS_aarch64 = -mbranch-protection=standard + # Arch: aarch64 + CFLAGS_aarch64 = -mbranch-protection=standard -# Append architecture optimisations -CFLAGS += %{CFLAGS_%{DISTRO_ARCH}} + # Append architecture optimisations + CFLAGS += %{CFLAGS_%{DISTRO_ARCH}} -# Enable LTO -LTO_CFLAGS = -flto=auto -ffat-lto-objects -CFLAGS += %{LTO_CFLAGS} + # Enable LTO + LTO_CFLAGS = -flto=auto -ffat-lto-objects + CFLAGS += %{LTO_CFLAGS} +end