@@ -1122,13 +1122,13 @@ prepare0: archprepare
prepare: prepare0 prepare-objtool
# Support for using generic headers in asm-generic
+asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
+
PHONY += asm-generic uapi-asm-generic
asm-generic: uapi-asm-generic
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
- src=asm obj=arch/$(SRCARCH)/include/generated/asm
+ $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm
uapi-asm-generic:
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
- src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
+ $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm
PHONY += prepare-objtool
prepare-objtool: $(objtool_target)
@@ -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: ;
- 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> --- Makefile | 8 ++++---- scripts/Makefile.asm-generic | 37 +++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 22 deletions(-) -- 2.7.4