From 5180d5f483486859c0a822c9020ec459f4504b59 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Tue, 29 Apr 2014 11:54:47 +0200 Subject: firmware: Simplify directory creation When building the firmware blobs, use a simple loop to create directories in $(objtree), like in Makefile.build. This simplifies the rules and also makes it possible to set $(objtree) to '.' later. Before this change, a dependency on $(objtree)/ would be satisfied by in $(srctree). When installing the firmware blobs, call mkdir like in Makefile.modinst. Cc: David Woodhouse Acked-by: Sam Ravnborg Signed-off-by: Michal Marek --- scripts/Makefile.fwinst | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'scripts/Makefile.fwinst') diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst index 2c1d69c4345c..d8e335eed226 100644 --- a/scripts/Makefile.fwinst +++ b/scripts/Makefile.fwinst @@ -24,25 +24,23 @@ ifndef CONFIG_FIRMWARE_IN_KERNEL mod-fw += $(fw-shipped-y) endif +ifneq ($(KBUILD_SRC),) +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all)))) +# Create directories for firmware in subdirectories +_dummy := $(foreach d,$(firmware-dirs), $(shell [ -d $(d) ] || mkdir -p $(d))) +endif + installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw)) installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) -installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./ - -# Workaround for make < 3.81, where .SECONDEXPANSION doesn't work. -PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs -$(INSTALL_FW_PATH)/$$(%): install-all-dirs - @true -install-all-dirs: $(installed-fw-dirs) - @true quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@) - cmd_install = $(INSTALL) -m0644 $< $@ - -$(installed-fw-dirs): - $(call cmd,mkdir) + cmd_install = mkdir -p $(@D); $(INSTALL) -m0644 $< $@ -$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %) +$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% $(call cmd,install) PHONY += __fw_install __fw_modinst FORCE -- cgit