summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-01-22 01:25:10 +0900
committerSascha Hauer <s.hauer@pengutronix.de>2019-01-22 09:00:16 +0100
commit4fafb35d925e58d99195f0253c819906200795c9 (patch)
treeb4a0c93b7818af40e14cac4e50cb19d3fa26bcae /Makefile
parent25082eff77300372316fe85265730d1d3e653287 (diff)
downloadbarebox-4fafb35d925e58d99195f0253c819906200795c9.tar.gz
barebox-4fafb35d925e58d99195f0253c819906200795c9.tar.xz
kbuild: cherry-pick changes from Linux v5.0-rc3
Not synced completely. Just cherry-picking low-hanging fruits. 0b35786d77ba kbuild: call make once for all targets when O=.. is used 5e54d5e5fbc1 kbuild: kill EXTRA_ARFLAGS 836caba77c29 kbuild: kill backward compatibility checks 3156fd0529b5 kbuild: fix some minor typoes b8b0618cf6fa kbuild: remove extra ifdef/endif of top Makefile 16f890988114 kbuild: Remove reference to uninitialised variable 9319f4539c18 kbuild: support simultaneous "make %config" and "make all" 9d5db8949f1e scripts/Makefile.clean: clean also $(extra-m) and $(extra-) a4954fd7724c kbuild: remove obj-n and lib-n handling 371fdc77af44 kbuild: collect shorthands into scripts/Kbuild.include a29b82326ed4 kbuild: Remove duplicate $(cmd) definition in Makefile.clean a1e7b7bb1ab5 Makefile: sort list of defconfig targets in make help output 34948e0bbf98 kbuild: Drop support for clean-rule 4218affdf57f kbuild: remove warning about "make depend" 9c8fa9bc08f6 kbuild: fix if_change and friends to consider argument order 39a33ff80a25 kbuild: remove cc-option-align a7f924190924 kbuild: add %.dtb.S and %.dtb to 'targets' automatically 54a702f70589 kbuild: mark $(targets) as .SECONDARY and remove .PRECIOUS markers 9564a8cf422d Kbuild: fix # escaping in .cmd files for future Make bd412d81b7ea kbuild: .PHONY is not a variable, but PHONY is 6916162c7308 kbuild: remove duplicated comments about PHONY d6c6ab93e17f kbuild: remove deprecated host-progs variable 7d0ea2524202 kbuild: use 'else ifeq' for checksrc to improve readability 3f80babd9ca4 kbuild: remove unused cc-fullversion variable bd352a739fde kbuild: remove unused baseprereq b421b8a6cb87 kbuild: remove unused archmrproper Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile65
1 files changed, 29 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index 6a583744c0..f8c3d75575 100644
--- a/Makefile
+++ b/Makefile
@@ -35,10 +35,8 @@ MAKEFLAGS += -rR --no-print-directory
# To put more focus on warnings, be less verbose as default
# Use 'make V=1' to see the full commands
-ifdef V
- ifeq ("$(origin V)", "command line")
- KBUILD_VERBOSE = $(V)
- endif
+ifeq ("$(origin V)", "command line")
+ KBUILD_VERBOSE = $(V)
endif
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
@@ -54,10 +52,8 @@ endif
# See the file "Documentation/sparse.txt" for more details, including
# where to get the "sparse" utility.
-ifdef C
- ifeq ("$(origin C)", "command line")
- KBUILD_CHECKSRC = $(C)
- endif
+ifeq ("$(origin C)", "command line")
+ KBUILD_CHECKSRC = $(C)
endif
ifndef KBUILD_CHECKSRC
KBUILD_CHECKSRC = 0
@@ -69,10 +65,8 @@ endif
ifdef SUBDIRS
KBUILD_EXTMOD ?= $(SUBDIRS)
endif
-ifdef M
- ifeq ("$(origin M)", "command line")
- KBUILD_EXTMOD := $(M)
- endif
+ifeq ("$(origin M)", "command line")
+ KBUILD_EXTMOD := $(M)
endif
@@ -98,10 +92,8 @@ ifeq ($(KBUILD_SRC),)
# OK, Make called in directory where kernel src resides
# Do we want to locate output files in a separate directory?
-ifdef O
- ifeq ("$(origin O)", "command line")
- KBUILD_OUTPUT := $(O)
- endif
+ifeq ("$(origin O)", "command line")
+ KBUILD_OUTPUT := $(O)
endif
# That's our default target when none is given on the command line
@@ -117,12 +109,16 @@ KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
$(if $(KBUILD_OUTPUT),, \
$(error failed to create output directory "$(saved-output)"))
-PHONY += $(MAKECMDGOALS)
+PHONY += $(MAKECMDGOALS) sub-make
-$(filter-out _all,$(MAKECMDGOALS)) _all:
+$(filter-out _all sub-make,$(MAKECMDGOALS)) _all: sub-make
+ @:
+
+sub-make: FORCE
$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
KBUILD_SRC=$(CURDIR) \
- KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@
+ KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
+ $(filter-out _all sub-make,$(MAKECMDGOALS))
# Leave processing to above invocation of make
skip-makefile := 1
@@ -394,8 +390,16 @@ ifeq ($(mixed-targets),1)
# We're called with mixed targets (*config and build targets).
# Handle them one by one.
-%:: FORCE
- $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
+PHONY += $(MAKECMDGOALS) __build_one_by_one
+
+$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
+ @:
+
+__build_one_by_one:
+ $(Q)set -e; \
+ for i in $(MAKECMDGOALS); do \
+ $(MAKE) -f $(srctree)/Makefile $$i; \
+ done
else
ifeq ($(config-targets),1)
@@ -881,12 +885,6 @@ include/generated/utsrelease.h: include/config/kernel.release FORCE
$(call filechk,utsrelease.h)
# ---------------------------------------------------------------------------
-
-PHONY += depend dep
-depend dep:
- @echo '*** Warning: make $@ is unnecessary now.'
-
-# ---------------------------------------------------------------------------
# Modules
ifdef CONFIG_MODULES
@@ -1007,11 +1005,11 @@ mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
mrproper-dirs := $(addprefix _mrproper_,scripts)
-PHONY += $(mrproper-dirs) mrproper archmrproper
+PHONY += $(mrproper-dirs) mrproper
$(mrproper-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
-mrproper: clean archmrproper $(mrproper-dirs)
+mrproper: clean $(mrproper-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@@ -1043,7 +1041,7 @@ rpm: include/config/kernel.release FORCE
# ---------------------------------------------------------------------------
boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig)
-boards := $(notdir $(boards))
+boards := $(sort $(notdir $(boards)))
help:
@echo 'Cleaning targets:'
@@ -1174,11 +1172,6 @@ ifneq ($(cmd_files),)
include $(cmd_files)
endif
-# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
-# Usage:
-# $(Q)$(MAKE) $(clean)=dir
-clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
-
endif # skip-makefile
PHONY += FORCE
@@ -1187,6 +1180,6 @@ FORCE:
# Cancel implicit rules on top Makefile, `-rR' will apply to sub-makes.
Makefile: ;
-# Declare the contents of the .PHONY variable as phony. We keep that
+# Declare the contents of the PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY)