From patchwork Fri Jan 6 15:13:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 40164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp876829wrt; Fri, 6 Jan 2023 07:19:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXt733eH5FkwAI1GipitS3WwONro/V3JAOnI0KvmogUA+iIuJJO/o9szSwzpe6BdUi9RWdp7 X-Received: by 2002:a17:90a:1a49:b0:226:8803:3d3d with SMTP id 9-20020a17090a1a4900b0022688033d3dmr15020913pjl.14.1673018361770; Fri, 06 Jan 2023 07:19:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673018361; cv=none; d=google.com; s=arc-20160816; b=JRNooWRiI0Ocgv3t/v/8bAp6/lsKueadOSyq98zcNJeD1bDY6epMb3/mzG2ccTw8On sc/E8d49XYed5WNzCskpszekXxNMDip8MFMdXBazoBZ69TLG9bJbRIFQk3+vLEnWpKzM GjOb7hf0mg5Eh8jmzu6VQlpqDLHuBDCGK7tRFGsKhh6bE7EejM1RwSsePJul/yiyxJqd coJ6C5fzPbUNjDCbJNKSWgqlCgkaKaVeOFTvojxB0fNdowa14iw5kXcy/QhK5Lr1hZ1u 9QAKocUpkbuDemFjkI3+0t4+MdaiidyI14juy7szwEqxlrUXRqR1uV9PxobLlmofmYID CtqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:mime-version:message-id:date :dkim-signature; bh=WQYhbBO5EgEKPlarlDf3lbw8Z+u809vOBp5gbzOXfWg=; b=aPahOSd54f5Q58kYFkypVWqRNqV5LkWh0lBUn99dWu0PnXGQ9stBmSWvgcSq1GLe9v dzWDU4yh2Ut6ITvUV2Wf2XJYHATkDIE47r+dG7Xl13pXIoLXTfb+z9sBTyZhjUyo84/R JEZCnqRGMeeeTu2aI1RuM/S4p9GOg8LP5uDUxjSg4kEBZiDDA+3TXSxzWrt4cPmIrGEE eW8j7+NHaUtxcuOjOmA7ZQdhhQNTpC94zlQXSTdKOuiDbJyq8hdDpbqwnQbj21m42kMV dIU+k/hCSTz+a0XqBwHSNgkRdXQLU4OSgqRo53dPFwgYrRUY/qGxwd0VI8dB+2P6se9i q8gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZglYSagX; 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 pf3-20020a17090b1d8300b00225bd7d68cfsi5500562pjb.153.2023.01.06.07.19.06; Fri, 06 Jan 2023 07:19:21 -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=ZglYSagX; 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 S231387AbjAFPNz (ORCPT + 99 others); Fri, 6 Jan 2023 10:13:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234786AbjAFPNe (ORCPT ); Fri, 6 Jan 2023 10:13:34 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87671809BA for ; Fri, 6 Jan 2023 07:13:33 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-4c11ae6ab25so20824177b3.8 for ; Fri, 06 Jan 2023 07:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=WQYhbBO5EgEKPlarlDf3lbw8Z+u809vOBp5gbzOXfWg=; b=ZglYSagXvvcpZ/nsgRjuPaZDjdPN8PQgxIP65++2BPx/oEUTNGiJ6AoAHFhWjzunNj z0Wh2NzigVLGZE5V70sHsDkSHRIlbX04YSsFY4kZj+VKrKXUSKQU/IHyWYpeZ4h6s+LM HuFMdrRs+7Os/tAO0gnglPLlsTOnUvsLWM2eD5F3eYPeJZTBYEIeitL6HpEE9KDqjSpQ fHJLpcogYbfis5/hdrejzsvN++vqkalAmAZWn3OYTiEmPV1uKdzaXwfIs9Cwkqa4oU3m vJ6baOqAhLGcADA5RNODdFXe/HvYbRrf2AfZG0Xg+OxM7u0cMNGAGrzoIYzm23eopTfF RLWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=WQYhbBO5EgEKPlarlDf3lbw8Z+u809vOBp5gbzOXfWg=; b=2vNDX4dst3HGe71ZArnun7ZRnQJh5hav4USi7McdjUrQKPGekxESUdNbWaBJQiJx5Y vIhmbvBxL1BsU4ugaAxBuP03srEAsHCAPJFDprJie1In6pzyp6wv3MN7O+oVO5ak+7Rv xJ/MbhWF4JOXY9GIeFUToV+1mN0h+pYsyv1qDTfc/Fp4TJXmR6SMqmEC66JSFPoNcmXF xrZRCbZ32wQZgsuNu30yfMWxK4YkBKqceBNpyiKfry2mnG+3wFYlLbMGMxxzMPHBbAg/ EjoisngqqwKIzGzs8PKkpOqevrG+etRqsikqbrT2uiYxvmhf50VE6jh2lBFoC60kM4Fp Arcg== X-Gm-Message-State: AFqh2kowwdKb6MOS638TxF/cVvbwds+4N65tqnlm/N6vMkZchu04OnZY 78QSi2C5toRLiZ7IdLRZrBiAaiYQrAk/ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:b317:a30:653a:18e5]) (user=irogers job=sendgmr) by 2002:a0d:cbd5:0:b0:469:d2b9:d8e8 with SMTP id n204-20020a0dcbd5000000b00469d2b9d8e8mr5538863ywd.177.1673018012862; Fri, 06 Jan 2023 07:13:32 -0800 (PST) Date: Fri, 6 Jan 2023 07:13:19 -0800 Message-Id: <20230106151320.619514-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v3 1/2] perf build: Properly guard libbpf includes From: Ian Rogers To: Mike Leach , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, acme@kernel.org, irogers@google.com, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org 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=ham 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?1754286901337976833?= X-GMAIL-MSGID: =?utf-8?q?1754286901337976833?= Including libbpf header files should be guarded by HAVE_LIBBPF_SUPPORT. In bpf_counter.h, move the skeleton utilities under HAVE_BPF_SKEL. Fixes: d6a735ef3277 ("perf bpf_counter: Move common functions to bpf_counter.h") Reported-by: Mike Leach Signed-off-by: Ian Rogers --- tools/perf/builtin-trace.c | 2 ++ tools/perf/util/bpf_counter.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 86e06f136f40..d21fe0f32a6d 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -16,7 +16,9 @@ #include "util/record.h" #include +#ifdef HAVE_LIBBPF_SUPPORT #include +#endif #include "util/bpf_map.h" #include "util/rlimit.h" #include "builtin.h" diff --git a/tools/perf/util/bpf_counter.h b/tools/perf/util/bpf_counter.h index 4dbf26408b69..c6d21c07b14c 100644 --- a/tools/perf/util/bpf_counter.h +++ b/tools/perf/util/bpf_counter.h @@ -4,9 +4,12 @@ #include #include + +#ifdef HAVE_LIBBPF_SUPPORT #include #include #include +#endif struct evsel; struct target; @@ -87,6 +90,8 @@ static inline void set_max_rlimit(void) setrlimit(RLIMIT_MEMLOCK, &rinf); } +#ifdef HAVE_BPF_SKEL + static inline __u32 bpf_link_get_id(int fd) { struct bpf_link_info link_info = { .id = 0, }; @@ -127,5 +132,6 @@ static inline int bperf_trigger_reading(int prog_fd, int cpu) return bpf_prog_test_run_opts(prog_fd, &opts); } +#endif /* HAVE_BPF_SKEL */ #endif /* __PERF_BPF_COUNTER_H */ From patchwork Fri Jan 6 15:13:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 40166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp877694wrt; Fri, 6 Jan 2023 07:21:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXtDg51tHEWXNbmb37pRGd/1Ifq2UVuDSPx9M2dKmQMp/7UV1ACzhQNtO6J//Yr6cdfW1UmO X-Received: by 2002:a62:524d:0:b0:582:cddd:784a with SMTP id g74-20020a62524d000000b00582cddd784amr12111195pfb.5.1673018472858; Fri, 06 Jan 2023 07:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673018472; cv=none; d=google.com; s=arc-20160816; b=U0h/li9xxsvkoFkK4ilpmgXVABiKY/pfMm8JkNuLnmCR1mjTeKh+L3xYeALF1cniPY KDZVgCCTgQURgsmz7NSX10v8+ptwSFhZhnEe2XY+o0wS1tg9b82xTMCFf3YlY/9gT1UD XEhtFd4NOEaFHkE3DLuXDXyYCfx67GXPqQxuU3otgJuuLqPsryFVX00th23x8fQz2ZrV 8VR4+PGWXYE+pUuoZKjGpML+kX2DeCYXvUgC2C5l1m0L355+KgK45XGUbm3eF0h2iZf1 S1dT7Q3KEzWayaOkKp5W5Wu7eKO6Guc+qBHdNdUEBz/+y+Bkho0TMisUU+YRqhjldfdB 9Rag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=1ELKsvqp/CVQlQh6V4i31lh01VunlKiC/zGB5BPQtSo=; b=lIJkl4vdy3UyRQhOTlfz1mOPUNhMWvEYBz7pQnRDcNZuDWW4vbHQSCOuDls4WNm/4X 2FoHSJZFgBhitOoJTj4VWhPVIBX6NC9Xhmt23xqX7FfAz9189L9VBiI8JHvOsSeRLLGq X76nHf49pnVCdFpmbX2IKGQDo744LKcyLpCVg6bPi+aXcZsftsyCj6d9TIrqBUW85QM/ Bj8JcB+sEuF/K9ZyAttFNyLtZRwDN8Nii6sOnKgSBaj4EoxZauoeGIB8eMCua/+1JE2J XbGKXiuebMAku6IUp4BMZBWd0BLsKL5oyB0WFCiqYwYxv4FZs1mMpFL41lxoxYbnhcyH OyZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=b1woKxlT; 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 h12-20020a056a00170c00b0058286279c89si1727074pfc.309.2023.01.06.07.20.59; Fri, 06 Jan 2023 07:21:12 -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=b1woKxlT; 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 S230169AbjAFPN6 (ORCPT + 99 others); Fri, 6 Jan 2023 10:13:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235351AbjAFPNo (ORCPT ); Fri, 6 Jan 2023 10:13:44 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB0B28111F for ; Fri, 6 Jan 2023 07:13:42 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-4597b0ff5e9so20977197b3.10 for ; Fri, 06 Jan 2023 07:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=1ELKsvqp/CVQlQh6V4i31lh01VunlKiC/zGB5BPQtSo=; b=b1woKxlTxDe2aMky9Gxycj7tdnYGqz4wHF+OS3uMz1LMlDeH1+FDNBZHw6QGRgHJbE 8KrRqouh3zKL51ld/RXy0PvPwQ/BNTrQ3mOLgjhTT/8rXpw2ZFVBzsfIzg8d/8Po1Usf zcdtFlfNIb+0vGlczu0pDF7irJQLaScldPBTyI7U4131OMwmPcYr88HTkl+JM8Xq+yMH KcLDUd1Cw0RU8ccBM+008GgZ6idhgM1U+quqBNoEc1SU3z+gAaPQJZgfpbvtJQfM902M 9k1c+/R5CXLIvrS945izzUudap5Gvqigac4ZN/JCC6w5tg/19v8XvJDRQJnZEjbd/u2F tA4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=1ELKsvqp/CVQlQh6V4i31lh01VunlKiC/zGB5BPQtSo=; b=IMgoUnJ/GqZ962gJ8An0UnOuoa+JGgsq4KH31HFiAtzxXKLjFRcgb5sDncsDdamzhF vJz0vH28IGDQXtRQD3H2yBzuKhqOC1rJxPxB5EEe4eoxVL5W/qmDx0SaKXlO2VvuhsT2 g7Oa4TmscBmB2lKMiECu0mCfEPY1X5C46wWHv096hgK2U20U26JnJOt9n42ldzYkPuNL KfF/ZRGXHAzn1K6lrzgjaB5jsciw9eKlgC7CIF2O9yhWBrx11VZ3cZMRyDbzoAj+PEwG KDldmhyN4QapJu2zEIlgeFlXUFInVYEWHJg2OQiLhcD2mKnBM4wm1AiFWX+/21JHZw6z KfPQ== X-Gm-Message-State: AFqh2kqPc6C6z6tlCVhAxKZM7QQlCcRaRLyb2/qYqeaHSFDSLWX/WBXl Qa/QgoC/60lft1e3EUV3VrK5rF5z76ps X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:b317:a30:653a:18e5]) (user=irogers job=sendgmr) by 2002:a25:5144:0:b0:753:4db:6fcc with SMTP id f65-20020a255144000000b0075304db6fccmr5824670ybb.1.1673018022074; Fri, 06 Jan 2023 07:13:42 -0800 (PST) Date: Fri, 6 Jan 2023 07:13:20 -0800 In-Reply-To: <20230106151320.619514-1-irogers@google.com> Message-Id: <20230106151320.619514-2-irogers@google.com> Mime-Version: 1.0 References: <20230106151320.619514-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v3 2/2] perf build: Fix build error when NO_LIBBPF=1 From: Ian Rogers To: Mike Leach , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, acme@kernel.org, irogers@google.com, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org 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?1754287017792954010?= X-GMAIL-MSGID: =?utf-8?q?1754287017792954010?= The $(LIBBPF) target should only be a dependency of prepare if the static version of libbpf is needed. Add a new LIBBPF_STATIC variable that is set by Makefile.config. Use LIBBPF_STATIC to determine whether the CFLAGS, etc. need updating and for adding $(LIBBPF) as a prepare dependency. As Makefile.config isn't loaded for "clean" as a target, always set LIBBPF_OUTPUT regardless of whether it is needed for $(LIBBPF). This is done to minimize conditional logic for $(LIBBPF)-clean. This issue and an original fix was reported by Mike Leach in: https://lore.kernel.org/lkml/20230105172243.7238-1-mike.leach@linaro.org/ Fixes: 746bd29e348f ("perf build: Use tools/lib headers from install path") Reported-by: Mike Leach Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 2 ++ tools/perf/Makefile.perf | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index c2504c39bdcb..7c00ce0a7464 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -602,6 +602,8 @@ ifndef NO_LIBELF dummy := $(error Error: No libbpf devel library found, please install libbpf-devel); endif else + # Libbpf will be built as a static library from tools/lib/bpf. + LIBBPF_STATIC := 1 CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID CFLAGS += -DHAVE_LIBBPF_BPF_PROG_LOAD CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 13e7d26e77f0..4e370462e7e1 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -303,10 +303,12 @@ ifneq ($(OUTPUT),) else LIBBPF_OUTPUT = $(CURDIR)/libbpf endif -LIBBPF_DESTDIR = $(LIBBPF_OUTPUT) -LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include -LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a -CFLAGS += -I$(LIBBPF_OUTPUT)/include +ifdef LIBBPF_STATIC + LIBBPF_DESTDIR = $(LIBBPF_OUTPUT) + LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include + LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a + CFLAGS += -I$(LIBBPF_OUTPUT)/include +endif ifneq ($(OUTPUT),) LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd @@ -393,10 +395,8 @@ endif export PERL_PATH PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) -ifndef NO_LIBBPF - ifndef LIBBPF_DYNAMIC - PERFLIBS += $(LIBBPF) - endif +ifdef LIBBPF_STATIC + PERFLIBS += $(LIBBPF) endif # We choose to avoid "if .. else if .. else .. endif endif" @@ -756,12 +756,15 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc $(arch_errno_name_array) \ $(sync_file_range_arrays) \ $(LIBAPI) \ - $(LIBBPF) \ $(LIBPERF) \ $(LIBSUBCMD) \ $(LIBSYMBOL) \ bpf-skel +ifdef LIBBPF_STATIC +prepare: $(LIBBPF) +endif + $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@