aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2014-12-30 12:44:38 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-02-12 11:22:41 -0500
commit1999307b469bdfda97baa78c7f4ecf3800fdbacd (patch)
treecbcb1a7e0bee031df45442a3e4009d4314fa97d2 /tools/perf
parent6d8e62c302bb9285e8882116fc317916ece5d0ab (diff)
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 <jolsa@kernel.org> Tested-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Tested-by: Will Deacon <will.deacon@arm.com> Cc: Alexis Berlemont <alexis.berlemont@gmail.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-tt10y0dmweq6rjaod937rpb4@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile.perf39
-rw-r--r--tools/perf/util/Build8
2 files changed, 36 insertions, 11 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 0a669f990b68..ef637e99a2fa 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -421,16 +421,33 @@ endif
421# These two need to be here so that when O= is not used they take precedence 421# These two need to be here so that when O= is not used they take precedence
422# over the general rule for .o 422# over the general rule for .o
423 423
424$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS 424# get relative building directory (to $(OUTPUT))
425 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< 425# and '.' if it's $(OUTPUT) itself
426$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS 426__build-dir = $(subst $(OUTPUT),,$(dir $@))
427 $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< 427build-dir = $(if $(__build-dir),$(__build-dir),.)
428$(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS 428
429 $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $< 429single_dep: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
430$(OUTPUT)%.o: %.S 430
431 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< 431$(OUTPUT)%.o: %.c single_dep FORCE
432$(OUTPUT)%.s: %.S 432 @$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
433 $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< 433
434$(OUTPUT)%.i: %.c single_dep FORCE
435 @$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
436
437$(OUTPUT)%.s: %.c single_dep FORCE
438 @$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
439
440$(OUTPUT)%-bison.o: %.c single_dep FORCE
441 @$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
442
443$(OUTPUT)%-flex.o: %.c single_dep FORCE
444 @$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
445
446$(OUTPUT)%.o: %.S single_dep FORCE
447 @$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
448
449$(OUTPUT)%.i: %.S single_dep FORCE
450 @$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
434 451
435$(OUTPUT)perf-%: %.o $(PERFLIBS) 452$(OUTPUT)perf-%: %.o $(PERFLIBS)
436 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS) 453 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
@@ -675,5 +692,5 @@ FORCE:
675 692
676.PHONY: all install clean config-clean strip install-gtk 693.PHONY: all install clean config-clean strip install-gtk
677.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell 694.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
678.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS FORCE 695.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS FORCE single_dep
679 696
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 459918872f07..32f9327b1a97 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -97,15 +97,19 @@ CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
97CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))" 97CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
98 98
99$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c 99$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
100 $(call rule_mkdir)
100 @$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l 101 @$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
101 102
102$(OUTPUT)util/parse-events-bison.c: util/parse-events.y 103$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
104 $(call rule_mkdir)
103 @$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_ 105 @$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
104 106
105$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c 107$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
108 $(call rule_mkdir)
106 @$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l 109 @$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
107 110
108$(OUTPUT)util/pmu-bison.c: util/pmu.y 111$(OUTPUT)util/pmu-bison.c: util/pmu.y
112 $(call rule_mkdir)
109 @$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_ 113 @$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_
110 114
111CFLAGS_parse-events-flex.o += -w 115CFLAGS_parse-events-flex.o += -w
@@ -122,13 +126,17 @@ CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
122CFLAGS_parse-events.o += -Wno-redundant-decls 126CFLAGS_parse-events.o += -Wno-redundant-decls
123 127
124$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c FORCE 128$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c FORCE
129 $(call rule_mkdir)
125 $(call if_changed_dep,cc_o_c) 130 $(call if_changed_dep,cc_o_c)
126 131
127$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c FORCE 132$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c FORCE
133 $(call rule_mkdir)
128 $(call if_changed_dep,cc_o_c) 134 $(call if_changed_dep,cc_o_c)
129 135
130$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c FORCE 136$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c FORCE
137 $(call rule_mkdir)
131 $(call if_changed_dep,cc_o_c) 138 $(call if_changed_dep,cc_o_c)
132 139
133$(OUTPUT)util/hweight.o: ../../lib/hweight.c FORCE 140$(OUTPUT)util/hweight.o: ../../lib/hweight.c FORCE
141 $(call rule_mkdir)
134 $(call if_changed_dep,cc_o_c) 142 $(call if_changed_dep,cc_o_c)