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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Michal Marek
Date: Tuesday, April 27, 2010 - 4:47 am

On 26.4.2010 22:56, Jason Wessel wrote:

BTW, make --warn-undefined-variables also triggers this (although no one
will use this option on the kernel makefiles).



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 message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Correctly deal with make that has an argument ..., Michal Marek, (Tue Apr 27, 4:47 am)