lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master e4abb6e1 14/17: Don't specify nonempty $CFLAG


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e4abb6e1 14/17: Don't specify nonempty $CFLAGS or $CXXFLAGS
Date: Sat, 2 Jul 2022 21:42:15 -0400 (EDT)

branch: master
commit e4abb6e1f94c84a24343689f625004609354c8a5
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Don't specify nonempty $CFLAGS or $CXXFLAGS
    
    The GNU coding standards
      https://www.gnu.org/prep/standards/html_node/Command-Variables.html
    suggest specifying "CFLAGS = -g" in makefiles. Until now, lmi had
    followed that rule (if not quite literally) by setting $CFLAGS and
    $CXXFLAGS to a default value of '-ggdb'. Now, this makefile assigns
    them no value, so that overriding them doesn't discard any default.
---
 compiler_clang.make | 16 +++++++++++-----
 compiler_gcc.make   | 22 +++++++++++-----------
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/compiler_clang.make b/compiler_clang.make
index 6154adca..17f4b469 100644
--- a/compiler_clang.make
+++ b/compiler_clang.make
@@ -116,8 +116,14 @@ endif
 # Yet another is 'debug_flag': the GNU Coding Standards
 #   https://www.gnu.org/prep/standards/html_node/Command-Variables.html
 # suggest including flags such as '-g' in $(CFLAGS) because they
-# are "not required for proper compilation", but lmi supports
-# multiple build types that transcend that "proper" notion.
+# are "not required for proper compilation", but lmi deliberately
+# sets default debugging flags, of necessity: with gcc-3.4.5 at
+# least, the '-fno-var-tracking-assignments' debugging option was
+# required for compiling product files correctly. Furthermore, lmi
+# binary distributions are intended to be built with '-ggdb' so that
+# any errors reported by end users can reliably be reproduced using
+# debug builds. If it is desired to negate '-ggdb', the gcc manual
+# suggests that '-ggdb0' should do that.
 
 c_l_flags = $(debug_flag) $(analyzer_flag)
 
@@ -132,6 +138,7 @@ endif
 
 REQUIRED_COMPILER_FLAGS = \
   $(c_l_flags) \
+  $(optimization_flag) \
   -Woverriding-t-option \
     -ffp-model=strict \
     -ffp-exception-behavior=ignore \
@@ -143,14 +150,13 @@ REQUIRED_COMPILER_FLAGS = \
 
 REQUIRED_CFLAGS = -std=c99 $(C_WARNINGS) $(REQUIRED_COMPILER_FLAGS)
 
-# Better to leave this unset, and specify optimization elsewhere?
-CFLAGS = $(optimization_flag)
+CFLAGS =
 
 # C++ compiler flags.
 
 REQUIRED_CXXFLAGS = -std=c++20 $(CXX_WARNINGS) $(REQUIRED_COMPILER_FLAGS)
 
-CXXFLAGS = $(optimization_flag)
+CXXFLAGS =
 
 # Linker flags.
 
diff --git a/compiler_gcc.make b/compiler_gcc.make
index 946760b1..09413e28 100644
--- a/compiler_gcc.make
+++ b/compiler_gcc.make
@@ -161,13 +161,6 @@ product_file_sources := my_db.o my_fund.o my_prod.o 
my_rnd.o my_tier.o
 $(product_file_sources): debug_flag += -fno-var-tracking-assignments
 $(product_file_sources): optimization_flag += -Os
 
-# $(optimization_flag) is part of the default $(CXXFLAGS), but a
-# target-specific assignment there isn't enough, because it is too
-# easily overridden by specifying $(CXXFLAGS) on the command line.
-# This flag overrides any such override:
-#   Suppressed, and soon to be removed:
-#$(product_file_sources): tutelary_flag += $(product_file_flags)
-
 
################################################################################
 
 # Compiler-and-linker flags.
@@ -179,8 +172,14 @@ $(product_file_sources): optimization_flag += -Os
 # Yet another is 'debug_flag': the GNU Coding Standards
 #   https://www.gnu.org/prep/standards/html_node/Command-Variables.html
 # suggest including flags such as '-g' in $(CFLAGS) because they
-# are "not required for proper compilation", but lmi supports
-# multiple build types that transcend that "proper" notion.
+# are "not required for proper compilation", but lmi deliberately
+# sets default debugging flags, of necessity: with gcc-3.4.5 at
+# least, the '-fno-var-tracking-assignments' debugging option was
+# required for compiling product files correctly. Furthermore, lmi
+# binary distributions are intended to be built with '-ggdb' so that
+# any errors reported by end users can reliably be reproduced using
+# debug builds. If it is desired to negate '-ggdb', the gcc manual
+# suggests that '-ggdb0' should do that.
 
 c_l_flags = $(debug_flag) $(analyzer_flag)
 
@@ -207,6 +206,7 @@ endif
 
 REQUIRED_COMPILER_FLAGS = \
   $(c_l_flags) \
+  $(optimization_flag) \
   -frounding-math \
   -fsignaling-nans \
   -fno-ms-extensions \
@@ -215,13 +215,13 @@ REQUIRED_COMPILER_FLAGS = \
 
 REQUIRED_CFLAGS = -std=c99 $(C_WARNINGS) $(REQUIRED_COMPILER_FLAGS)
 
-CFLAGS = $(optimization_flag)
+CFLAGS =
 
 # C++ compiler flags.
 
 REQUIRED_CXXFLAGS = -std=c++20 $(CXX_WARNINGS) $(REQUIRED_COMPILER_FLAGS)
 
-CXXFLAGS = $(optimization_flag)
+CXXFLAGS =
 
 # Linker flags.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]