coreutils
[Top][All Lists]
Advanced

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

[PATCH] maint: allow per-directory CFLAGS settings with non-recursive ma


From: Jim Meyering
Subject: [PATCH] maint: allow per-directory CFLAGS settings with non-recursive make
Date: Mon, 10 Sep 2012 16:56:03 +0200

FYI,

>From 4fdd1cc597209b9e85ed66fdb594abca6f148155 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 8 Sep 2012 21:17:32 +0200
Subject: [PATCH] maint: allow per-directory CFLAGS settings with
 non-recursive make

* src/local.mk (AM_CFLAGS): Don't use $(WARN_CFLAGS) here.
* cfg.mk (src_CFLAGS, lib_CFLAGS, gnulib-tests_CFLAGS): Define here
instead.
(AM_CFLAGS): Augment using the above.
* configure.ac: Note that the configure-time option,
--enable-gcc-warnings now functions only when using GNU make.
Well, currently it does still work in gnulib-tests, but that should
soon be fixed.
Improved-by: Stefano Lattarini
---
 cfg.mk       | 7 +++++++
 configure.ac | 2 +-
 src/local.mk | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 489f946..0deb3cb 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -558,3 +558,10 @@ exclude_file_name_regexp--sc_prohibit_test_backticks = \
 # Exempt test.c, since it's nominally shared, and relatively static.
 exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \
   ^src/(ptx|test|head)\.c$$
+
+# Augment AM_CFLAGS to include our per-directory options:
+AM_CFLAGS += $($(@D)_CFLAGS)
+
+src_CFLAGS = $(WARN_CFLAGS)
+lib_CFLAGS = $(GNULIB_WARN_CFLAGS)
+gnulib-tests_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS)
diff --git a/configure.ac b/configure.ac
index e1aa6ca..c6cd8b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])

 AC_ARG_ENABLE([gcc-warnings],
   [AS_HELP_STRING([--enable-gcc-warnings],
-                  [turn on lots of GCC warnings (for developers)])],
+     [turn on many GCC warnings (for developers; best with GNU make)])],
   [case $enableval in
      yes|no) ;;
      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
diff --git a/src/local.mk b/src/local.mk
index 4cfbe55..78e7743 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -16,7 +16,8 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.

-AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+# FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am
+AM_CFLAGS = $(WERROR_CFLAGS)

 # The list of all programs (separated in different variables to express
 # the how and when they should be installed) is defined in this makefile
--
1.7.12.289.g0ce9864



reply via email to

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