[bug #57178] Job server not invoked in initial pass

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #57178] Job server not invoked in initial pass

Martin Dorey-4
URL:
  <https://savannah.gnu.org/bugs/?57178>

                 Summary: Job server not invoked in initial pass
                 Project: make
            Submitted by: paulberg
            Submitted on: Wed 06 Nov 2019 11:07:42 AM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.2.1
        Operating System: Any
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

In a recipe, a call to a sub-make process using the $(MAKE) macro coordinates
with the job server to maintain a maximum number of parallel jobs as
instructed by the -j parameter. It is expected that any use of this macro
would do the same, but in the initial expansion, use of this macro does not
coordinate and is restricted to -j1.

To Repro use 2 files (below) Makefile and test.mk. test.mk called with -j10
will return 10 normally (some race conditions possible). However, if Makefile
is called with -j10, it invokes test.mk as a sub-make and test.mk will report
that only -j1 was invoked, indicating that the job server is not being
utilized.

Expected: This test when invoked with -j n should report n (or close to n,
race conditions permitting) since the job server should coordinate the number
of available jobs and the sub process should parallelize accordingly.

FILE1 Makefile:

$(info $(shell $(MAKE) -f test.mk all))

all:
        @:

FILE2 test.mk:

all: | parallel ; @echo $(JOB_COUNT)

parallel: .parallel ; @$(eval JOB_COUNT := $(shell sort -n $< | tail -n 1))
.parallel: FORCE ; @$(MAKE) -f test.mk --no-print-directory par 2>/dev/null
>$@ || true
FORCE:

to_n = $(words $2) $(if $(filter-out $1,$(words x $2)),$(call to_n,$1,x $2))

PAR_COUNT :=
par: $(addprefix par-,$(call to_n,32))
par-%: ; @$(eval PAR_COUNT += x)@echo $(words $(PAR_COUNT)) && sleep 1 &&
false





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57178>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57178] Job server not invoked in initial pass

Martin Dorey-4
Follow-up Comment #1, bug #57178 (project make):

Looks like MAKEFLAGS var is not set at this point. Possibly related?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57178>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/