bugmake - Bugs: bug #60036, Incorrect MAKEFLAGS after $(shell)...


bug #60036: Incorrect MAKEFLAGS after $(shell) function call

Submitter:  None
Submitted:  Wed 10 Feb 2021 07:33:22 PM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.3 Operating System:  MS Windows
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 15 Mar 2021 06:29:25 AM UTC, comment #1: 

This issue isn't seen on Linux.  I think it must be related to the way the jobserver mode is handled on Windows, which is different than Linux (on Windows we use a shared semaphore).

Yes, it's necessary to call output_start() in func_shell_base() because the shell function doesn't redirect stderr, so it can go to the output and get mixed up.

Paul D. Smith <psmith>
Group administrator
Wed 10 Feb 2021 07:33:22 PM UTC, original submission:  

After recursive make call if top-level Makefile set -Otarget and sub-make has $(shell) function call then MAKEFLAGS exposes all internal values hidden from user (-j and --jobserver-auth for example). It leads to false warning message as if -j option specified in Makefile.
It happens because $(shell) function handler invokes define_makeflags(1, 0):

1. define_makeflags()
2. prepare_mutex_handle_string()
3. sync_init()
4. setup_tmpfile()
5. output_start()
6. func_shell_base()

Looks like MAKEFLAGS variable takes its full contents too early. I'm not familiar with make internals but does it really necessary to do output_start() in func_shell_base()?

Example Makefile:

start_time := $(shell echo %time%)
MAKEFLAGS += --no-print-directory
MAKEFLAGS += --output-sync=target

.PHONY: all
        $(MAKE) build-$@

.PHONY: build-all
        @echo $@

Output of 'make -j8':

make build-all
make[1]: warning: -j8 forced in makefile: resetting jobserver mode.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code