From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751995AbcLDUoR (ORCPT ); Sun, 4 Dec 2016 15:44:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34466 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751176AbcLDUn3 (ORCPT ); Sun, 4 Dec 2016 15:43:29 -0500 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern Subject: [PATCH 5/7] perf tools: Force fixdep compilation at the start of the build Date: Sun, 4 Dec 2016 21:42:56 +0100 Message-Id: <1480884178-8072-6-git-send-email-jolsa@kernel.org> In-Reply-To: <1480884178-8072-1-git-send-email-jolsa@kernel.org> References: <1480884178-8072-1-git-send-email-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 04 Dec 2016 20:43:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Link: http://lkml.kernel.org/n/tip-b6wi5cssl8apu74o2kbfheag@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/Makefile.perf | 54 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 112f4f7bb200..25d9d6653746 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -179,6 +179,27 @@ ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) endif endif +# The fixdep build - we force fixdep tool to be built as +# the first target in the separate make session not to be +# disturbed by any parallel make jobs. Once fixdep is done +# we issue the requested build with FIXDEP=1 variable. +# +# The fixdep build is disabled for $(NON_CONFIG_TARGETS) +# targets, because it's not necessary. + +ifdef FIXDEP + force_fixdep := 0 +else + force_fixdep := $(config) +endif + +# Disable config, we are forcing fixdep rule first +# and it does not need config data. + +ifeq ($(force_fixdep),1) + config := 0 +endif + # Set FEATURE_TESTS to 'all' so all possible feature checkers are executed. # Without this setting the output feature dump file misses some features, for # example, liberty. Select all checkers so we won't get an incomplete feature @@ -324,10 +345,22 @@ LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group export INSTALL SHELL_PATH +export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK +export HOSTCC HOSTLD HOSTAR +include $(srctree)/tools/build/Makefile.include + ### Build rules SHELL = $(SHELL_PATH) +ifeq ($(force_fixdep),1) +goals := $(filter-out all sub-make, $(MAKECMDGOALS)) + +$(goals) all: sub-make + +sub-make: fixdep + $(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals) +else all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) @@ -348,10 +381,6 @@ strip: $(PROGRAMS) $(OUTPUT)perf PERF_IN := $(OUTPUT)perf-in.o -export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR -include $(srctree)/tools/build/Makefile.include - JEVENTS := $(OUTPUT)pmu-events/jevents JEVENTS_IN := $(OUTPUT)pmu-events/jevents-in.o @@ -470,7 +499,7 @@ $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(PMU_EVENTS_IN) $(LIBTRACEEVENT_DYNAMIC_L $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS) \ $(PERF_IN) $(PMU_EVENTS_IN) $(LIBS) -o $@ -$(GTK_IN): fixdep FORCE +$(GTK_IN): FORCE $(Q)$(MAKE) $(build)=gtk $(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS) @@ -515,7 +544,7 @@ endif __build-dir = $(subst $(OUTPUT),,$(dir $@)) build-dir = $(if $(__build-dir),$(__build-dir),.) -prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h fixdep archheaders +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ @@ -565,7 +594,7 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h) LIBPERF_IN := $(OUTPUT)libperf-in.o -$(LIBPERF_IN): prepare fixdep FORCE +$(LIBPERF_IN): prepare FORCE $(Q)$(MAKE) $(build)=libperf $(LIB_FILE): $(LIBPERF_IN) @@ -573,10 +602,10 @@ $(LIB_FILE): $(LIBPERF_IN) LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) -$(LIBTRACEEVENT): fixdep FORCE +$(LIBTRACEEVENT): FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a -libtraceevent_plugins: fixdep FORCE +libtraceevent_plugins: FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins $(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins @@ -589,21 +618,21 @@ $(LIBTRACEEVENT)-clean: install-traceevent-plugins: libtraceevent_plugins $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins -$(LIBAPI): fixdep FORCE +$(LIBAPI): FORCE $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a $(LIBAPI)-clean: $(call QUIET_CLEAN, libapi) $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null -$(LIBBPF): fixdep FORCE +$(LIBBPF): FORCE $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) $(LIBBPF)-clean: $(call QUIET_CLEAN, libbpf) $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null -$(LIBSUBCMD): fixdep FORCE +$(LIBSUBCMD): FORCE $(Q)$(MAKE) -C $(SUBCMD_DIR) O=$(OUTPUT) $(OUTPUT)libsubcmd.a $(LIBSUBCMD)-clean: @@ -811,3 +840,4 @@ FORCE: .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE prepare .PHONY: libtraceevent_plugins archheaders +endif # force_fixdep -- 2.7.4