aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--tools/scripts/Makefile.include17
2 files changed, 17 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 14c93b39b929..08a31d8b7e39 100644
--- a/Makefile
+++ b/Makefile
@@ -1321,10 +1321,12 @@ kernelversion:
1321 1321
1322# Clear a bunch of variables before executing the submake 1322# Clear a bunch of variables before executing the submake
1323tools/: FORCE 1323tools/: FORCE
1324 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ 1324 $(Q)mkdir -p $(objtree)/tools
1325 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/
1325 1326
1326tools/%: FORCE 1327tools/%: FORCE
1327 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $* 1328 $(Q)mkdir -p $(objtree)/tools
1329 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $*
1328 1330
1329# Single targets 1331# Single targets
1330# --------------------------------------------------------------------------- 1332# ---------------------------------------------------------------------------
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 4a9e3176f743..87467b17e05c 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -1,8 +1,11 @@
1ifeq ("$(origin O)", "command line") 1ifeq ($(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)
6ifeq ($(objtree),)
7 objtree := $(O)
8endif
6endif 9endif
7 10
8ifneq ($(OUTPUT),) 11ifneq ($(OUTPUT),)
@@ -47,9 +50,10 @@ endif
47# Call by doing: $(call descend,directory[,target]) 50# Call by doing: $(call descend,directory[,target])
48# 51#
49descend = \ 52descend = \
50 $(QUIET_SUBDIR0)$(1) $(QUIET_SUBDIR1) $(2) 53 +mkdir -p $(OUTPUT)$(1) && \
54 $(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1)
51 55
52QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 56QUIET_SUBDIR0 = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir
53QUIET_SUBDIR1 = 57QUIET_SUBDIR1 =
54 58
55ifneq ($(findstring $(MAKEFLAGS),s),s) 59ifneq ($(findstring $(MAKEFLAGS),s),s)
@@ -64,5 +68,10 @@ ifndef V
64 $(MAKE) $(PRINT_DIR) -C $$subdir 68 $(MAKE) $(PRINT_DIR) -C $$subdir
65 QUIET_FLEX = @echo ' ' FLEX $@; 69 QUIET_FLEX = @echo ' ' FLEX $@;
66 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)
67endif 76endif
68endif 77endif