Re: [PATCH] Correctly deal with make that has an argument which contains an "s"

Previous thread: [PATCH] backlight: l4f00242t03: Fix regulators handling code in remove function by Alberto Panizzo on Monday, April 26, 2010 - 1:51 pm. (2 messages)

Next thread: [PATCH] - New round-robin rotor for SLAB allocations by Jack Steiner on Monday, April 26, 2010 - 2:00 pm. (4 messages)
From: Jason Wessel
Date: Monday, April 26, 2010 - 1:56 pm

When using remake, which is based on gnumake, if you invoke
an example build as shown below, the build will become silent
due to the top level make file incorrectly guessing that
the end user wants a silent build because an argument that
contained an "s" was used.

remake --no-extended-errors

Fix up the top level Makefile to use filter with a list of
options that mean silent with the various revisions of gnumake,
instead of findstring.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
CC: Michal Marek <mmarek@suse.cz>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-kbuild@vger.kernel.org
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index fa1db90..91ae299 100644
--- a/Makefile
+++ b/Makefile
@@ -294,7 +294,7 @@ endif
 # If the user is running make -s (silent mode), suppress echoing of
 # commands
 
-ifneq ($(findstring s,$(MAKEFLAGS)),)
+ifneq ($(filter s% -s% --silent --quiet,$(MAKEFLAGS)),)
   quiet=silent_
 endif
 
-- 
1.6.3.3

--

From: Américo Wang
Date: Monday, April 26, 2010 - 10:54 pm

On Tue, Apr 27, 2010 at 4:56 AM, Jason Wessel


Acked-by: WANG Cong <xiyou.wangcong@gmail.com>

--

From: Michal Marek
Date: Tuesday, April 27, 2010 - 4:47 am

BTW, make --warn-undefined-variables also triggers this (although no one

I played a bit with GNU make 3.81. Checking for --silent and --quiet is
not necessary, because make always stores the short option if available.
Now I was wondering if the 's' option is always at the beginning,
looking at make-3.81/main.c, it turns out that the order in which the
options appear in $(MAKEFLAGS) is the reverse order of the switches
array, where 's' is near the end of the array:

    { 's', flag, (char *) &silent_flag, 1, 1, 0, 0, 0, "silent" },
                                           ^ store in $(MAKEFLAGS)?
    { 'S', flag_off, (char *) &keep_going_flag, 1, 1, 0, 0,
      (char *) &default_keep_going_flag, "no-keep-going" },
    { 't', flag, (char *) &touch_flag, 1, 1, 1, 0, 0, "touch" },
    { 'v', flag, (char *) &print_version_flag, 1, 1, 0, 0, 0, "version" },
    { 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0,
      "print-directory" },
    { CHAR_MAX+3, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0,
0, 0,
      "no-print-directory" },
    { 'W', string, (char *) &new_files, 0, 0, 0, 0, 0, "what-if" },
    { CHAR_MAX+4, flag, (char *) &warn_undefined_variables_flag, 1, 1,
0, 0, 0,
      "warn-undefined-variables" },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0 }


The only other single-letter options that come after 's' (before 's' in
the $(MAKEFLAGS) variable) are 't', which doesn't work with the kernel,
and 'w', which doesn't work either (the Makefile adds
--no-print-directory). So we can indeed get away with s% and -s% (until
the next make version changes the sort order, that is ;)).

Michal
--

Previous thread: [PATCH] backlight: l4f00242t03: Fix regulators handling code in remove function by Alberto Panizzo on Monday, April 26, 2010 - 1:51 pm. (2 messages)

Next thread: [PATCH] - New round-robin rotor for SLAB allocations by Jack Steiner on Monday, April 26, 2010 - 2:00 pm. (4 messages)