aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-12-06 08:18:49 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-12-06 11:23:02 -0500
commitabb26210a39522a6645bce3f438ed9a26bedb11b (patch)
tree60d39f933f61de1d662fce662950deb77f66b712 /tools
parent16e2ef4ed27f503afc2d69f0980f200b329cab83 (diff)
perf tools: Force fixdep compilation at the start of the build
The fixdep tool needs to be built before everything else, because it fixes every object dependency file. We handle this currently by making all objects to depend on fixdep, which is error prone and is easily forgotten when new object is added. Instead of this, this patch force fixdep tool to be built as the first target in the separate make session. This way we don't need to handle extra fixdep dependencies and we are certain there's no fixdep race with any parallel make job. Committer notes: Testing it: Before: $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin make: Entering directory '/home/acme/git/linux/tools/perf' BUILD: Doing 'make -j4' parallel build Auto-detecting system features: ... dwarf: [ on ] ... dwarf_getlocations: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ on ] ... numa_num_possible_cpus: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libslang: [ on ] ... libcrypto: [ on ] ... libunwind: [ on ] ... libdw-dwarf-unwind: [ on ] ... zlib: [ on ] ... lzma: [ on ] ... get_cpuid: [ on ] ... bpf: [ on ] GEN /tmp/build/perf/common-cmds.h HOSTCC /tmp/build/perf/fixdep.o HOSTLD /tmp/build/perf/fixdep-in.o LINK /tmp/build/perf/fixdep MKDIR /tmp/build/perf/pmu-events/ HOSTCC /tmp/build/perf/pmu-events/json.o MKDIR /tmp/build/perf/pmu-events/ HOSTCC /tmp/build/perf/pmu-events/jsmn.o HOSTCC /tmp/build/perf/pmu-events/jevents.o HOSTLD /tmp/build/perf/pmu-events/jevents-in.o PERF_VERSION = 4.9.rc8.g868cd5 CC /tmp/build/perf/perf-read-vdso32 <SNIP> After: $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin make: Entering directory '/home/acme/git/linux/tools/perf' BUILD: Doing 'make -j4' parallel build HOSTCC /tmp/build/perf/fixdep.o HOSTLD /tmp/build/perf/fixdep-in.o LINK /tmp/build/perf/fixdep Auto-detecting system features: ... dwarf: [ on ] ... dwarf_getlocations: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ on ] ... numa_num_possible_cpus: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libslang: [ on ] ... libcrypto: [ on ] ... libunwind: [ on ] ... libdw-dwarf-unwind: [ on ] ... zlib: [ on ] ... lzma: [ on ] ... get_cpuid: [ on ] ... bpf: [ on ] GEN /tmp/build/perf/common-cmds.h MKDIR /tmp/build/perf/fd/ CC /tmp/build/perf/fd/array.o LD /tmp/build/perf/fd/libapi-in.o MKDIR /tmp/build/perf/fs/ CC /tmp/build/perf/event-parse.o CC /tmp/build/perf/fs/fs.o PERF_VERSION = 4.9.rc8.g57a92f CC /tmp/build/perf/event-plugin.o MKDIR /tmp/build/perf/fs/ CC /tmp/build/perf/fs/tracing_path.o <SNIP> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1481030331-31944-3-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile.perf50
1 files changed, 38 insertions, 12 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9e5a6e1a387d..33b1d9f8555f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -181,6 +181,35 @@ ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
181endif 181endif
182endif 182endif
183 183
184# The fixdep build - we force fixdep tool to be built as
185# the first target in the separate make session not to be
186# disturbed by any parallel make jobs. Once fixdep is done
187# we issue the requested build with FIXDEP=1 variable.
188#
189# The fixdep build is disabled for $(NON_CONFIG_TARGETS)
190# targets, because it's not necessary.
191
192ifdef FIXDEP
193 force_fixdep := 0
194else
195 force_fixdep := $(config)
196endif
197
198export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK
199export HOSTCC HOSTLD HOSTAR
200
201include $(srctree)/tools/build/Makefile.include
202
203ifeq ($(force_fixdep),1)
204goals := $(filter-out all sub-make, $(MAKECMDGOALS))
205
206$(goals) all: sub-make
207
208sub-make: fixdep
209 $(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
210
211else # force_fixdep
212
184# Set FEATURE_TESTS to 'all' so all possible feature checkers are executed. 213# Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.
185# Without this setting the output feature dump file misses some features, for 214# Without this setting the output feature dump file misses some features, for
186# example, liberty. Select all checkers so we won't get an incomplete feature 215# example, liberty. Select all checkers so we won't get an incomplete feature
@@ -365,10 +394,6 @@ strip: $(PROGRAMS) $(OUTPUT)perf
365 394
366PERF_IN := $(OUTPUT)perf-in.o 395PERF_IN := $(OUTPUT)perf-in.o
367 396
368export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK
369export HOSTCC HOSTLD HOSTAR
370include $(srctree)/tools/build/Makefile.include
371
372JEVENTS := $(OUTPUT)pmu-events/jevents 397JEVENTS := $(OUTPUT)pmu-events/jevents
373JEVENTS_IN := $(OUTPUT)pmu-events/jevents-in.o 398JEVENTS_IN := $(OUTPUT)pmu-events/jevents-in.o
374 399
@@ -487,7 +512,7 @@ $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(PMU_EVENTS_IN) $(LIBTRACEEVENT_DYNAMIC_L
487 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS) \ 512 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS) \
488 $(PERF_IN) $(PMU_EVENTS_IN) $(LIBS) -o $@ 513 $(PERF_IN) $(PMU_EVENTS_IN) $(LIBS) -o $@
489 514
490$(GTK_IN): fixdep FORCE 515$(GTK_IN): FORCE
491 $(Q)$(MAKE) $(build)=gtk 516 $(Q)$(MAKE) $(build)=gtk
492 517
493$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS) 518$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
@@ -536,7 +561,7 @@ endif
536__build-dir = $(subst $(OUTPUT),,$(dir $@)) 561__build-dir = $(subst $(OUTPUT),,$(dir $@))
537build-dir = $(if $(__build-dir),$(__build-dir),.) 562build-dir = $(if $(__build-dir),$(__build-dir),.)
538 563
539prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h fixdep archheaders 564prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders
540 565
541$(OUTPUT)%.o: %.c prepare FORCE 566$(OUTPUT)%.o: %.c prepare FORCE
542 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 567 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -586,7 +611,7 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
586 611
587LIBPERF_IN := $(OUTPUT)libperf-in.o 612LIBPERF_IN := $(OUTPUT)libperf-in.o
588 613
589$(LIBPERF_IN): prepare fixdep FORCE 614$(LIBPERF_IN): prepare FORCE
590 $(Q)$(MAKE) $(build)=libperf 615 $(Q)$(MAKE) $(build)=libperf
591 616
592$(LIB_FILE): $(LIBPERF_IN) 617$(LIB_FILE): $(LIBPERF_IN)
@@ -594,10 +619,10 @@ $(LIB_FILE): $(LIBPERF_IN)
594 619
595LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 620LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
596 621
597$(LIBTRACEEVENT): fixdep FORCE 622$(LIBTRACEEVENT): FORCE
598 $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a 623 $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a
599 624
600libtraceevent_plugins: fixdep FORCE 625libtraceevent_plugins: FORCE
601 $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins 626 $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins
602 627
603$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins 628$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
@@ -610,21 +635,21 @@ $(LIBTRACEEVENT)-clean:
610install-traceevent-plugins: libtraceevent_plugins 635install-traceevent-plugins: libtraceevent_plugins
611 $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins 636 $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins
612 637
613$(LIBAPI): fixdep FORCE 638$(LIBAPI): FORCE
614 $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a 639 $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a
615 640
616$(LIBAPI)-clean: 641$(LIBAPI)-clean:
617 $(call QUIET_CLEAN, libapi) 642 $(call QUIET_CLEAN, libapi)
618 $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null 643 $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
619 644
620$(LIBBPF): fixdep FORCE 645$(LIBBPF): FORCE
621 $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) 646 $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
622 647
623$(LIBBPF)-clean: 648$(LIBBPF)-clean:
624 $(call QUIET_CLEAN, libbpf) 649 $(call QUIET_CLEAN, libbpf)
625 $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null 650 $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null
626 651
627$(LIBSUBCMD): fixdep FORCE 652$(LIBSUBCMD): FORCE
628 $(Q)$(MAKE) -C $(SUBCMD_DIR) O=$(OUTPUT) $(OUTPUT)libsubcmd.a 653 $(Q)$(MAKE) -C $(SUBCMD_DIR) O=$(OUTPUT) $(OUTPUT)libsubcmd.a
629 654
630$(LIBSUBCMD)-clean: 655$(LIBSUBCMD)-clean:
@@ -832,3 +857,4 @@ FORCE:
832.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE prepare 857.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE prepare
833.PHONY: libtraceevent_plugins archheaders 858.PHONY: libtraceevent_plugins archheaders
834 859
860endif # force_fixdep