From 1999307b469bdfda97baa78c7f4ecf3800fdbacd Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Tue, 30 Dec 2014 18:44:38 +0100 Subject: perf build: Add single target build framework support Add support to build single targets, like: $ make util/map.o # objects $ make util/map.i # preprocessor $ make util/map.s # assembly Signed-off-by: Jiri Olsa Tested-by: Sukadev Bhattiprolu Tested-by: Will Deacon Cc: Alexis Berlemont Cc: Borislav Petkov Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-tt10y0dmweq6rjaod937rpb4@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/build/Makefile.build | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'tools/build/Makefile.build') diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build index aced86d2bbf8..b5ded207f49b 100644 --- a/tools/build/Makefile.build +++ b/tools/build/Makefile.build @@ -49,6 +49,12 @@ quiet_cmd_mkdir = MKDIR $(dir $@) quiet_cmd_cc_o_c = CC $@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< +quiet_cmd_cc_i_c = CPP $@ + cmd_cc_i_c = $(CC) $(c_flags) -E -o $@ $< + +quiet_cmd_cc_s_c = AS $@ + cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< + # Link agregate command # If there's nothing to link, create empty $@ object. quiet_cmd_ld_multi = LD $@ @@ -64,6 +70,18 @@ $(OUTPUT)%.o: %.S FORCE $(call rule_mkdir) $(call if_changed_dep,cc_o_c) +$(OUTPUT)%.i: %.c FORCE + $(call rule_mkdir) + $(call if_changed_dep,cc_i_c) + +$(OUTPUT)%.i: %.S FORCE + $(call rule_mkdir) + $(call if_changed_dep,cc_i_c) + +$(OUTPUT)%.s: %.c FORCE + $(call rule_mkdir) + $(call if_changed_dep,cc_s_c) + # Gather build data: # obj-y - list of build objects # subdir-y - list of directories to nest @@ -100,7 +118,7 @@ FORCE: # Include all cmd files to get all the dependency rules # for all objects included -targets := $(wildcard $(sort $(obj-y) $(in-target))) +targets := $(wildcard $(sort $(obj-y) $(in-target) $(MAKECMDGOALS))) cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) -- cgit v1.2.3