On Feb 28 2023, Satish Balay via Bug reports and discussion for GNU make wrote:
> On Tue, 28 Feb 2023, Dmitry Goncharov wrote: > >> On Tue, Feb 28, 2023 at 8:41 PM Satish Balay via Bug reports and >> discussion for GNU make <bug-make@gnu.org> wrote: >> > $ cat makefile >> > all: >> > @MAKEFLAGS="-j1 ${MAKEFLAGS}" ${MAKE} -f makefile hello >> > hello: >> > @echo Hello >> >> When you pass --print-directory MAKEFLAGS has the value "w". >> When this makefile prepends -j1 the value of MAKEFLAGS becomes "-j1 w". >> Among other changes short options are now in the first word on makeflags. >> >> Well defined MAKEFLAGS has the following format >> [shortoptions] [-option with arg]... [--long option]... [ -- cli definitions] >> >> -j carries an argument and is supposed to follow short options. >> >> If you change to >> MAKEFLAGS="${MAKEFLAGS} -j1" $(MAKE) -f makefile hello >> then it'll work. > > For one, the long option '--print-directory' is automatically converted to > this short notation - contributing to this issue. > > And the reason we use the order '-j8 ${MAKEFLAGS}' is so that we have the > following behavior': You need to write it as MAKEFLAGS="-j1 -${MAKEFLAGS}", so that the short options at the start of the old value of MAKEFLAGS become a proper options string. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."