kbuild: make multiple directory targets work
authorMasahiro Yamada <masahiroy@kernel.org>
Wed, 5 Feb 2020 06:51:52 +0000 (15:51 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 5 Feb 2020 21:31:51 +0000 (06:31 +0900)
Currently, the single-target build does not work when two
or more sub-directories are given:

  $ make fs/ kernel/ lib/
    CALL    scripts/checksyscalls.sh
    CALL    scripts/atomic/check-atomics.sh
    DESCEND  objtool
  make[2]: Nothing to be done for 'kernel/'.
  make[2]: Nothing to be done for 'fs/'.
  make[2]: Nothing to be done for 'lib/'.

Make it work properly.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Makefile

index 65a5dc6..ef8913a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1679,7 +1679,7 @@ PHONY += descend $(build-dirs)
 descend: $(build-dirs)
 $(build-dirs): prepare
        $(Q)$(MAKE) $(build)=$@ \
 descend: $(build-dirs)
 $(build-dirs): prepare
        $(Q)$(MAKE) $(build)=$@ \
-       single-build=$(if $(filter-out $@/, $(single-no-ko)),1) \
+       single-build=$(if $(filter-out $@/, $(filter $@/%, $(single-no-ko))),1) \
        need-builtin=1 need-modorder=1
 
 clean-dirs := $(addprefix _clean_, $(clean-dirs))
        need-builtin=1 need-modorder=1
 
 clean-dirs := $(addprefix _clean_, $(clean-dirs))