kbuild: fix warning "overriding recipe for target 'Makefile'"
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 26 Mar 2019 06:32:16 +0000 (15:32 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 1 Apr 2019 01:06:00 +0000 (10:06 +0900)
If you do "make Makefile" with GNU Make 3.x, the following warning
is displayed:

  $ make Makefile
  Makefile:165: warning: overriding recipe for target 'Makefile'
  Makefile:51: warning: ignoring old recipe for target 'Makefile'
  make[1]: Nothing to be done for 'Makefile'.
  make: Nothing to be done for 'Makefile'.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Makefile

index ab635a5507eb9fa12a0d6e5816e6c06b7657da4b..f30b37569f5d0c16b97df5d6a34abb32b6bd12f7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -161,7 +161,7 @@ ifeq ($(need-sub-make),1)
 
 PHONY += $(MAKECMDGOALS) sub-make
 
-$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
+$(filter-out _all sub-make $(lastword $(MAKEFILE_LIST)), $(MAKECMDGOALS)) _all: sub-make
        @:
 
 # Invoke a second make in the output directory, passing relevant variables