From patchwork Wed Nov 9 18:49:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 17752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp504267wru; Wed, 9 Nov 2022 10:51:55 -0800 (PST) X-Google-Smtp-Source: AMsMyM73FUGut6lG8FE/aS5xcZKzu2LFSnwAvg/vZem/IX4beCPRdSutyPf0cP0d7ekk3EN2azIm X-Received: by 2002:a17:902:b117:b0:186:a1fd:c3df with SMTP id q23-20020a170902b11700b00186a1fdc3dfmr61502864plr.23.1668019914750; Wed, 09 Nov 2022 10:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668019914; cv=none; d=google.com; s=arc-20160816; b=RwEBe1zYtKCw9G0Kt/pndZDLdxmMlC9urRT4E5aLSOvIaz7GX97xOXxq9Ics0PSbEg YAB9yvVDpYQVutDy11OZcZ0r7kchvUDC/FUt9ujyEzAnI3vpqCKpW+Qw7r8J0sTdvWKG 6DYwGdcMkeA+kwg0bU57R/xQCwzdbxa5UuWBqRlDFe+TzGi8UvpFSrM5gSJew27fIhwp pWWRQB2gBHEqI+aXtdrtx49tX/LyoSsq9VZ9sAmYaRs1vafsZRQQraX04S9JgS305Mpk EEFUxthp0GjklRkOw85791YR7wzYUwaaly9APIwrJXEYHds2r/e5vt3SYr7zBmruQTe1 XsNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=xRgbCoc/lULFyNJb294eYOHrQbLaJy+ZT5w1IQWAa5I=; b=Z/dZAp7M+0vObx9cPecikDd/s5ZiGtr+9BYcl2ICCTL3Oy3amX1UaZhmkyiHZALkPH yeBJFjGaISlyCTz5y02dsNSDthYodftjnh/LxG8PzF2yC8BNnvQMWNAwgsYfQnax3e10 ElpQk3adxOseGh6yjCTZGEqDU3if4w/VaWsuFSgyo64TUIZcMlzuuVtTERiNveUeEMej uG0YIPHaic4Fk/Q6i8Vw/V26rlWzH15yMHcUXf8SYTzuI0NSUlXfmF1lv2O3DYGu8B/G 5YDibNq5bC9UddvKCM2AZUMBGjSxU8X5np+fmVVfkqJX0zivcdVk/uBzmbk7GjT053G3 xpdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=EumB9bc4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a056a001a8e00b0056bc64d158csi20263072pfv.172.2022.11.09.10.51.41; Wed, 09 Nov 2022 10:51:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=EumB9bc4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbiKISug (ORCPT + 99 others); Wed, 9 Nov 2022 13:50:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbiKISuT (ORCPT ); Wed, 9 Nov 2022 13:50:19 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3573E2C66F for ; Wed, 9 Nov 2022 10:50:15 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id c188-20020a25c0c5000000b006d8eba07513so6514584ybf.17 for ; Wed, 09 Nov 2022 10:50:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xRgbCoc/lULFyNJb294eYOHrQbLaJy+ZT5w1IQWAa5I=; b=EumB9bc4LH+lOr72gPsmnqZkbUVJvtNqnAVGqcBRzbOPIPb93lyP9xToyLVVrTW3xi pE+Cb4RJx8qP+7rA7yW7Lo/U5cfjAW3dN1yaug91A2NmofBdX2kRGhXyoID3tcEjVg3V lnwEX8y2VL5Xz3GSosbkHJtAWKZTiqCCH5IZUjJn92jP9Mr+v69xYOxll43mTd2txxGN oQVNVy9V/+H0bFD77QGdw8vtLTZMf+Ynbj5kBjTJ+H7JvvJaPeOhhzJyjKdF6V3kvBbK irywbIPvvygBGF5IyDes/rIC7V83mRqgk7KoeO+v+1pqCWkWPTXB5X8fdFa7wg1stjV4 B6cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xRgbCoc/lULFyNJb294eYOHrQbLaJy+ZT5w1IQWAa5I=; b=2xNznZJGI1gI689VDcr+xPriJnoA7NesKOzL9dPRgsVnNWck00YHTYT+xiQZ13wbVV NUkFShtzaOmYIM1cFHxpoRrGy268FMTY1HVU1bkGZw52eub9U/xsKLcp/51XS4Ycy4tH UqOv4Qv98iF5FJwhbMgmxNChxzGrEj5oFAKMzdu0Leg0Jlh7TrT1JOFcexfW2PiXSamt iWmdaIWH/dBtXko0zz89q9zneYztuLqDTDQ9oB/4iCk+UXpLmlsG9o6izDTy+yFbp7AV PKV4GO/YlDxJXYpm83xrzoF4Fg5r4aEMjZ/ijh16cGr8ekjrvu0oYbAYI33vs7AhQkGL F/zA== X-Gm-Message-State: ACrzQf3jyayXnuKllFQbAvrkpC4mxKu+tFx1iFRvcXXEM+21s5QFm5r1 Ve3Ik3sLjbfWjTETp88Ycgi1oXPdOmN4 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:b06f:a254:5ce9:c442]) (user=irogers job=sendgmr) by 2002:a5b:6d1:0:b0:6cb:77dc:1cde with SMTP id r17-20020a5b06d1000000b006cb77dc1cdemr58509073ybq.447.1668019815231; Wed, 09 Nov 2022 10:50:15 -0800 (PST) Date: Wed, 9 Nov 2022 10:49:06 -0800 In-Reply-To: <20221109184914.1357295-1-irogers@google.com> Message-Id: <20221109184914.1357295-7-irogers@google.com> Mime-Version: 1.0 References: <20221109184914.1357295-1-irogers@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH v2 06/14] perf build: Install libtraceevent locally when building From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Masahiro Yamada , Nicolas Schier , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Nick Desaulniers , Andrii Nakryiko Cc: Stephane Eranian , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749045650064522730?= X-GMAIL-MSGID: =?utf-8?q?1749045650064522730?= The perf build currently has a '-Itools/lib' on the CC command line. This causes issues as the libapi, libsubcmd, libtraceevent, libbpf headers are all found via this path, making it impossible to override include behavior. Change the libtraceevent build mirroring the libbpf, libsubcmd, libapi and libperf build, so that it is installed in a directory along with its headers. A later change will modify the include behavior. Similarly, the plugins are now installed into libtraceevent_plugins except they have no header files. Signed-off-by: Ian Rogers --- tools/perf/.gitignore | 3 ++- tools/perf/Makefile.perf | 57 ++++++++++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore index 43f6621ef05e..65b995159cf1 100644 --- a/tools/perf/.gitignore +++ b/tools/perf/.gitignore @@ -42,6 +42,7 @@ libapi/ libbpf/ libperf/ libsubcmd/ +libtraceevent/ +libtraceevent_plugins/ fixdep -libtraceevent-dynamic-list Documentation/doc.dep diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 57aec5a97270..6e5e3f7730b5 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -242,7 +242,8 @@ sub-make: fixdep else # force_fixdep LIBAPI_DIR = $(srctree)/tools/lib/api/ -TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/ +LIBTRACEEVENT_DIR = $(srctree)/tools/lib/traceevent/ +LIBTRACEEVENT_PLUGINS_DIR = $(LIBTRACEEVENT_DIR)/plugins LIBBPF_DIR = $(srctree)/tools/lib/bpf/ LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/ LIBPERF_DIR = $(srctree)/tools/lib/perf/ @@ -292,16 +293,17 @@ grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1)) ifneq ($(OUTPUT),) - TE_PATH=$(OUTPUT) - PLUGINS_PATH=$(OUTPUT) + LIBTRACEEVENT_OUTPUT = $(abspath $(OUTPUT))/libtraceevent else - TE_PATH=$(TRACE_EVENT_DIR) - PLUGINS_PATH=$(TRACE_EVENT_DIR)plugins/ + LIBTRACEEVENT_OUTPUT = $(CURDIR)/libtraceevent endif - -LIBTRACEEVENT = $(TE_PATH)libtraceevent.a +LIBTRACEEVENT_PLUGINS_OUTPUT = $(LIBTRACEEVENT_OUTPUT)_plugins +LIBTRACEEVENT_DESTDIR = $(LIBTRACEEVENT_OUTPUT) +LIBTRACEEVENT_PLUGINS_DESTDIR = $(LIBTRACEEVENT_PLUGINS_OUTPUT) +LIBTRACEEVENT_INCLUDE = $(LIBTRACEEVENT_DESTDIR)/include +LIBTRACEEVENT = $(LIBTRACEEVENT_OUTPUT)/libtraceevent.a export LIBTRACEEVENT -LIBTRACEEVENT_DYNAMIC_LIST = $(PLUGINS_PATH)libtraceevent-dynamic-list +LIBTRACEEVENT_DYNAMIC_LIST = $(LIBTRACEEVENT_PLUGINS_OUTPUT)/libtraceevent-dynamic-list # # The static build has no dynsym table, so this does not work for @@ -821,21 +823,33 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h) LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' 'LDFLAGS=$(filter-out -static,$(LDFLAGS))' -$(LIBTRACEEVENT): FORCE - $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a - -libtraceevent_plugins: FORCE - $(Q)$(MAKE) -C $(TRACE_EVENT_DIR)plugins $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins - -$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins - $(Q)$(MAKE) -C $(TRACE_EVENT_DIR)plugins $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list +$(LIBTRACEEVENT): FORCE | $(LIBTRACEEVENT_OUTPUT) + $(Q)$(MAKE) -C $(LIBTRACEEVENT_DIR) O=$(LIBTRACEEVENT_OUTPUT) \ + DESTDIR=$(LIBTRACEEVENT_DESTDIR) prefix= \ + $@ install_headers $(LIBTRACEEVENT)-clean: $(call QUIET_CLEAN, libtraceevent) - $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null + $(Q)$(RM) -r -- $(LIBTRACEEVENT_OUTPUT) + +libtraceevent_plugins: FORCE | $(LIBTRACEEVENT_PLUGINS_OUTPUT) + $(Q)$(MAKE) -C $(LIBTRACEEVENT_PLUGINS_DIR) O=$(LIBTRACEEVENT_PLUGINS_OUTPUT) \ + DESTDIR=$(LIBTRACEEVENT_PLUGINS_DESTDIR) prefix= \ + plugins + +libtraceevent_plugins-clean: + $(call QUIET_CLEAN, libtraceevent_plugins) + $(Q)$(RM) -r -- $(LIBTRACEEVENT_PLUGINS_OUTPUT) + +$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins + $(Q)$(MAKE) -C $(LIBTRACEEVENT_PLUGINS_DIR) O=$(LIBTRACEEVENT_PLUGINS_OUTPUT) \ + DESTDIR=$(LIBTRACEEVENT_PLUGINS_DESTDIR) prefix= \ + $(LIBTRACEEVENT_FLAGS) $@ install-traceevent-plugins: libtraceevent_plugins - $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins + $(Q)$(MAKE) -C $(LIBTRACEEVENT_PLUGINS_DIR) O=$(LIBTRACEEVENT_PLUGINS_OUTPUT) \ + DESTDIR=$(LIBTRACEEVENT_PLUGINS_DESTDIR) prefix= \ + $(LIBTRACEEVENT_FLAGS) install $(LIBAPI): FORCE | $(LIBAPI_OUTPUT) $(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \ @@ -1060,6 +1074,11 @@ SKELETONS += $(SKEL_OUT)/kwork_trace.skel.h $(SKEL_TMP_OUT) $(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_OUTPUT): $(Q)$(MKDIR) -p $@ +ifndef LIBTRACEEVENT_DYNAMIC +$(LIBTRACEEVENT_OUTPUT) $(LIBTRACEEVENT_PLUGINS_OUTPUT): + $(Q)$(MKDIR) -p $@ +endif + ifdef BUILD_BPF_SKEL BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) @@ -1102,7 +1121,7 @@ endif # BUILD_BPF_SKEL bpf-skel-clean: $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) -clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean +clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean libtraceevent_plugins-clean $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS) $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete $(Q)$(RM) $(OUTPUT).config-detected