[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 1e4bb015 1/3: Rearrange makefile for concinni
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 1e4bb015 1/3: Rearrange makefile for concinnity |
Date: |
Wed, 29 Jun 2022 23:37:53 -0400 (EDT) |
branch: master
commit 1e4bb015468a40e2917578a3ee39160347e8fab6
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rearrange makefile for concinnity
Rearranged the primary gcc makefile to follow the preferable order of
tools in its clang congener. For example, 'ar' is more like a linker
than a compiler, so it's treated after 'ld'. This logical order makes
more sense than the former alphabetical order.
---
compiler_gcc.make | 75 +++++++++++++++++++++++++++----------------------------
1 file changed, 37 insertions(+), 38 deletions(-)
diff --git a/compiler_gcc.make b/compiler_gcc.make
index 229ff196..01ed933f 100644
--- a/compiler_gcc.make
+++ b/compiler_gcc.make
@@ -75,16 +75,6 @@ endif
tutelary_flag :=
-# Dialect options for gcc.
-
-# The default '-fno-rounding-math' means something like
-# #pragma STDC FENV ACCESS OFF
-# which causes harm while bringing no countervailing benefit--see:
-# https://lists.nongnu.org/archive/html/lmi/2017-08/msg00045.html
-
-c_standard := -fno-ms-extensions -frounding-math -fsignaling-nans -std=c99
-cxx_standard := -fno-ms-extensions -frounding-math -fsignaling-nans -std=c++20
-
################################################################################
# Build type governs
@@ -220,31 +210,18 @@ endif
# which used less RAM. They might become useful again in future
# circumstances that cannot be foreseen.
-CFLAGS = \
- $(optimization_flag) $(c_l_flags) \
-
-CXXFLAGS = \
- $(optimization_flag) $(c_l_flags) \
-
-LDFLAGS = $(c_l_flags) -Wl,-Map,$@.map \
+# Dialect options for gcc.
-ifeq (x86_64-pc-linux-gnu,$(LMI_TRIPLET))
- LDFLAGS += -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code
-endif
+# The default '-fno-rounding-math' means something like
+# #pragma STDC FENV ACCESS OFF
+# which causes harm while bringing no countervailing benefit--see:
+# https://lists.nongnu.org/archive/html/lmi/2017-08/msg00045.html
-# By infelicitous default, MinGW enables auto-import. See, e.g.:
-# https://sourceforge.net/p/mingw/mailman/message/16354653/
-# Disabling it globally, thus:
-# LDFLAGS += -Wl,--disable-auto-import
-# worked with mingw.org's gcc, but the more recent MinGW-w64
-# versions seem to require it unless $(USE_SO_ATTRIBUTES) is
-# defined.
+c_standard := -fno-ms-extensions -frounding-math -fsignaling-nans -std=c99
+cxx_standard := -fno-ms-extensions -frounding-math -fsignaling-nans -std=c++20
-ifneq (,$(USE_SO_ATTRIBUTES))
- ifeq (mingw32,$(findstring mingw32,$(LMI_TRIPLET)))
- LDFLAGS += -Wl,--disable-auto-import -static-libstdc++
- endif
-endif
+CFLAGS = \
+ $(optimization_flag) $(c_l_flags) \
# C compiler flags.
@@ -258,10 +235,8 @@ REQUIRED_CXXFLAGS = \
$(cxx_standard) \
$(CXX_WARNINGS) \
-# Archiver flags.
-
-REQUIRED_ARFLAGS = \
- -rus
+CXXFLAGS = \
+ $(optimization_flag) $(c_l_flags) \
# Linker flags.
@@ -311,6 +286,30 @@ REQUIRED_LDFLAGS = \
$(EXTRA_LDFLAGS) \
$(EXTRA_LIBS) \
+LDFLAGS = $(c_l_flags) -Wl,-Map,$@.map \
+
+ifeq (x86_64-pc-linux-gnu,$(LMI_TRIPLET))
+ LDFLAGS += -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code
+endif
+
+# By infelicitous default, MinGW enables auto-import. See, e.g.:
+# https://sourceforge.net/p/mingw/mailman/message/16354653/
+# Disabling it globally, thus:
+# LDFLAGS += -Wl,--disable-auto-import
+# worked with mingw.org's gcc, but the more recent MinGW-w64
+# versions seem to require it unless $(USE_SO_ATTRIBUTES) is
+# defined.
+
+ifneq (,$(USE_SO_ATTRIBUTES))
+ ifeq (mingw32,$(findstring mingw32,$(LMI_TRIPLET)))
+ LDFLAGS += -Wl,--disable-auto-import -static-libstdc++
+ endif
+endif
+
+# Archiver flags.
+
+REQUIRED_ARFLAGS = -rus
+
# Resource compiler (msw) flags.
#
# The '--use-temp-file' windres option seems to be often helpful and
@@ -336,11 +335,11 @@ REQUIRED_RCFLAGS = \
# Going one step beyond that idea, lmi puts $(tutelary_flag) last,
# after even $(CFLAGS), for flags that must not be overridden.
-ALL_ARFLAGS = $(REQUIRED_ARFLAGS) $(ARFLAGS)
ALL_CPPFLAGS = $(REQUIRED_CPPFLAGS) $(CPPFLAGS)
-ALL_CXXFLAGS = $(REQUIRED_CXXFLAGS) $(CXXFLAGS) $(tutelary_flag)
ALL_CFLAGS = $(REQUIRED_CFLAGS) $(CFLAGS) $(tutelary_flag)
+ALL_CXXFLAGS = $(REQUIRED_CXXFLAGS) $(CXXFLAGS) $(tutelary_flag)
ALL_LDFLAGS = $(REQUIRED_LDFLAGS) $(LDFLAGS)
+ALL_ARFLAGS = $(REQUIRED_ARFLAGS) $(ARFLAGS)
ALL_RCFLAGS = $(REQUIRED_RCFLAGS) $(RCFLAGS)
# For the /dev/null rationale, see: