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 96ce80a3743b..2964b96aa55f 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include | |||
@@ -1,8 +1,11 @@ | |||
1 | ifeq ("$(origin O)", "command line") | 1 | ifeq ($(origin O), command line) |
2 | dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) | 2 | dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) |
3 | ABSOLUTE_O := $(shell cd $(O) ; pwd) | 3 | ABSOLUTE_O := $(shell cd $(O) ; pwd) |
4 | OUTPUT := $(ABSOLUTE_O)/ | 4 | OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) |
5 | COMMAND_O := O=$(ABSOLUTE_O) | 5 | COMMAND_O := O=$(ABSOLUTE_O) |
6 | ifeq ($(objtree),) | ||
7 | objtree := $(O) | ||
8 | endif | ||
6 | endif | 9 | endif |
7 | 10 | ||
8 | ifneq ($(OUTPUT),) | 11 | ifneq ($(OUTPUT),) |
@@ -41,7 +44,16 @@ else | |||
41 | NO_SUBDIR = : | 44 | NO_SUBDIR = : |
42 | endif | 45 | endif |
43 | 46 | ||
44 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir | 47 | # |
48 | # Define a callable command for descending to a new directory | ||
49 | # | ||
50 | # Call by doing: $(call descend,directory[,target]) | ||
51 | # | ||
52 | descend = \ | ||
53 | +mkdir -p $(OUTPUT)$(1) && \ | ||
54 | $(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2) | ||
55 | |||
56 | QUIET_SUBDIR0 = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir | ||
45 | QUIET_SUBDIR1 = | 57 | QUIET_SUBDIR1 = |
46 | 58 | ||
47 | ifneq ($(findstring $(MAKEFLAGS),s),s) | 59 | ifneq ($(findstring $(MAKEFLAGS),s),s) |
@@ -56,5 +68,10 @@ ifndef V | |||
56 | $(MAKE) $(PRINT_DIR) -C $$subdir | 68 | $(MAKE) $(PRINT_DIR) -C $$subdir |
57 | QUIET_FLEX = @echo ' ' FLEX $@; | 69 | QUIET_FLEX = @echo ' ' FLEX $@; |
58 | QUIET_BISON = @echo ' ' BISON $@; | 70 | QUIET_BISON = @echo ' ' BISON $@; |
71 | |||
72 | descend = \ | ||
73 | @echo ' ' DESCEND $(1); \ | ||
74 | mkdir -p $(OUTPUT)$(1) && \ | ||
75 | $(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2) | ||
59 | endif | 76 | endif |
60 | endif | 77 | endif |