summaryrefslogtreecommitdiffstats
path: root/scripts/Kbuild.include
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 /scripts/Kbuild.include
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 'scripts/Kbuild.include')
-rw-r--r--scripts/Kbuild.include33
1 files changed, 13 insertions, 20 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index edfe27ed1b..5fa7f16e12 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -7,6 +7,8 @@ quote := "
squote := '
empty :=
space := $(empty) $(empty)
+space_escape := _-_SPACE_-_
+pound := \#
###
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
@@ -22,10 +24,6 @@ depfile = $(subst $(comma),_,$(dot-target).d)
basetarget = $(basename $(notdir $@))
###
-# filename of first prerequisite with directory and extension stripped
-baseprereq = $(basename $(notdir $<))
-
-###
# Escape single quote for use in echo statements
escsq = $(subst $(squote),'\$(squote)',$1)
@@ -118,11 +116,6 @@ cc-option = $(call try-run,\
cc-option-yn = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n)
-# cc-option-align
-# Prefix align with either -falign or -malign
-cc-option-align = $(subst -functions=0,,\
- $(call cc-option,-falign-functions=0,-malign-functions=0))
-
# cc-disable-warning
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
cc-disable-warning = $(call try-run,\
@@ -132,11 +125,6 @@ cc-disable-warning = $(call try-run,\
# Usage gcc-ver := $(call cc-version)
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
-# cc-fullversion
-# Usage gcc-ver := $(call cc-fullversion)
-cc-fullversion = $(shell $(CONFIG_SHELL) \
- $(srctree)/scripts/gcc-version.sh -p $(CC))
-
# cc-ifversion
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
@@ -170,6 +158,11 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
# $(Q)$(MAKE) $(modbuiltin)=dir
modbuiltin := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.modbuiltin obj
+# 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
+
# Prefix -I with $(srctree) if it is not an absolute path.
# skip if -I has no parameter
addtree = $(if $(patsubst -I%,%,$(1)), \
@@ -198,21 +191,21 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
# See Documentation/kbuild/makefiles.txt for more info
ifneq ($(KBUILD_NOCMDDEP),1)
-# Check if both arguments has same arguments. Result is empty string if equal.
-# User may override this check using make KBUILD_NOCMDDEP=1
-arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
- $(filter-out $(cmd_$@), $(cmd_$(1))) )
+# Check if both arguments are the same including their order. Result is empty
+# string if equal. User may override this check using make KBUILD_NOCMDDEP=1
+arg-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
+ $(subst $(space),$(space_escape),$(strip $(cmd_$1))))
else
arg-check = $(if $(strip $(cmd_$@)),,1)
endif
# Replace >$< with >$$< to preserve $ when reloading the .cmd file
# (needed for make)
-# Replace >#< with >\#< to avoid starting a comment in the .cmd file
+# Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file
# (needed for make)
# Replace >'< with >'\''< to be able to enclose the whole string in '...'
# (needed for the shell)
-make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
+make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
# Find any prerequisites that is newer than target or that does not exist.
# PHONY targets skipped in both cases.