From patchwork Fri Dec 2 04:57:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 28706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp649031wrr; Thu, 1 Dec 2022 20:59:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf7bLxQtFBumehtH9eze+7VanTQlmNxNKdSMAbde012PbFerFCOCWUlBv2V245LAIuESl9qk X-Received: by 2002:a17:906:1d14:b0:7ad:79c0:46f4 with SMTP id n20-20020a1709061d1400b007ad79c046f4mr58490234ejh.363.1669957143283; Thu, 01 Dec 2022 20:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669957143; cv=none; d=google.com; s=arc-20160816; b=u9fE4eOKOU7oY6p8d/Qqt9JBUkj/iSy0bEbKhTeONRdr3y5u53olmp+9F3/TJm8jhd SjK4pB6RcIjFtQZ2Hm2RpXsfau07gwOqIdzmK3S6QKARc2Vi3fDCe+l1Y0lx3jfvzSM1 H/PdXiiG3kWtTXxcd8NOzqIi6dOsb2FcO5depglkG//boLB9FQx8lvQi3fvNZCyssGKY fMHDGe+3+6EkNRkfr5DKXYvU1tOIQmUPvokR4i+Flue2wHQRA7WV9dvrKVNTbJzRZUAb CDcUc7r4K9ttqrgeiBnJNvbtm07LvIMa1tu22MatnanypvbvPTVD7wjeDEi/hgCdg0NC quJQ== 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=jGokNFaqiWO8B2J/T6MZZ4ADWJYF/iSbGD5+uCgO7sc=; b=N69UtnEShqeqv9SsGuCeAxQlhWRlUob94gv5550QTP43CX9V9V149gJSzIs34/UNxc ChSMv2IKb344TY6zE5MzkmR8yJ48qtLd+s0gJ1mRL0rlyXdmOfC0szn7Au8+EA6fYtCW fx2bINaCDBmkx8V5j2GTkOQAkwLFtjE6fj7hTBIKVJmAZTzBw8Sa3q6sYvyUr3tUVuCO vopsoi3C0MFC2rXrcwokXho/UoKMchh8+IOHNUC6+ln5Gj3DT/R31l6BtkHCibhxzZao KG1Wsu8ZIfEM+hV8bugLKuNiJZjX5hI4G3m2KvuS/dr1+8RY3OlWadCFajblA0MU/fN3 h7Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gL8o14Ur; 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 s24-20020a05640217d800b0045c9dbe290csi5230683edy.406.2022.12.01.20.58.40; Thu, 01 Dec 2022 20:59:03 -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=gL8o14Ur; 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 S232228AbiLBE6Q (ORCPT + 99 others); Thu, 1 Dec 2022 23:58:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbiLBE6M (ORCPT ); Thu, 1 Dec 2022 23:58:12 -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 3CC74A4302 for ; Thu, 1 Dec 2022 20:58:07 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id 187-20020a250dc4000000b006f8cd26bfcfso2452458ybn.13 for ; Thu, 01 Dec 2022 20:58:07 -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=jGokNFaqiWO8B2J/T6MZZ4ADWJYF/iSbGD5+uCgO7sc=; b=gL8o14UrQviMjz6ojWwVm9joeKIp5dL9zqvEgl2iI/RpvbLfvzb/sOzg1Xl/ZpCenS lcAhj5PIsQgKEfWWxPPNjoSNJRH4u2Dovx3VEp6Jr5HtV0Tcm58LsJeJcggxHlp/cPbZ 6YeaiNKyJNPW3kujOi+DMFUiwbGcs2V4J0/qKcXQ+2/TrB69zNZT5hHSPYqgyV4v1JZu 9vCvjBMVHDD5YEaHwXI3ll3jUOcSFG3OozsCxyyAOg9AgImeDl1zuXJdhZ0Sk7aGS7Rr TIv1777uLKu6IwikLYMY9ozGV7d+CbAc1fPwyqSNXBhB7q/s0jobbK7pM1pfJYjqx8vl IgVQ== 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=jGokNFaqiWO8B2J/T6MZZ4ADWJYF/iSbGD5+uCgO7sc=; b=woGljwp9dlttC3TFuwqfp9n69/YWr9IHS31/7q32qMrbklssZtf+d/mB3LInD8dmFJ IRRBHifW+nTwYw/aR4/2ejQiKIbMo6qU5tGUBoe5nK1Wsmij0NJ1lnIXSye1GI5AtVHJ AU9+aJ7UEHOAIaz14MYDK5L1sRpeRn2fRybKZSr+BNuLwJPa+sT5zW6fNDScnz6th+NV jHJ63FEeVhsmoiTvwtdkA7FtzHue84Qea8BJT/ceCXsQEzlSRdTyHE8n8Io0UxbmLpyl 57sUFjeL7Fnl/wgZaw6am2QzP29InPQh2ySmHi3XrHhwUUeWVEqT5z+rH+gFO9ZhnW9o mOIw== X-Gm-Message-State: ANoB5plfRnKJb8DpHCHNBmNKoafR6mui9bLSqnNfG7NAgvp1Sw0kid4U o5C+N5XGLsuYpfTCiYDlMV+C9SyV5qiz X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:e3b0:e3d1:6040:add2]) (user=irogers job=sendgmr) by 2002:a25:ca58:0:b0:6f4:3ced:f7f8 with SMTP id a85-20020a25ca58000000b006f43cedf7f8mr28634915ybg.489.1669957086560; Thu, 01 Dec 2022 20:58:06 -0800 (PST) Date: Thu, 1 Dec 2022 20:57:39 -0800 In-Reply-To: <20221202045743.2639466-1-irogers@google.com> Message-Id: <20221202045743.2639466-2-irogers@google.com> Mime-Version: 1.0 References: <20221202045743.2639466-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Subject: [PATCH 1/5] tools lib api: Add dependency test to install_headers From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Josh Poimboeuf , Nathan Chancellor , Nick Desaulniers , Tom Rix , Masahiro Yamada , Nicolas Schier , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev 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=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?1751076981534370365?= X-GMAIL-MSGID: =?utf-8?q?1751076981534370365?= Compute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt. Signed-off-by: Ian Rogers --- tools/lib/api/Makefile | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile index 3649c7f7ea65..044860ac1ed1 100644 --- a/tools/lib/api/Makefile +++ b/tools/lib/api/Makefile @@ -88,10 +88,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ + fi; \ + $(INSTALL) $1 $(if $3,-m $3,) '$2' endef install_lib: $(LIBFILE) @@ -99,14 +99,28 @@ install_lib: $(LIBFILE) $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libapi_headers) \ - $(call do_install,cpu.h,$(prefix)/include/api,644); \ - $(call do_install,debug.h,$(prefix)/include/api,644); \ - $(call do_install,io.h,$(prefix)/include/api,644); \ - $(call do_install,fd/array.h,$(prefix)/include/api/fd,644); \ - $(call do_install,fs/fs.h,$(prefix)/include/api/fs,644); \ - $(call do_install,fs/tracing_path.h,$(prefix)/include/api/fs,644); +HDRS := cpu.h debug.h io.h +FD_HDRS := fd/array.h +FS_HDRS := fs/fs.h fs/tracing_path.h +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/api +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) +INSTALL_FD_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(FD_HDRS)) +INSTALL_FS_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(FS_HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +$(INSTALL_FD_HDRS): $(INSTALL_HDRS_PFX)/fd/%.h: fd/%.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/fd/,644) + +$(INSTALL_FS_HDRS): $(INSTALL_HDRS_PFX)/fs/%.h: fs/%.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/fs/,644) + +install_headers: $(INSTALL_HDRS) $(INSTALL_FD_HDRS) $(INSTALL_FS_HDRS) + $(call QUIET_INSTALL, libapi_headers) install: install_lib install_headers