diff options
Diffstat (limited to 'tools/scripts/Makefile.include')
| -rw-r--r-- | tools/scripts/Makefile.include | 23 | 
1 files changed, 20 insertions, 3 deletions
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index 96ce80a3743..2964b96aa55 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include @@ -1,8 +1,11 @@ -ifeq ("$(origin O)", "command line") +ifeq ($(origin O), command line)  	dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)  	ABSOLUTE_O := $(shell cd $(O) ; pwd) -	OUTPUT := $(ABSOLUTE_O)/ +	OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)  	COMMAND_O := O=$(ABSOLUTE_O) +ifeq ($(objtree),) +	objtree := $(O) +endif  endif  ifneq ($(OUTPUT),) @@ -41,7 +44,16 @@ else  NO_SUBDIR = :  endif -QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir +# +# Define a callable command for descending to a new directory +# +# Call by doing: $(call descend,directory[,target]) +# +descend = \ +	+mkdir -p $(OUTPUT)$(1) && \ +	$(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2) + +QUIET_SUBDIR0  = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir  QUIET_SUBDIR1  =  ifneq ($(findstring $(MAKEFLAGS),s),s) @@ -56,5 +68,10 @@ ifndef V  			 $(MAKE) $(PRINT_DIR) -C $$subdir  	QUIET_FLEX     = @echo '   ' FLEX $@;  	QUIET_BISON    = @echo '   ' BISON $@; + +	descend = \ +		@echo '   ' DESCEND $(1); \ +		mkdir -p $(OUTPUT)$(1) && \ +		$(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2)  endif  endif  |