diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-05 20:28:04 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-17 00:33:14 +0900 |
commit | 7d0e5c2056c70ff443188b6e603b6254af1304cc (patch) | |
tree | 10d0d19b490e2057d3c104e442d7fb56a05f7232 /scripts/Makefile.asm-generic | |
parent | c7fe060885c4c0b78934c3d7507aa5e68de4099f (diff) | |
download | linux-7d0e5c2056c70ff443188b6e603b6254af1304cc.tar.gz linux-7d0e5c2056c70ff443188b6e603b6254af1304cc.tar.bz2 linux-7d0e5c2056c70ff443188b6e603b6254af1304cc.zip |
kbuild: refactor Makefile.asm-generic
- Use conventional $(MAKE) $(asm-generic)=<dir> style
for directory descending
- Remove unneeded FORCE since "all" is a phony target
- Remove unneeded "_dummy :=" assignment
- Skip $(shell mkdir ...) when headers exist in the directory
- Misc cleanups
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/Makefile.asm-generic')
-rw-r--r-- | scripts/Makefile.asm-generic | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index 32ad8e93fbe1..760323e70ebc 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic @@ -2,41 +2,42 @@ # include/asm-generic contains a lot of files that are used # verbatim by several architectures. # -# This Makefile reads the file arch/$(SRCARCH)/include/$(src)/Kbuild +# This Makefile reads the file arch/$(SRCARCH)/include/(uapi/)/asm/Kbuild # and for each file listed in this file with generic-y creates -# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src)) +# a small wrapper file in arch/$(SRCARCH)/include/generated/(uapi/)/asm. PHONY := all all: -kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild --include $(kbuild-file) +src := $(subst /generated,,$(obj)) +-include $(src)/Kbuild include scripts/Kbuild.include -# Create output directory if not already present -_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) +generic-y := $(addprefix $(obj)/, $(generic-y)) +generated-y := $(addprefix $(obj)/, $(generated-y)) -# Stale wrappers when the corresponding files are removed from generic-y -# need removing. -generated-y := $(generic-y) $(generated-y) -all-files := $(patsubst %, $(obj)/%, $(generated-y)) -old-headers := $(wildcard $(obj)/*.h) -unwanted := $(filter-out $(all-files),$(old-headers)) +# Remove stale wrappers when the corresponding files are removed from generic-y +old-headers := $(wildcard $(obj)/*.h) +unwanted := $(filter-out $(generic-y) $(generated-y),$(old-headers)) quiet_cmd_wrap = WRAP $@ -cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ + cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@ quiet_cmd_remove = REMOVE $(unwanted) -cmd_remove = rm -f $(unwanted) + cmd_remove = rm -f $(unwanted) -all: $(patsubst %, $(obj)/%, $(generic-y)) FORCE - $(if $(unwanted),$(call cmd,remove),) +all: $(generic-y) + $(if $(unwanted),$(call cmd,remove)) @: $(obj)/%.h: $(call cmd,wrap) -PHONY += FORCE +# Create output directory. Skip it if at least one old header exists +# since we know the output directory already exists. +ifeq ($(old-headers),) +$(shell mkdir -p $(obj)) +endif + .PHONY: $(PHONY) -FORCE: ; |