On Thu, 2020-05-21 at 16:36 +0900, Masahiro Yamada wrote: > Is there an elegant way to cancel > a command line argument? > > https://www.gnu.org/software/make/manual/make.html#Override-Directive > > explains how to override command arguments, > but it works only in the current Makefile.
The handling of passing content down to recursive make is discussed in this section of the manual: https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html Here you will discover that overridden variables are contained in the make variable MAKEOVERRIDES. Since later settings of variables take precedence over earlier settings, if you want to change them you simply need to add the new setting like so: # This cancels FOO only in this Makefile override FOO= # This resets FOO for recursive invocations MAKEOVERRIDES += FOO=$(FOO)
