Message ID | 20221202045743.2639466-4-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp649156wrr; Thu, 1 Dec 2022 20:59:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5XSFp2bI7nGdhnI3LbnkafxeXfOLo43XbuDDT8xu+Fk5aT14aFYWNpPU6qIcgYklOwjbDB X-Received: by 2002:a50:ed90:0:b0:46a:e6e3:b3cf with SMTP id h16-20020a50ed90000000b0046ae6e3b3cfmr26122737edr.333.1669957169905; Thu, 01 Dec 2022 20:59:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669957169; cv=none; d=google.com; s=arc-20160816; b=ghp8+O5cRbTBoxAR/6kkeV7dpBGkYXs4N15pt13cRsEe6AeGUlxQxjs70kf3EzwO/Y 6WL5l0juPnYRdalMP6LVzHI02B7IJ+hmXs7xw0QJRHRzVXmax7Jlo4tidrNn4QByuXXE sHDsnKGycmZbZ/rTvIDoTe/rTAkkxq7dTLgc+nXbZJv77mpQHcKkhVGG/BiV3J/4sgQn nKb7/PkVyK6LTV/GzMkUU5jzx1ILtv8+BiSL/CXgIhEVEFtzTsTvdK+xFog02H1iNg2n U9qvi1EB5pDuspGHKIkS6spdFB7USfRlJBZDw7n6Lw88VX5ESI1F1Xt/vHQQZ4CbEBBy v96Q== 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=Xhcm838vqRbviJVINtawNn6TNcB3z9aWYltBLm5HIxk=; b=TjQ1TfgIN7umJqqjJ9L8uucXmeYNVMYYzNZRI9ld0sjDkZA54cjvP2s6+LeAibWqEG +fmO48kovE+ENfJvzSuP+rvul7u6gMOEZAhgwMOS9PAAensMAP+GsVHu1lRx+RpnNln3 luuT2CGuxsxF19XlpGZ2sdCmi13fj97WgLFVeMt/SAlfqlD6nGlEUYxyfwUY4LSq4I38 vhTZTCq+lM4Alcy6rNJ7exPka7Xo4HT/F/DYA6whZIBW0dhlYeviZcekelm6wQ5zXjBm eucCNoz03VzGm75Psetu/Zv4/ZI+lneXp0bMQNFfyAPwcVtATmoP/uRRSIIiwrjYoTx3 I5Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PxVUhm64; 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 ji16-20020a170907981000b007833c7cf1dcsi3256572ejc.387.2022.12.01.20.59.06; Thu, 01 Dec 2022 20:59:29 -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=PxVUhm64; 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 S232349AbiLBE6l (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Thu, 1 Dec 2022 23:58:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232238AbiLBE63 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 1 Dec 2022 23:58:29 -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 4FED4CCEC6 for <linux-kernel@vger.kernel.org>; Thu, 1 Dec 2022 20:58:21 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id e15-20020a5b0ccf000000b006ed1704b40cso4015551ybr.5 for <linux-kernel@vger.kernel.org>; Thu, 01 Dec 2022 20:58:21 -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=Xhcm838vqRbviJVINtawNn6TNcB3z9aWYltBLm5HIxk=; b=PxVUhm64KsR6Mi0JEzZpmyH+ESj3GpUqdRBullEc2TxUiMuvpELl5BPD4CkqSSATx1 aL6QaAxPJ3htK3byYaO89DGkDpFn1KRa3HgX8lWZRHnSpFb4Eb4ZQlu1Bsc7xyTIEHsI NOQ5J2WyixET0VOdWUYOypZJWpIZu6Q2rBfTJbftC7WMaCjfbvjIt6BwSwWzoNKVXFT1 iEFe4fokWc/5rSyeeF0LHkHUZaAr/CLM+4B7/Jsf4BLyWytkbkPraQCiZSTjYKK4ts5S lOpUyFOSGaKEaT+gnY6PBMdyeS0ijyebSTbrKj6NyIoNfnMC/OT3aQZf+IMcUZsDZj+5 xiVQ== 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=Xhcm838vqRbviJVINtawNn6TNcB3z9aWYltBLm5HIxk=; b=KK/RTZOK0Rf/65Y3Z1iadufqeJka9hPydPbzCJou+D2QAm2CpiZr469X3t34Tz4R7E Py0r+ArmbyrJtQK4oeLVfWlhek/1CdfiRPcBwODKQluJXqNdjUtKlQZ4ak+avLkk+knr LNizYP22YI3c3eHGWAjWTZRLn+YslNaD+RI2/YZfkFVQapAinaQSs3898J2cvHtrn8AA 4bXO3aoQTFQCllT+CXLShvQ4VYgqajd9slp3ln+YxdHoTeY0NjZ5DxPoUde2qjHl9Zbv dVbYYQUwOy0wUXv3xXb+Gn/9BCdU64zAjN+GZSmJ5ASdegr9H4cJ+wep8tVOGGuiCAfD beCA== X-Gm-Message-State: ANoB5plLHiDcKOZZY+cCpGKdUerjGX+jPGl/FH8qWhFgU4+TTHx2nHNE utKAsYKVyi3b0tmGM4MnHh+O3fPFSEw+ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:e3b0:e3d1:6040:add2]) (user=irogers job=sendgmr) by 2002:a25:3454:0:b0:6f9:41dd:faef with SMTP id b81-20020a253454000000b006f941ddfaefmr14632533yba.87.1669957101240; Thu, 01 Dec 2022 20:58:21 -0800 (PST) Date: Thu, 1 Dec 2022 20:57:41 -0800 In-Reply-To: <20221202045743.2639466-1-irogers@google.com> Message-Id: <20221202045743.2639466-4-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 3/5] tools lib subcmd: Add dependency test to install_headers From: Ian Rogers <irogers@google.com> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Josh Poimboeuf <jpoimboe@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Masahiro Yamada <masahiroy@kernel.org>, Nicolas Schier <nicolas@fjasle.eu>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com> Content-Type: text/plain; charset="UTF-8" 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751077009470749453?= X-GMAIL-MSGID: =?utf-8?q?1751077009470749453?= |
Series |
Improvements to incremental builds
|
|
Commit Message
Ian Rogers
Dec. 2, 2022, 4:57 a.m. UTC
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 <irogers@google.com>
---
tools/lib/subcmd/Makefile | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
Comments
On Thu, Dec 01, 2022 at 08:57:41PM -0800 Ian Rogers wrote: > 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 <irogers@google.com> > --- > tools/lib/subcmd/Makefile | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile > index 9a316d8b89df..b87213263a5e 100644 > --- a/tools/lib/subcmd/Makefile > +++ b/tools/lib/subcmd/Makefile > @@ -89,10 +89,10 @@ define do_install_mkdir > endef > > define do_install > - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ > - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ > + if [ ! -d '$2' ]; then \ > + $(INSTALL) -d -m 755 '$2'; \ > fi; \ > - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' > + $(INSTALL) $1 $(if $3,-m $3,) '$2' What about using '$(INSTALL) -D ...' instead of the if-mkdir-block above? (E.g. as in tools/debugging/Makefile.) Kind regards, Nicolas > endef > > install_lib: $(LIBFILE) > @@ -100,13 +100,16 @@ install_lib: $(LIBFILE) > $(call do_install_mkdir,$(libdir_SQ)); \ > cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) > > -install_headers: > - $(call QUIET_INSTALL, libsubcmd_headers) \ > - $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \ > - $(call do_install,help.h,$(prefix)/include/subcmd,644); \ > - $(call do_install,pager.h,$(prefix)/include/subcmd,644); \ > - $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \ > - $(call do_install,run-command.h,$(prefix)/include/subcmd,644); > +HDRS := exec-cmd.h help.h pager.h parse-options.h run-command.h > +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/subcmd > +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) > + > +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h > + $(call QUIET_INSTALL, $@) \ > + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) > + > +install_headers: $(INSTALL_HDRS) > + $(call QUIET_INSTALL, libsubcmd_headers) > > install: install_lib install_headers > > -- > 2.39.0.rc0.267.gcb52ba06e7-goog
On Mon, Dec 12, 2022 at 12:57 PM Nicolas Schier <nicolas@fjasle.eu> wrote: > > On Thu, Dec 01, 2022 at 08:57:41PM -0800 Ian Rogers wrote: > > 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 <irogers@google.com> > > --- > > tools/lib/subcmd/Makefile | 23 +++++++++++++---------- > > 1 file changed, 13 insertions(+), 10 deletions(-) > > > > diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile > > index 9a316d8b89df..b87213263a5e 100644 > > --- a/tools/lib/subcmd/Makefile > > +++ b/tools/lib/subcmd/Makefile > > @@ -89,10 +89,10 @@ define do_install_mkdir > > endef > > > > define do_install > > - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ > > - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ > > + if [ ! -d '$2' ]; then \ > > + $(INSTALL) -d -m 755 '$2'; \ > > fi; \ > > - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' > > + $(INSTALL) $1 $(if $3,-m $3,) '$2' > > What about using '$(INSTALL) -D ...' instead of the if-mkdir-block above? > (E.g. as in tools/debugging/Makefile.) > > Kind regards, > Nicolas Thanks Nicolas, the reason was to keep the code consistent. That's not to say this is the best approach. For example, here is the same thing for tools/lib/api: https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/lib/api/Makefile?h=perf/core&id=f43368371888694a2eceaaad8f5e9775c092009a#n84 If you'd like to improve this in all the versions and send patches I'd be happy to take a look. Thanks, Ian > > endef > > > > install_lib: $(LIBFILE) > > @@ -100,13 +100,16 @@ install_lib: $(LIBFILE) > > $(call do_install_mkdir,$(libdir_SQ)); \ > > cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) > > > > -install_headers: > > - $(call QUIET_INSTALL, libsubcmd_headers) \ > > - $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \ > > - $(call do_install,help.h,$(prefix)/include/subcmd,644); \ > > - $(call do_install,pager.h,$(prefix)/include/subcmd,644); \ > > - $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \ > > - $(call do_install,run-command.h,$(prefix)/include/subcmd,644); > > +HDRS := exec-cmd.h help.h pager.h parse-options.h run-command.h > > +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/subcmd > > +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) > > + > > +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h > > + $(call QUIET_INSTALL, $@) \ > > + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) > > + > > +install_headers: $(INSTALL_HDRS) > > + $(call QUIET_INSTALL, libsubcmd_headers) > > > > install: install_lib install_headers > > > > -- > > 2.39.0.rc0.267.gcb52ba06e7-goog > > -- > epost|xmpp: nicolas@fjasle.eu irc://oftc.net/nsc > ↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f > -- frykten for herren er opphav til kunnskap --
On Tue 13 Dec 2022 13:28:21 GMT, Ian Rogers wrote: > On Mon, Dec 12, 2022 at 12:57 PM Nicolas Schier <nicolas@fjasle.eu> wrote: > > > > On Thu, Dec 01, 2022 at 08:57:41PM -0800 Ian Rogers wrote: > > > 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 <irogers@google.com> > > > --- > > > tools/lib/subcmd/Makefile | 23 +++++++++++++---------- > > > 1 file changed, 13 insertions(+), 10 deletions(-) > > > > > > diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile > > > index 9a316d8b89df..b87213263a5e 100644 > > > --- a/tools/lib/subcmd/Makefile > > > +++ b/tools/lib/subcmd/Makefile > > > @@ -89,10 +89,10 @@ define do_install_mkdir > > > endef > > > > > > define do_install > > > - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ > > > - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ > > > + if [ ! -d '$2' ]; then \ > > > + $(INSTALL) -d -m 755 '$2'; \ > > > fi; \ > > > - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' > > > + $(INSTALL) $1 $(if $3,-m $3,) '$2' > > > > What about using '$(INSTALL) -D ...' instead of the if-mkdir-block above? > > (E.g. as in tools/debugging/Makefile.) > > > > Kind regards, > > Nicolas > > Thanks Nicolas, the reason was to keep the code consistent. That's not > to say this is the best approach. For example, here is the same thing > for tools/lib/api: > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/lib/api/Makefile?h=perf/core&id=f43368371888694a2eceaaad8f5e9775c092009a#n84 > > If you'd like to improve this in all the versions and send patches I'd > be happy to take a look. > > Thanks, > Ian Ian, while watching at tools/lib/*/Makefile I stumple across the special single-quote handling (e.g. 'DESTDIR_SQ') several times. Top-level Makefile and kbuild are not designed to work with file or directory names containing spaces. Do you know whether this is needed for the installation rules in tools/lib/? I'd like to remove support for path names with spaces for a increasing simplicity and consistency. Kind regards, Nicolas
diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile index 9a316d8b89df..b87213263a5e 100644 --- a/tools/lib/subcmd/Makefile +++ b/tools/lib/subcmd/Makefile @@ -89,10 +89,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + $(INSTALL) $1 $(if $3,-m $3,) '$2' endef install_lib: $(LIBFILE) @@ -100,13 +100,16 @@ install_lib: $(LIBFILE) $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libsubcmd_headers) \ - $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \ - $(call do_install,help.h,$(prefix)/include/subcmd,644); \ - $(call do_install,pager.h,$(prefix)/include/subcmd,644); \ - $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \ - $(call do_install,run-command.h,$(prefix)/include/subcmd,644); +HDRS := exec-cmd.h help.h pager.h parse-options.h run-command.h +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/subcmd +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +install_headers: $(INSTALL_HDRS) + $(call QUIET_INSTALL, libsubcmd_headers) install: install_lib install_headers