htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit a3dddbfb58df137dcc3d45257c6ede420990ee4c
parent 913a784ac94ad8e7a9c4ab54eed87e83052185e0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 31 Oct 2023 15:10:04 +0100

Update compiler and linker flag definitions

In both cases, there are two sets of macros. <C|LD>FLAGS_SO (for shared
objects) and <C|LD>FLAGS_EXE (for executables) defined from the
<C|LD>FLAGS_DEBUG or <C|LD>FLAGS_RELEASE macro. This commit (re)adds the
<C|LD>FLAGS macros that are by default defined as <C|LD>FLAGS_DEBUG or
<C|LD>FLAGS_RELEASE, depending on the value of BUILD_TYPE. Macros
<C|LD>FLAGS_SO and <C|LD>FLAGS_EXE are now defined from them.

This allows the compiler and linker flags for executables and shared
objects to be overwritten simply by updating the CFLAGS and LDFLAGS
macros. What's more, this is in line with the expected way of
proceeding, CFLAGS and LDFLAGS being standard macros.

Diffstat:
Mconfig.mk | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/config.mk b/config.mk @@ -242,10 +242,12 @@ CFLAGS_COMMON =\ $(CFLAGS_HARDENED)\ $(WFLAGS) -CFLAGS_RELEASE = -O2 -DNDEBUG $(CFLAGS_COMMON) CFLAGS_DEBUG = -g $(CFLAGS_COMMON) -CFLAGS_SO = $(CFLAGS_$(BUILD_TYPE)) -fPIC -CFLAGS_EXE = $(CFLAGS_$(BUILD_TYPE)) -fPIE +CFLAGS_RELEASE = -O2 -DNDEBUG $(CFLAGS_COMMON) +CFLAGS = $(CFLAGS_$(BUILD_TYPE)) + +CFLAGS_SO = $(CFLAGS) -fPIC +CFLAGS_EXE = $(CFLAGS) -fPIE ################################################################################ # Linker options @@ -253,9 +255,10 @@ CFLAGS_EXE = $(CFLAGS_$(BUILD_TYPE)) -fPIE LDFLAGS_HARDENED = -Wl,-z,relro,-z,now LDFLAGS_DEBUG = $(LDFLAGS_HARDENED) LDFLAGS_RELEASE = -s $(LDFLAGS_HARDENED) +LDFLAGS = $(LDFLAGS_$(BUILD_TYPE)) -LDFLAGS_SO = $(LDFLAGS_$(BUILD_TYPE)) -shared -Wl,--no-undefined -LDFLAGS_EXE = $(LDFLAGS_$(BUILD_TYPE)) -pie +LDFLAGS_SO = $(LDFLAGS) -shared -Wl,--no-undefined +LDFLAGS_EXE = $(LDFLAGS) -pie OCPFLAGS_DEBUG = --localize-hidden OCPFLAGS_RELEASE = --localize-hidden --strip-unneeded