Commit 296e0855b0f9a4ec9be17106ac541745a55b2ce1

Authored by Sam Ravnborg
1 parent 60f33b8044

kbuild: fix make -jN with multiple targets with O=...

The way multiple targets was handled with make O=...
broke because for each high-level target make spawned
a parallel make resulting in a broken build.
Reported by Keith Owens <kaos@ocs.com.au>

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff

... ... @@ -106,12 +106,13 @@
106 106 $(if $(KBUILD_OUTPUT),, \
107 107 $(error output directory "$(saved-output)" does not exist))
108 108  
109   -.PHONY: $(MAKECMDGOALS)
  109 +.PHONY: $(MAKECMDGOALS) cdbuilddir
  110 +$(MAKECMDGOALS) _all: cdbuilddir
110 111  
111   -$(filter-out _all,$(MAKECMDGOALS)) _all:
  112 +cdbuilddir:
112 113 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
113 114 KBUILD_SRC=$(CURDIR) \
114   - KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@
  115 + KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $(MAKECMDGOALS)
115 116  
116 117 # Leave processing to above invocation of make
117 118 skip-makefile := 1