Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: Define a Makefile function to do subdir processing

Define a Makefile function that can be called with $(call ...) to wrap
the subdir make invocations in tools/Makefile.

This will allow us in the next patch to insert bits in there to honour
O= flags when called from the top-level Makefile.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Borislav Petkov <bp@amd64.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1378.1352379110@warthog.procyon.org.uk
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+20 -12
+12 -12
tools/Makefile
··· 31 31 @echo ' clean: a summary clean target to clean _all_ folders' 32 32 33 33 cpupower: FORCE 34 - $(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1) 34 + $(call descend,power/$@) 35 35 36 36 firewire lguest perf usb virtio vm: FORCE 37 - $(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1) 37 + $(call descend,$@) 38 38 39 39 selftests: FORCE 40 - $(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1) 40 + $(call descend,testing/$@) 41 41 42 42 turbostat x86_energy_perf_policy: FORCE 43 - $(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1) 43 + $(call descend,power/x86/$@) 44 44 45 45 cpupower_install: 46 - $(QUIET_SUBDIR0)power/$(@:_install=)/ $(QUIET_SUBDIR1) install 46 + $(call descend,power/$(@:_install=),install) 47 47 48 48 firewire_install lguest_install perf_install usb_install virtio_install vm_install: 49 - $(QUIET_SUBDIR0)$(@:_install=)/ $(QUIET_SUBDIR1) install 49 + $(call descend,$(@:_install=),install) 50 50 51 51 selftests_install: 52 - $(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) install 52 + $(call descend,testing/$(@:_clean=),install) 53 53 54 54 turbostat_install x86_energy_perf_policy_install: 55 - $(QUIET_SUBDIR0)power/x86/$(@:_install=)/ $(QUIET_SUBDIR1) install 55 + $(call descend,power/x86/$(@:_install=),install) 56 56 57 57 install: cpupower_install firewire_install lguest_install perf_install \ 58 58 selftests_install turbostat_install usb_install virtio_install \ 59 59 vm_install x86_energy_perf_policy_install 60 60 61 61 cpupower_clean: 62 - $(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean 62 + $(call descend,power/cpupower,clean) 63 63 64 64 firewire_clean lguest_clean perf_clean usb_clean virtio_clean vm_clean: 65 - $(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean 65 + $(call descend,$(@:_clean=),clean) 66 66 67 67 selftests_clean: 68 - $(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean 68 + $(call descend,testing/$(@:_clean=),clean) 69 69 70 70 turbostat_clean x86_energy_perf_policy_clean: 71 - $(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean 71 + $(call descend,power/x86/$(@:_clean=),clean) 72 72 73 73 clean: cpupower_clean firewire_clean lguest_clean perf_clean selftests_clean \ 74 74 turbostat_clean usb_clean virtio_clean vm_clean \
+8
tools/scripts/Makefile.include
··· 41 41 NO_SUBDIR = : 42 42 endif 43 43 44 + # 45 + # Define a callable command for descending to a new directory 46 + # 47 + # Call by doing: $(call descend,directory[,target]) 48 + # 49 + descend = \ 50 + $(QUIET_SUBDIR0)$(1) $(QUIET_SUBDIR1) $(2) 51 + 44 52 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 45 53 QUIET_SUBDIR1 = 46 54