URL: <https://savannah.gnu.org/bugs/?68018>
Summary: target-specific MAKEFLAGS ends up wrong if
commandline overrides present
Group: make
Submitter: None
Submitted: Thu 05 Feb 2026 12:08:51 PM UTC
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Unlocked
Component Version: 4.4.1
Operating System: POSIX-Based
Fixed Release: None
Triage Status: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Thu 05 Feb 2026 12:08:51 PM UTC By: Anonymous
Present in 4.4.1 (and git HEAD); not present in 4.3.
Looks like the --no-print-directory ends up after a " -- " in MAKEFLAGS if the
assigment is target-specific and there are command line overrides, and then it
is treated as a target. It doesn't happen if the += is global OR if there are
no overrides...
bad:
$(MAKE) all foo=bar
good:
$(MAKE) all
all: MAKEFLAGS += --no-print-directory
all:
$(info MAKEFLAGS:<$(MAKEFLAGS)>)
$(MAKE) nothing
nothing:;
$ make good
make all
make[1]: Entering directory '/home/x/makeflagbug'
MAKEFLAGS:<--no-print-directory>
make nothing
make[2]: 'nothing' is up to date.
make[1]: Leaving directory '/home/x/makeflagbug'
$ make bad
make all foo=bar
make[1]: Entering directory '/home/x/makeflagbug'
MAKEFLAGS:< -- foo=bar --no-print-directory>
make nothing
make[2]: Entering directory '/home/x/makeflagbug'
make[2]: *** No rule to make target '--no-print-directory'. Stop.
make[2]: Leaving directory '/home/x/makeflagbug'
make[1]: *** [Makefile:10: all] Error 2
make[1]: Leaving directory '/home/x/makeflagbug'
make: *** [Makefile:2: bad] Error 2
Comparing with 4.3:
$ make4.3 bad
/home/x/make4.3 all foo=bar
make[1]: Entering directory '/home/x/makeflagbug'
MAKEFLAGS:<w -- foo=bar --no-print-directory>
/home/x/make4.3 nothing
make[2]: Entering directory '/home/x/makeflagbug'
make[2]: 'nothing' is up to date.
make[2]: Leaving directory '/home/x/makeflagbug'
make[1]: Leaving directory '/home/x/makeflagbug'
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68018>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
