Skip to content

Commit

Permalink
make: fix corner case in -j / -l handling (#1995)
Browse files Browse the repository at this point in the history
```bash
▸ ./kodev test -vj1
make TARGET= KODEBUG=1 VERBOSE=1 testall T=-v\ -j\ 1
cd base/build/x86_64-pc-linux-gnu-debug/cmake && ninja -v -j\ -l8 all
ninja: fatal: invalid -j parameter
make: *** [base/Makefile:89: base-all] Error 1
```

Switch to `MFLAGS`: same value as `MAKEFLAGS` except that it does
not contain the command line variable definitions.
  • Loading branch information
benoit-pierre authored Nov 27, 2024
1 parent a10bc42 commit c110110
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ ifeq (,$(V)$(VERBOSE))
endif

ifeq (,$(PARALLEL_JOBS))
PARALLEL_JOBS := $(or $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))))
empty :=
space := $(empty) $(empty)
PARALLEL_JOBS := $(or $(patsubst -j%,%,$(filter -j%,$(MFLAGS))))
endif
ifeq (,$(PARALLEL_LOAD))
PARALLEL_LOAD := $(or $(patsubst -l%,%,$(filter -l%,$(MAKEFLAGS))))
PARALLEL_LOAD := $(or $(patsubst -l%,%,$(filter -l%,$(MFLAGS))))
endif
ifeq (,$(and $(PARALLEL_JOBS),$(PARALLEL_LOAD)))
CORES := $(shell getconf _NPROCESSORS_ONLN)
Expand Down

0 comments on commit c110110

Please sign in to comment.