From patchwork Fri Nov 12 21:48:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B17E7C433EF for ; Fri, 12 Nov 2021 21:49:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A87D61073 for ; Fri, 12 Nov 2021 21:49:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235812AbhKLVwA (ORCPT ); Fri, 12 Nov 2021 16:52:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235767AbhKLVv7 (ORCPT ); Fri, 12 Nov 2021 16:51:59 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49D61C061766 for ; Fri, 12 Nov 2021 13:49:08 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id u1so17837841wru.13 for ; Fri, 12 Nov 2021 13:49:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xbHVa/MhvYy1JHal39Ydph1ktO0y2K5JNGESoKix88o=; b=FSYc/8WJOSdTWrRash3OM1aCtA73oczk8cu2yhUixfGaHMkunvft8KNmum1TABz7EX lyKOY+Jnc4ylRh2rJVJ6v2ziEPq3ZuGxNXaauOXUtmxWt+slZhbHvlKXKxRx213gkz5N T6vn23jKEdrE4YZtiu74CUfJsc7Pm7QXrIuTISSdygEpAZ9SA+d8rYzMAQlTknUh3nMS 26Qf5LYBUmlh/OeO569/lmVsBkZSjpwYMQKETH9XPJpba4qXFPDjU93ganNj+05pUtkB /3Y7bbDhA46SO3pOz4PycsK9fZPNCgoV/cECkIRHJYsfPCw2sKfpVWFTvrdFs1gyBEHQ 5iAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xbHVa/MhvYy1JHal39Ydph1ktO0y2K5JNGESoKix88o=; b=aGyBuMk97z5vfy6oZjAbSUii05mFZ4Z7ADJVTXdM66kJsCk2LUOOmigIBuB5Oq8NCH F8Qu3x8OjaZYAM6v9sukf8468mP1m6wUl3hhFC5zQyH2Q2xXUV4b69+DeiOMci6QlWAb d69kXgDVvULD547Ef35uxP6mzSXFhHmkGSW761qWL4LN0eMqy0VByLbZJhscn/mLyqFa SvyG1s7nReGWjwZ2mVdQ7XbEoRHXdRVBEeY7mrMG81Ql1marHxyLk+PIW50WMURZoncY AEcsyA9kQWEiMxnDY48MMGZyKGebRUKr71Iktlk3cJAOM10VbB0dIHUJZ55S1PoLTSCo sPPA== X-Gm-Message-State: AOAM530/FJW9McMdfUpknFs+5jk3df21DjHciAI70Jsqd7Pa5ESz+5Tc g89M1McWFGS+h7KpoiRoqz/ixb8n/5spSQ== X-Google-Smtp-Source: ABdhPJx6/o76WlGHmO0YIfrbWPTHf8pZeECx+X6WjbWhD9693ltA4Lvi5yTaPeec2V3uZsHAzN61aA== X-Received: by 2002:a05:6000:1010:: with SMTP id a16mr22122358wrx.155.1636753746552; Fri, 12 Nov 2021 13:49:06 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:05 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 01/18] Makefile: don't invoke msgfmt with --statistics Date: Fri, 12 Nov 2021 22:48:45 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the --statistics flag that I added in 5e9637c6297 (i18n: add infrastructure for translating Git with gettext, 2011-11-18). Our Makefile output is good about reducing verbosity by default, except in this case: $ rm -rf po/build/locale/e*; time make -j $(nproc) all SUBDIR templates MKDIR -p po/build/locale/el/LC_MESSAGES MSGFMT po/build/locale/el/LC_MESSAGES/git.mo MKDIR -p po/build/locale/es/LC_MESSAGES MSGFMT po/build/locale/es/LC_MESSAGES/git.mo 1038 translated messages, 3325 untranslated messages. 5230 translated messages. I didn't have any good reason for using --statistics at the time other than ad-hoc eyeballing of the output. We don't need to spew out exactly how many messages we've got translated every time. Now we'll instead emit: $ rm -rf po/build/locale/e*; time make -j $(nproc) all SUBDIR templates MKDIR -p po/build/locale/el/LC_MESSAGES MSGFMT po/build/locale/el/LC_MESSAGES/git.mo MKDIR -p po/build/locale/es/LC_MESSAGES MSGFMT po/build/locale/es/LC_MESSAGES/git.mo Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d56c0e4aadc..11da97de233 100644 --- a/Makefile +++ b/Makefile @@ -1870,7 +1870,7 @@ ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT endif ifndef NO_MSGFMT_EXTENDED_OPTIONS - MSGFMT += --check --statistics + MSGFMT += --check endif ifdef HAVE_CLOCK_GETTIME From patchwork Fri Nov 12 21:48:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BBF8C433EF for ; Fri, 12 Nov 2021 21:49:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5497060F0F for ; Fri, 12 Nov 2021 21:49:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235933AbhKLVwL (ORCPT ); Fri, 12 Nov 2021 16:52:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235816AbhKLVwB (ORCPT ); Fri, 12 Nov 2021 16:52:01 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 810AEC061766 for ; Fri, 12 Nov 2021 13:49:09 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id d5so17906677wrc.1 for ; Fri, 12 Nov 2021 13:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0qBn5kDhD0ODSgKUUX9sh0GSDKRDREY35Cc3hjTgsck=; b=Id0FGB6oXjXecegEEEbj87yjfx1GQ53N58nF0SH0tGQ/Wip2OdVVNrX5YJczIOpWIw otFzcbEvtw6VtVbPrZFsVJi0CPUf+mGCBMPDtj9fcZhVlNov6CW3e1bQhGKHdCZi3AQ+ UZFLYcEa14t4mCuFWYnG8P7cLJ5D4nJStlkrMtO1Jf2HAFQ0MDUzT8rsjcTlfA4Q7cj7 rGNWLDY/skHAIbz9euTgP6Xf8tI22XLyFf0oby1SwGD1uxxF/Xu6Hx/XdkHZ4w6+d0Gg ++tuuAGhR6DkWMOe3ta2PXIHp2l5ttgsOiNf2vdapHyxeftg5dvtGQ4jP3aOqayOQ9id hLzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0qBn5kDhD0ODSgKUUX9sh0GSDKRDREY35Cc3hjTgsck=; b=I5DXhz+kmb7D3kxlfa/6seCA3EiLVUCa7V2SkIX92DJv2d1MS/xItaZsLfmeT6MXrh Q2i749Ne08VDgsw8T1WDVMbIQhzg/1N1lKeFo048MCv5qu44d3RBHnxOdG42teWfW6bJ 7mWSBnhaWtLHHogSTfAcyu+t1C9ej88HusFh5MyzK4jMuzOx0HZR1bcRpPm6FnIxIY9Q 9EfJROpwBRKOQ0gkOHUldVx/CUqv+GP7LiW4uD6rIx7K87K++cjV42zUaI3tkFh1jNgU xwWSYsUYoEf1wJQQCbkx2AszssBjSBt02gYg9VqHcu+dQOEEBTRmDq/AqkeZvfoCZWwc 3apQ== X-Gm-Message-State: AOAM533iXqe8EfvADuzAZI11Z6VXNZ8wGSXonZxyAYxFnq3aTx4zQXPU oKSwCvP/X4G180T7JYYQMnT0pYEOeWgb4w== X-Google-Smtp-Source: ABdhPJw2msgtXSyZIME4SO3mjysAF8G6wD7DZZ3ol+3Py2QBeTttGTQaa9iRCzwcs/Clj+PPwXQ4Fg== X-Received: by 2002:adf:f209:: with SMTP id p9mr22048626wro.191.1636753747862; Fri, 12 Nov 2021 13:49:07 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:07 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 02/18] Makefile: don't set up "perl/build" rules under NO_PERL=Y Date: Fri, 12 Nov 2021 22:48:46 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Do not define LIB_{PERL,CPAN}{,_GEN} if NO_PERL is defined. This changes no functionality, but makes it clear which of these rules are needed under NO_PERL=Y. See 20d2a30f8ff (Makefile: replace perl/Makefile.PL with simple make rules, 2017-12-10) for the initial implementation. We do for better or worse rely on "install-doc" calling "install-man-perl" regardless of whether NO_PERL=Y is defined or not, i.e. we'll always end up with that manual page, even if we don't have any of the Perl code installed. Let's add a comment about that adjacent to the rules that build perl/build. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 11da97de233..06405825a24 100644 --- a/Makefile +++ b/Makefile @@ -2684,19 +2684,12 @@ endif po/build/locale/%/LC_MESSAGES/git.mo: po/%.po $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $< +ifndef NO_PERL LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm) LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL)) LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm) LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN)) -ifndef NO_PERL -all:: $(LIB_PERL_GEN) -ifndef NO_PERL_CPAN_FALLBACKS -all:: $(LIB_CPAN_GEN) -endif -NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS)) -endif - perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES $(QUIET_GEN)mkdir -p $(dir $@) && \ sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \ @@ -2704,6 +2697,14 @@ perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ < $< > $@ +all:: $(LIB_PERL_GEN) +ifndef NO_PERL_CPAN_FALLBACKS +all:: $(LIB_CPAN_GEN) +endif +NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS)) +endif + +# install-man depends on Git.3pm even with NO_PERL=Y perl/build/man/man3/Git.3pm: perl/Git.pm $(QUIET_GEN)mkdir -p $(dir $@) && \ pod2man $< $@ From patchwork Fri Nov 12 21:48:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90223C433F5 for ; Fri, 12 Nov 2021 21:49:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74E3E60F70 for ; Fri, 12 Nov 2021 21:49:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235864AbhKLVwM (ORCPT ); Fri, 12 Nov 2021 16:52:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235767AbhKLVwC (ORCPT ); Fri, 12 Nov 2021 16:52:02 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3174CC061767 for ; Fri, 12 Nov 2021 13:49:11 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id az33-20020a05600c602100b00333472fef04so10221237wmb.5 for ; Fri, 12 Nov 2021 13:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wpfKh7sOV/xR4EqC3wG2RvtI/n/tff68yXnkhYtpdtc=; b=CBTvIZEV5PrRgcpEG3p4Cfs9mvxhgSCQRPZi0AuWaN1NcfobxwAR/T913103hwRZbA urPa8MS+12Rwc9TkhJ6nd9V5Oy+IvWGPoWGXw+3yVtKYuArrffBRx3ulUA2gsQxxZZ+2 48bZa3JPJuoI/Cwu536z/lrWcWkoi0DalHaMJhmTw0NaMixZM8cXOnA5rY/sOSjRCxOE BA8q7VgbIQN09O7+U6gPRbBv9QRrJ7TvYvlNV25BrnkDNOrbg6UuW+3/EJpTg9evqfBq 4X2u3uuE3z8zHOoHZVfZ6Pp+A/BkUDjxX2zDAW8+X8gzR16qsC3bXFpK5IWK3tAUsYZr Jk/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wpfKh7sOV/xR4EqC3wG2RvtI/n/tff68yXnkhYtpdtc=; b=rHhxMosbsvBZPnvkOsgFyMSwvMPHG9XhttxAyMhPBQEgbutZiJJPJ9a/LP3N5LJHKE PvHLza2p7sjKuqXcde/HE12OCjQqAclYZIQ0ldXv1WDFU5OWScG6mfWLfIFwhQxSOhtU KFWDrenpAiVabTszXgYCv5Vdw5TU/Av6s2+FaeJi28XcDFa9mfmRpXeE9OZLCwQZdWR2 TbakvSRL7eqHfrewwCy9bx1Jc5DFNMFfuQu23miAJXoqVnVOn4BANIedQBOBNqa55WkY lgelqaSfCM7SsQNOQNRDx1yLiEoTV0qtZQSxCvuHlJ1/3FNQQRGHBdUTnZTEAr1GQtDu PL7A== X-Gm-Message-State: AOAM5331h5eE9pf0YxhxS4qnIRbFrDbM21xMtYVLt+XlXRqqpcMnHfoK 7tgUU/zCmFcjMh3PgLb3QvWFgMD53AzJ1g== X-Google-Smtp-Source: ABdhPJyaTbIOkw4iHovAvJHbf+CiONAfCA8yzYUIGzECYzFGVGBBaVhOYt+wgbEz3pIn3fUyCb/JXQ== X-Received: by 2002:a7b:c005:: with SMTP id c5mr38911294wmb.155.1636753748846; Fri, 12 Nov 2021 13:49:08 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:08 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 03/18] Makefile: use "=" not ":=" for po/* and perl/* Date: Fri, 12 Nov 2021 22:48:47 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change these variable definitions from being simply-expanded to be recursively expanded instead. I.e. they'll be lazily expanded when used. I added these in 5e9637c6297 (i18n: add infrastructure for translating Git with gettext, 2011-11-18) and 20d2a30f8ff (Makefile: replace perl/Makefile.PL with simple make rules, 2017-12-10), the reason for using ":=" over "=" was that I didn't know the difference in 2011 (I think I copied some POC code), and in 2017 I used the 2011 commit for reference. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 06405825a24..6b77702e102 100644 --- a/Makefile +++ b/Makefile @@ -2672,11 +2672,11 @@ po/git.pot: $(GENERATED_H) FORCE pot: po/git.pot ifdef NO_GETTEXT -POFILES := -MOFILES := +POFILES = +MOFILES = else -POFILES := $(wildcard po/*.po) -MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES)) +POFILES = $(wildcard po/*.po) +MOFILES = $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES)) all:: $(MOFILES) endif @@ -2685,10 +2685,10 @@ po/build/locale/%/LC_MESSAGES/git.mo: po/%.po $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $< ifndef NO_PERL -LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm) -LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL)) -LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm) -LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN)) +LIB_PERL = $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm) +LIB_PERL_GEN = $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL)) +LIB_CPAN = $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm) +LIB_CPAN_GEN = $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN)) perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES $(QUIET_GEN)mkdir -p $(dir $@) && \ From patchwork Fri Nov 12 21:48:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D961FC433EF for ; Fri, 12 Nov 2021 21:49:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7DF260F36 for ; Fri, 12 Nov 2021 21:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235943AbhKLVwN (ORCPT ); Fri, 12 Nov 2021 16:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235838AbhKLVwD (ORCPT ); Fri, 12 Nov 2021 16:52:03 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8EFBC0613F5 for ; Fri, 12 Nov 2021 13:49:11 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id b12so17921671wrh.4 for ; Fri, 12 Nov 2021 13:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L1Z4EP7S+E5heMuoL696RAtbxmLDk7Ny+JKU1d3yQTw=; b=Y7fMD3zpvbLN4XRg1zmG3WR/MrZLgRPjGbhESCrfCi9D5ElTLUIM5CZF9ZCeqtNWFk IpDys9YUBcGPh1/d0QNj6egJED7oy677dnZrNDqzFt0vd2f97h27m8On1wLlztEo39hC 0Hr5kNkCxW1zRmcEnMn/pRQz1L0utQF9q4++u6/mwbWQk3BTVhg0FjmyD7T+3PqAvnPq phcrWtj1Rwutui6oArLJtWhzTDzfGiMgBi/gwdtsxVXWpAarQzlz/VnCc3okRwgJctX0 rlshYYadWDO/aq+3AGbiXXrwbWeQueDROa0wk+A871hHokv8Xl5XEMJAU4CmEHsCuj3U FWjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L1Z4EP7S+E5heMuoL696RAtbxmLDk7Ny+JKU1d3yQTw=; b=fh8sm+pDJ8jDCzapxNjRgEAgtMt7ZYpUKB23kE6J7wHB/b+ieWuUD3ISFO7fvRQV5J 0TnrTgX9Bno2CeVAjCIi23x5gkuqXR3p8kN2nPSFF1+829uecB0UjyBt8uewa3WDc5Io kuI7MVO/vtvZtH8YY2HVRHroqpzxUzjGo4CLOJ57CBsTJ8ZVxH22gTlgKnhOb3U7XkZT IgWJ5Sj5vG8i3Fjrux7Y+gg/DIRqqr/gTcFvkZxkV/Gx1kYGahKQYF6G77ZhcjYte84u dMtVmYy9vKuccFQgerqOgZWDjklLSp1Q1YXcPDVuNbothWq1Cpm0ntaBfJOPY45yd0eu pdaw== X-Gm-Message-State: AOAM532X7Twg6qHINF/HChw7yFVhfPTurCaLNp+bucZCThhDmwl5cXSi J7rxMKy1e5Yz+Otk3T8dotbF9QyRKJMbhA== X-Google-Smtp-Source: ABdhPJyyXqc/vTCYcHG1roEVdGL7nyfZ5pymMBmpMrYjzI7Ck+UX+5EP3otFeomk+mJwVJAdjbu9Ww== X-Received: by 2002:a05:6000:184e:: with SMTP id c14mr22281308wri.241.1636753750058; Fri, 12 Nov 2021 13:49:10 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:09 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 04/18] Makefile: clean perl/build/ even with NO_PERL=Y Date: Fri, 12 Nov 2021 22:48:48 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix a regression in 499c29394ce (Makefile: allow building without perl, 2009-04-03) where we'd stop cleaning the perl/* directory because NO_PERL was defined, thus leaving behind litter if the flag at "clean" time didn't match that of build time. In 499c29394ce this was done to avoid relying on the perl/Makefile.PL, but since my 20d2a30f8ff (Makefile: replace perl/Makefile.PL with simple make rules, 2017-12-10) we can clean things in that directory unconditionally. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6b77702e102..a71fba15e30 100644 --- a/Makefile +++ b/Makefile @@ -3234,6 +3234,7 @@ clean: profile-clean coverage-clean cocciclean $(RM) $(HCC) $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json $(RM) -r po/build/ + $(RM) -r perl/build/ $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* $(RM) -r .dist-tmp-dir .doc-tmp-dir $(RM) $(GIT_TARNAME).tar.gz @@ -3242,7 +3243,6 @@ clean: profile-clean coverage-clean cocciclean $(RM) Documentation/GIT-EXCLUDED-PROGRAMS ifndef NO_PERL $(MAKE) -C gitweb clean - $(RM) -r perl/build/ endif $(MAKE) -C templates/ clean $(MAKE) -C t/ clean From patchwork Fri Nov 12 21:48:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF098C433FE for ; Fri, 12 Nov 2021 21:49:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B87DE60F36 for ; Fri, 12 Nov 2021 21:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235940AbhKLVwP (ORCPT ); Fri, 12 Nov 2021 16:52:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235926AbhKLVwI (ORCPT ); Fri, 12 Nov 2021 16:52:08 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C85C061208 for ; Fri, 12 Nov 2021 13:49:12 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id v127so8871033wme.5 for ; Fri, 12 Nov 2021 13:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vvNJLKWcPa+hQizDp/euny7oemWnhAu2fSERRc9yCXw=; b=j9pw5giGhvG/Mt18p7hqxm9WLSl4Q+k7y83078hLyEKpEHU87wGs4lpojHqeuiO4Xh Qnnvf8+HcFp7Ble+G485f6q5taXf2D0yaDput1O4Gy9S+mnwjhW40LMwLJA0HkxndKIM OcdPKb3zJsrK5I75qIJo0uMNyWuujNRPXg2Mkyrz+o3MPs6K7mi9xuX+3cMsEqv1LAj+ V2pkGQcrOfkKIFawW2vRE9manW4u/IG2dRkvlknzWuplDjw0VY+z+X4iON1VzWIfPl0p n4LW9XLMEDvZxTUpOlXXurLqlhcLir4f7kju2A5wAzRMALwNk/sY+jRNLgo2vzrYha3m daZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vvNJLKWcPa+hQizDp/euny7oemWnhAu2fSERRc9yCXw=; b=y8jHLoL/s5Nzf7/6x5qrSP90EfKg14OD0Y3OzRcQkA60TZka5cAgnRyBc6ENiGs+pR I/B/NhVN3zoY2D96/53SVra4ShU0UR5yXkPkBCjR6XmWO5ahFaLGAyfNXpD8Da8aJcwl sag8SwzlLpKroeyyzza038EW8UC3vdKe2oU/BDNITVAKJ4yvVtfKVWm4T5LWZejo8vSY LVL4Dzn6vYvfx8LwCh79cvDrwgyQ4NokArdRUQeBa3RAnG1va2SnZah5kP59pLz218Fo qLFAMMVVTahVA5WyL4ZZPlzY+iLkbZWdbiswG6KAHaH6D3iP/DQTlDGRwByp5KgKo2y1 C69g== X-Gm-Message-State: AOAM532722NXPy4UqsjL/l2zeVtNPRmjUmUvY7dyCGUJGU3507pdZlQ7 xlJDqPznb9kqxdKAbVmDwk8ZRfOugpMYHQ== X-Google-Smtp-Source: ABdhPJw19+LYwHSJfv4HPfsApcn1+GnkaCZdryu/uK2vQKdMmdAb2UgPUJ59F79omtIgALFZ0usY/w== X-Received: by 2002:a1c:5409:: with SMTP id i9mr19989303wmb.146.1636753751116; Fri, 12 Nov 2021 13:49:11 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:10 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 05/18] Makefile: remove "mv $@ $@+" dance redundant to .DELETE_ON_ERROR Date: Fri, 12 Nov 2021 22:48:49 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since 7b76d6bf221 (Makefile: add and use the ".DELETE_ON_ERROR" flag, 2021-06-29) we don't need to guard the clobbering of $@ with this sort of "mv $@+ $@" pattern in these cases where we're merely generating a file that'll be used as a dependency for other files, as in this case for GIT-PERL-HEADER. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a71fba15e30..284725099c9 100644 --- a/Makefile +++ b/Makefile @@ -2349,8 +2349,7 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \ -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \ -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \ - $< >$@+ && \ - mv $@+ $@ + $< >$@ .PHONY: perllibdir perllibdir: From patchwork Fri Nov 12 21:48:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 838DAC433EF for ; Fri, 12 Nov 2021 21:49:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6871E60F36 for ; Fri, 12 Nov 2021 21:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235976AbhKLVwT (ORCPT ); Fri, 12 Nov 2021 16:52:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235935AbhKLVwL (ORCPT ); Fri, 12 Nov 2021 16:52:11 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 123FCC06120D for ; Fri, 12 Nov 2021 13:49:13 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id d5so17906895wrc.1 for ; Fri, 12 Nov 2021 13:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ic1VWFPLpda2LrI8ZHZeMZWsT63Tn1zRHoqa9c+HTFw=; b=WemldUZjdRkIzNTguxmmn29iKi9HgYWn6889ZlybXJuh1zwrBT9ohIzUL9xC7uCtCT fpViOrG21iI1Z/uFRgq4WFXts0Y9+4yb/Dcf/TFgd+/Efi/EIcGzsr7XJ2PWKAHyJujL O4cuuFH+ok4IlmNDqqaspai9WNlAKsLn07W3Zp8WXpud2qXQSVP5wk1VHxWtX7DbuuhR vEECtaHmK0JCbjOlMgVDywvNExwjdxs+avaNgv1geRHF5PDFg6j5qBKgrDq71QS1iJR3 CMTsl44IXCyVz9bkaMllSQkGL6rcjyJ8kcxaeWx5iQ+x8pRVwaSM/u05YLqAdOzA0pXY NCEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ic1VWFPLpda2LrI8ZHZeMZWsT63Tn1zRHoqa9c+HTFw=; b=w1fFKZLJprDxE6JjmzBvO59M2HyKqhv5PPiBH9LzX+Q5v7EYdWIfW07uN2YOLBB072 8zVzRXMP/TVE6Q477/YyioDfFATtae/Tro41nr7XcrWypvx0xvHQfzu0fonGxbi+7wEz w8hcEB7omDz8CXhoS+XxC2mAnWgfE91wZp6cUdbkJSKhTZuoxZaYn7AF3Dnbla+VF8Hw Qq7TRZFa7y08B9sZouhWDZERty8xHP9gv25XzofolgFD/Bpl1rSLLuvo88qyRv3K6dWp xQAE5CSOHvb/qSNeKHVqHB0BEO38xgmWB/Gxqjsws86NtPI2lZEakYbBWgxywWZS4E0v TLdQ== X-Gm-Message-State: AOAM532v/tOrNopHB+Pm+fNyUmZnLD+Pw8NFioUs44qLE2kWxsF0RaKy NfUmflqC7GdHrCYIGV1WoOo5dTwos4cBQA== X-Google-Smtp-Source: ABdhPJz0dUAhehsECveXWN9vtDsBHfacDDDGgRuGpW1RaHP5mbRX3P7KdgnqgaZ1xWVFPt06jV5BPA== X-Received: by 2002:adf:8293:: with SMTP id 19mr23178663wrc.167.1636753752060; Fri, 12 Nov 2021 13:49:12 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:11 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 06/18] Makefile: guard Perl-only variable assignments Date: Fri, 12 Nov 2021 22:48:50 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Move the "ifndef NO_PERL" a few lines earlier to encompass the "perl_localedir_SQ" variable. We'll only use it under !NO_PERL. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 284725099c9..0cb10f00ebb 100644 --- a/Makefile +++ b/Makefile @@ -2291,11 +2291,11 @@ git.res: git.rc GIT-VERSION-FILE GIT-PREFIX # This makes sure we depend on the NO_PERL setting itself. $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS +ifndef NO_PERL # Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX # since the locale directory is injected. perl_localedir_SQ = $(localedir_SQ) -ifndef NO_PERL PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl PERL_DEFINES = PERL_DEFINES += $(PERL_PATH_SQ) From patchwork Fri Nov 12 21:48:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFD90C433EF for ; Fri, 12 Nov 2021 21:49:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABDFE60F70 for ; Fri, 12 Nov 2021 21:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235946AbhKLVwQ (ORCPT ); Fri, 12 Nov 2021 16:52:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235859AbhKLVwM (ORCPT ); Fri, 12 Nov 2021 16:52:12 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C78C061210 for ; Fri, 12 Nov 2021 13:49:14 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id i5so17929126wrb.2 for ; Fri, 12 Nov 2021 13:49:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IYybH9DBZhcZ62MZaPH+VEpmGWYx30Z1Uk/F0PjaC+I=; b=ArP9CM8ko948j57t/tfXL4feWFlL41VUX6HXuIu1xgbgeOaffmpUJkocmpyuj1LMJ+ 7XGtrNb1QjHlDxl/LdZ7ktYZ+c5579NZwoKebaUQMMnvTZkD7QW57oOFZAJus8Q+W3Bk cVGu1767yaNv7DoCLD33DNb4gsXxu4JbFwBzkljrT4ej6RtpOVXtK4aTEDOYlx6P+KNQ NyGn0gqf5JOE1gss1Wt3XnyDzZDY6Ff+HUemiJt/m9TY0BUd3hFbMs0FooKrA0yNh5E3 dK37hdX9V7MHeHaM7h7hWYO7oRhqY80PrVyAJRWGUNkzPVprmDVaKbPSq4CN1XPo0OcZ /wgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IYybH9DBZhcZ62MZaPH+VEpmGWYx30Z1Uk/F0PjaC+I=; b=WRcJuAlG46t5tKxQWSsMdRF0UE791Ed9yF+gxDYjs9WcHyf114vVk5/bY/HMOaoX7H gUz4tWw/duFTdcKwUJrNCCiLBlckXYfQAgfC0Ds1GcJuhxm9JsoFJXzOrmV/Cbep3lwG gZrD6uhxaARJuyxBbFvkStkAqpXqfPN9qG9KvXYLOir8cZVEcsDYgkc/Mt7qtDI8waZp MD2g88B90VWgqcflFryKzditkcOcauOM5uj2mtiAq3Y/UIwz8hwLWnWk0NcaMlSnTwxg 3Xe2V9Z8BZLGBYTY++zxEoTk/ySPud1j0qu/nlsv3Ti9Wrb/WGA6UqHovuzGW/LAPi65 pJPQ== X-Gm-Message-State: AOAM531uH+slvR84CBXfRWUR2P9vZE3oZzZEc6sjgR1zoU5HvKbaSmul 1oXY6YY4NHvCDLO+wrLFDZVAVdjGNtAeCQ== X-Google-Smtp-Source: ABdhPJy9QoDsniT85XlCUKAyr2aLf+glJwJRVx3Gffuf63v2MGiHNc3H/NxJF8pF4gAulv4aO7Txlw== X-Received: by 2002:a5d:64ed:: with SMTP id g13mr22493205wri.222.1636753753063; Fri, 12 Nov 2021 13:49:13 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:12 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 07/18] Makefile: change "ifndef NO_PERL" to "ifdef NO_PERL" Date: Fri, 12 Nov 2021 22:48:51 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the NO_PERL variable assignments so that they declare the much smaller fallback condition first. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 0cb10f00ebb..288f4834db8 100644 --- a/Makefile +++ b/Makefile @@ -2291,7 +2291,15 @@ git.res: git.rc GIT-VERSION-FILE GIT-PREFIX # This makes sure we depend on the NO_PERL setting itself. $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS -ifndef NO_PERL +ifdef NO_PERL +$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh + $(QUIET_GEN) \ + sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ + -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \ + unimplemented.sh >$@+ && \ + chmod +x $@+ && \ + mv $@+ $@ +else # NO_PERL # Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX # since the locale directory is injected. perl_localedir_SQ = $(localedir_SQ) @@ -2363,14 +2371,6 @@ git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES $(QUIET_GEN)$(cmd_munge_script) && \ chmod +x $@+ && \ mv $@+ $@ -else # NO_PERL -$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh - $(QUIET_GEN) \ - sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \ - unimplemented.sh >$@+ && \ - chmod +x $@+ && \ - mv $@+ $@ endif # NO_PERL # This makes sure we depend on the NO_PYTHON setting itself. From patchwork Fri Nov 12 21:48:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8E79C4332F for ; Fri, 12 Nov 2021 21:49:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A25B960F70 for ; Fri, 12 Nov 2021 21:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235958AbhKLVwV (ORCPT ); Fri, 12 Nov 2021 16:52:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235938AbhKLVwM (ORCPT ); Fri, 12 Nov 2021 16:52:12 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8CE1C06121D for ; Fri, 12 Nov 2021 13:49:15 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id c4so17847408wrd.9 for ; Fri, 12 Nov 2021 13:49:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fHlOEGzV6voy+J/uffjktW6Cuw60nw+9x1xLPztGOK4=; b=B26PmDt6xfmzhZXJ3F/t4f39GshyPfZCWbhUiAhZDZnG3+L7zRPghRvqWYrfAbuu4I szGfrK8WwLUtM7tTb72daDVj5cV0l3g464gunFCegtp2g69V9UATDjUf7Drcqy/OxsUM ZmomjP2UYWBFd8uc6uZak1/guoO6IooNlOrX02PU5KgJSQxwBUIK17SL5sIxVBND++sD lmBEcaGBYIWg3BDCLJXQ2Qc6YYcGIceiEYasLZ7HB6FCh8EZhcIIkkBO1BFn2v4whhNw E+MF5ek1pyqGeqJCxho6fd6ZQf/ZKBS5nb+lB1e0+rFrFrLgQxSHRKhGmuYGDMJkWUuU +RIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fHlOEGzV6voy+J/uffjktW6Cuw60nw+9x1xLPztGOK4=; b=VYzQXT6zLb2AQfH0QrZgexJhWAYOLhX6YFu5s0quf1d8wO0WDvXDxNm2o88iSUcCIn 5H2HeVMhibKbr4qmJLuq4Xu78a+lfOCSZmDMWVulOX4zI7GR35gllEQx3w26NKGw7LCi rq2z9dLjL8zdg7vIV9V3vl83K7hMFwRaXEtS0+k772/Scw5GxSUXUu0VwItth6raBOBV m9BTa6/TFg7QsDZ56vFYQeu9ea2CBpJYhANmyxK/+PVncg8xKtFSPzanr6FPLpdw5DRx VHtaOFCNvsOjuqqHVxdNaQ5angQuFginFyKnLTm/ao/PQrNeQTxTwqnnrBP1pxoxZHBa fWIg== X-Gm-Message-State: AOAM533gJbZKHtxQHMW/gvD1abIviShjVvfc+XGrl5hRHBlcnvHdkHnX 7VHudNKeKiqpohHQzR8Ddn2DY4Cmw2dQiA== X-Google-Smtp-Source: ABdhPJxL2ALWh6zNt8zvSaWUejoZzidBY8wq2sGIUCtV4ynU89zsws9SO9ePAiTOnehrFR7c/tIsPQ== X-Received: by 2002:a5d:468f:: with SMTP id u15mr22226233wrq.171.1636753754022; Fri, 12 Nov 2021 13:49:14 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:13 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 08/18] Makefile: adjust Perl-related comments & whitespace Date: Fri, 12 Nov 2021 22:48:52 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Folllow-up my 4070c9e09fc (Makefile: don't re-define PERL_DEFINES, 2021-05-05) and move the rest of the assignments to PERL_DEFINES to one place. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 288f4834db8..ab78f8dd42e 100644 --- a/Makefile +++ b/Makefile @@ -2312,21 +2312,19 @@ PERL_DEFINES += $(perllibdir_SQ) PERL_DEFINES += $(RUNTIME_PREFIX) PERL_DEFINES += $(NO_PERL_CPAN_FALLBACKS) PERL_DEFINES += $(NO_GETTEXT) +PERL_DEFINES += $(gitexecdir) +PERL_DEFINES += $(perllibdir) +PERL_DEFINES += $(localedir) +PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES)) -# Support Perl runtime prefix. In this mode, a different header is installed -# into Perl scripts. ifdef RUNTIME_PREFIX - PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl -# Don't export a fixed $(localedir) path; it will be resolved by the Perl header -# at runtime. +# The RUNTIME_PREFIX header defines $Git::I18N::TEXTDOMAINDIR, so +# $(perl_localedir_SQ) won't be needed perl_localedir_SQ = - endif -PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir) - $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE $(QUIET_GEN) \ sed -e '1{' \ @@ -2339,7 +2337,6 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE chmod +x $@+ && \ mv $@+ $@ -PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES)) GIT-PERL-DEFINES: FORCE @FLAGS='$(PERL_DEFINES)'; \ if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \ From patchwork Fri Nov 12 21:48:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEBDFC433FE for ; Fri, 12 Nov 2021 21:49:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C287D60F0F for ; Fri, 12 Nov 2021 21:49:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235967AbhKLVwR (ORCPT ); Fri, 12 Nov 2021 16:52:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235939AbhKLVwN (ORCPT ); Fri, 12 Nov 2021 16:52:13 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0CC3C06120E for ; Fri, 12 Nov 2021 13:49:16 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 67-20020a1c1946000000b0030d4c90fa87so7788919wmz.2 for ; Fri, 12 Nov 2021 13:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=orF27Es/j/6T8VD4YNyQZPfV+Aj9dudAGaTu6h3c51Q=; b=p4Dw7TfcFljTvon4Z6vRhguu4EFPoU4dnATaJeX+zkVGb5r9CsQ8EEcJ8Q5iMNlLyb LsFNvM4aO/vCx/MBquK0NqYvj7kkyK9cHB9b8B7AzjXCLSMOQyde0oxZI2jZ7QRanYEb qaXcrwxEk4yimjvamVDCfpLuDYn7nnRdUjrThui90Kp/QVLQpb+ENLoFPoXFR3AhqnMv zFz0nF15Z3OXbkwN+UuM9wUyg+XuCwrdBcgoRYe5tiiMsu4H+G3F1I1/WghqI4AwW5FM JgnuiZC68UZ+7ebD4guDhD7Llma1SYbN4NldkRTfmHL+06Y02ysMKv0Xxa8qWuSx5qJS XTCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=orF27Es/j/6T8VD4YNyQZPfV+Aj9dudAGaTu6h3c51Q=; b=6Kh3OOhCAwgsxEqBSRasK5vMePJ3SFKtoqrgiIQr5lZ627EPa1Otkv6xdZ1TdXVr81 UnPokYjtyexX8PIkcLx+kcLvHgkil3O4WpnvaRlZ5x7nVq1wjvibOYHWnOaWTXgu48nz pALF5YFXbwEQ2Fh2IkwV1Xl7lNDW3QrqRTWaovccOczkWx+o+nZyLzRJJMoDaSIbNAVb x/Zkn5ZmQrDWoXwE1/FM0sVYWkEjiAvIbAcKomBqX1jqW4PMhI8eEdTgCYyMR+inIk6j NJGEJGy8cQLHNc7q5MlQjFQ7EBiAbztR22tbdm8Hmg30MT+RJV29cQxodH8f+JmstSdG OrgA== X-Gm-Message-State: AOAM530e9u0g64+CBCVN1Zy4E3oCOwojJM+t1ALX7nq0n9+iDYXaqebd SRIgGvHX0xKRSisyIixkfymis4KaxV5gYg== X-Google-Smtp-Source: ABdhPJw9ZzMd53kqMGiei+miSmb/PbHVIBgw2FYO5YHX/D4+6VEBuwolBldIcaq2MEDpDai9NsS6ng== X-Received: by 2002:a7b:c76e:: with SMTP id x14mr20769295wmk.27.1636753755072; Fri, 12 Nov 2021 13:49:15 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:14 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 09/18] Makefile: correct "GIT-PERL-{DEFINES,HEADER}" dependency graph Date: Fri, 12 Nov 2021 22:48:53 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix several small issues with the dependency graph of the generated "GIT-PERL-DEFINES" and "GIT-PERL-HEADER" files: 1. Don't have "GIT-PERL-HEADER" depend on the "Makefile". That was a lazy way to over-declare the dependencies added in f6a0ad4be71 (Makefile: generate Perl header from template file, 2018-04-10). Let's correct our dependency graph instead. 2. Don't have $(SCRIPT_PERL_GEN) (such as "git-send-email") depend on GIT-BUILD-OPTIONS. Let's instead use GIT-PERL-DEFINES. The reason for depending on "GIT-BUILD-OPTIONS" was to trigger a re-build if NO_PERL=Y was defined. We can instead add that variable to "PERL_DEFINES", and have "GIT-PERL-DEFINES" created and updated if "NO_PERL=Y" is defined. 3. Due to #2 we'll need to have GIT-PERL-DEFINES be generated even under NO_PERL, since that variable will be used by the "unimplemented.sh" script. 4. Don't depend on $(gitexecdir), $(perllibdir) and $(localedir), instead depend on the $(*_relative_SQ) versions of those. The latter is what we'll actually use, while it's unlikely to matter in practice (we'd just skip re-building these under RUNTIME_PREFIX if the relative path was the same) it makes the code easier to read. That's because this brings us to a 1=1 mapping of these variables and what's subsequently used in the "GIT-PERL-DEFINES", "GIT-PERL-HEADER" and "perl/build/lib/%.pm" rules below. 5. We don't need the substitution of " " for ":" added in 07d90eadb50 (Makefile: add Perl runtime prefix support, 2018-04-10), let's drop it. This doesn't matter for the correctness of these files, because unlike GIT-BUILD-OPTIONS nothing is consuming them except the Makefile itself. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index ab78f8dd42e..361abff2402 100644 --- a/Makefile +++ b/Makefile @@ -2288,10 +2288,14 @@ git.res: git.rc GIT-VERSION-FILE GIT-PREFIX $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \ -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@ -# This makes sure we depend on the NO_PERL setting itself. -$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS +# Under NO_PERL=Y we'll still make GIT-PERL-DEFINES. We need to depend +# on NO_PERL=Y itself for creating "unimplemented.sh" scripts. +PERL_DEFINES = +$(SCRIPT_PERL_GEN): GIT-PERL-DEFINES ifdef NO_PERL +PERL_DEFINES += $(NO_PERL) + $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ @@ -2300,22 +2304,26 @@ $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh chmod +x $@+ && \ mv $@+ $@ else # NO_PERL -# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX -# since the locale directory is injected. +# The localedir is only used in Perl modules if !NO_GETTEXT +ifndef NO_GETTEXT perl_localedir_SQ = $(localedir_SQ) +endif PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl -PERL_DEFINES = + PERL_DEFINES += $(PERL_PATH_SQ) PERL_DEFINES += $(PERLLIB_EXTRA_SQ) PERL_DEFINES += $(perllibdir_SQ) PERL_DEFINES += $(RUNTIME_PREFIX) PERL_DEFINES += $(NO_PERL_CPAN_FALLBACKS) PERL_DEFINES += $(NO_GETTEXT) -PERL_DEFINES += $(gitexecdir) -PERL_DEFINES += $(perllibdir) -PERL_DEFINES += $(localedir) -PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES)) +ifdef RUNTIME_PREFIX +PERL_DEFINES += $(gitexecdir_relative_SQ) +PERL_DEFINES += $(perllibdir_relative_SQ) +PERL_DEFINES += $(localedir_relative_SQ) +else +PERL_DEFINES += $(perllocaledir_SQ) +endif ifdef RUNTIME_PREFIX PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl @@ -2337,14 +2345,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE chmod +x $@+ && \ mv $@+ $@ -GIT-PERL-DEFINES: FORCE - @FLAGS='$(PERL_DEFINES)'; \ - if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \ - echo >&2 " * new perl-specific parameters"; \ - echo "$$FLAGS" >$@; \ - fi - -GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile +GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES $(QUIET_GEN) \ INSTLIBDIR='$(perllibdir_SQ)' && \ INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \ @@ -2370,6 +2371,13 @@ git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES mv $@+ $@ endif # NO_PERL +GIT-PERL-DEFINES: FORCE + @FLAGS='$(PERL_DEFINES)'; \ + if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \ + echo >&2 " * new perl-specific parameters"; \ + echo "$$FLAGS" >$@; \ + fi + # This makes sure we depend on the NO_PYTHON setting itself. $(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS From patchwork Fri Nov 12 21:48:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E5BEC433F5 for ; Fri, 12 Nov 2021 21:49:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 851CE60FBF for ; Fri, 12 Nov 2021 21:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235994AbhKLVwV (ORCPT ); Fri, 12 Nov 2021 16:52:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235923AbhKLVwN (ORCPT ); Fri, 12 Nov 2021 16:52:13 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC5A1C061766 for ; Fri, 12 Nov 2021 13:49:17 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id i8-20020a7bc948000000b0030db7b70b6bso10950204wml.1 for ; Fri, 12 Nov 2021 13:49:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2X0xu4jDEXxnsJ6J/Ye4YxTXRWiqQV1ptZzzE7hVqZE=; b=Qy/k0yiljZBbAbl4auTUITvwda/qDA3ljCPzcbtV8mu+brhG6ymu7ekAmCIzMlG0co 11nxIV7oPoV0/CYXfMfV3KYwhE9gKe+tjVAmfT6l6tNLFCPbbHjk/XNEoVNv20Fcntcg +uksSZ8oy4YZtL+KB+GPriIb5o1fijuP6o62U59bQQcPjJG2VQYNJtWfGPqVuZTQJadk oyeMpxTrylaGbABaCiQvRSNuIk7umgQnb18cfJoF3wawCVNny3irfMOxNwFqUt12pjWi evMDdFs8vC2SA3ksgsaYEEkxWwhBlaHkOH3r12zYbcHqpSysyLHbu0hKiUMvHnumCZvv o69w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2X0xu4jDEXxnsJ6J/Ye4YxTXRWiqQV1ptZzzE7hVqZE=; b=efVk17uYqxIEmd37DCyVlg9UO4UIhGmn2YNHVBE5jRoMhnfXtGJwnzLFE6R/XJ+upJ gJZRZykJ6AsxOW/Yu9qBsza9zpxm8i3D7fqbOEsvt3GeWHl/QpX8tnI4jYQoGkToijNB I6i3d1gsjvIg4Vfj8rYzhSAsj4RKCsUt6JIJWQkARdpXIgsmEhfcTNXiGjg4tttU/slM JRN8BZwf0f0mVFgm/VC95H8LPzY6eipwE/Cktgw/U2LhcwUkwp2RREGIq//D020YZkx4 3lQHjwdxkd75UA0Gp3irz8D7kX+933+kl4Z1sy5mezWtbhOndZA9FLrWBpYMnGSzIeqj 0lbQ== X-Gm-Message-State: AOAM530RQMDKEQZhiCqtHrkfOhCbM9vJ5ltCETviVC4fun9y+mLDhYaR R0WHVAa8RM6y7C09G+IANLbyREDlUKhE7Q== X-Google-Smtp-Source: ABdhPJxGpPieoki+9MND35O91aNa0Czowa9OUuNir+cCLy0qJ56F6jkRi736942V4p+dHUSHAl/VDQ== X-Received: by 2002:a05:600c:ac2:: with SMTP id c2mr37639473wmr.118.1636753755966; Fri, 12 Nov 2021 13:49:15 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:15 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 10/18] Makefile: create a GIT-PYTHON-DEFINES, like "PERL" Date: Fri, 12 Nov 2021 22:48:54 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Create a new "GIT-PYTHON-DEFINES" file, and untangle the dependency issues of the Python by copying over the patterns established for building the adjacent Perl code in preceding commits. As with Perl, there's no real reason to depend on GIT-BUILD-OPTIONS or GIT-CFLAGS when building the Python code, nor did we need GIT-PREFIX. Let's instead add those variables we care about to a "GIT-PYTHON-DEFINES" and depend on that. This changes code originally added in ca3bcabf118 (auto-detect changed prefix and/or changed build flags, 2006-06-15), and adjusted in 96a4647fca5 (Makefile: detect when PYTHON_PATH changes, 2012-12-18). The relevant code for the "Perl" targets was then added in 07981dce81e (Makefile: rebuild perl scripts when perl paths change, 2013-11-18), and has been adjusted in preceding commits. Signed-off-by: Ævar Arnfjörð Bjarmason --- .gitignore | 2 +- Makefile | 49 +++++++++++++++++++++++++------------------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 054249b20a8..845e5d0c355 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ /GIT-PREFIX /GIT-PERL-DEFINES /GIT-PERL-HEADER -/GIT-PYTHON-VARS +/GIT-PYTHON-DEFINES /GIT-SCRIPT-DEFINES /GIT-USER-AGENT /GIT-VERSION-FILE diff --git a/Makefile b/Makefile index 361abff2402..c698c5b058a 100644 --- a/Makefile +++ b/Makefile @@ -2378,18 +2378,15 @@ GIT-PERL-DEFINES: FORCE echo "$$FLAGS" >$@; \ fi -# This makes sure we depend on the NO_PYTHON setting itself. -$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS +# As with NO_PERL=Y we'll still make GIT-PYTHON-DEFINES if "NO_PYTHON" +# is defined, for creating the "unimplemented.sh" scripts. +PYTHON_DEFINES = +$(SCRIPT_PYTHON_GEN): GIT-PYTHON-DEFINES + +ifdef NO_PYTHON +PYTHON_DEFINES += $(SHELL_PATH_SQ) +PYTHON_DEFINES += $(NO_PYTHON) -ifndef NO_PYTHON -$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS -$(SCRIPT_PYTHON_GEN): % : %.py - $(QUIET_GEN) \ - sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \ - $< >$@+ && \ - chmod +x $@+ && \ - mv $@+ $@ -else # NO_PYTHON $(SCRIPT_PYTHON_GEN): % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ @@ -2397,8 +2394,24 @@ $(SCRIPT_PYTHON_GEN): % : unimplemented.sh unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ +else # NO_PYTHON +PYTHON_DEFINES += $(PYTHON_PATH_SQ) + +$(SCRIPT_PYTHON_GEN): % : %.py GIT-PYTHON-DEFINES + $(QUIET_GEN) \ + sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \ + $< >$@+ && \ + chmod +x $@+ && \ + mv $@+ $@ endif # NO_PYTHON +GIT-PYTHON-DEFINES: FORCE + @FLAGS='$(PYTHON_DEFINES)'; \ + if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \ + echo >&2 " * new python-specific parameters"; \ + echo "$$FLAGS" >$@; \ + fi + CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ configure.ac >configure.ac+ && \ autoconf -o configure configure.ac+ && \ @@ -2848,18 +2861,6 @@ else endif @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi -### Detect Python interpreter path changes -ifndef NO_PYTHON -TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)') - -GIT-PYTHON-VARS: FORCE - @VARS='$(TRACK_PYTHON)'; \ - if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \ - echo >&2 " * new Python interpreter location"; \ - echo "$$VARS" >$@; \ - fi -endif - test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X)) all:: $(TEST_PROGRAMS) $(test_bindir_programs) @@ -3256,7 +3257,7 @@ ifndef NO_TCLTK endif $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS $(RM) GIT-USER-AGENT GIT-PREFIX - $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS + $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-DEFINES ifdef MSVC $(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS)) $(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS)) From patchwork Fri Nov 12 21:48:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B78DC433EF for ; Fri, 12 Nov 2021 21:49:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 471DD60FBF for ; Fri, 12 Nov 2021 21:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235961AbhKLVw0 (ORCPT ); Fri, 12 Nov 2021 16:52:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235952AbhKLVwO (ORCPT ); Fri, 12 Nov 2021 16:52:14 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A350AC061228 for ; Fri, 12 Nov 2021 13:49:18 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id s13so17927153wrb.3 for ; Fri, 12 Nov 2021 13:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hmI0SEV8DeLiSGYzeXUFBvjBY/5DdNrk3RC1rvGPekA=; b=aM/aGLc8qpdY2GuJIFRIw5WlYtjRPGSGdNzm6QnDKvSJh1SC3LAIFWbJegHWxyKO99 iEosM7/XneFGUYaZQy+u2mZs8MveCfM1kcZQR8jM9YM/LSByDhelV7KFS+pFrF3WuGiY w8h/PGSUAndp/rvXFH48qwau7kw7/uBb1xjPKJjgzBauF81oltGha7c/Ten7NyjvtSWO /Hri3eLuSZ6v1VAUFz9ABCn7qaU+nbEyuK8C5DCH9sXEpeRrW85YAn2E1BxH1nCPO8Sq wASTSUeuo0QHh+6LRv8pmPZjUDKiJhn9gkB/GApXKcPCiZxsUBK0eq//tf5L62Kd+/f7 bAMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hmI0SEV8DeLiSGYzeXUFBvjBY/5DdNrk3RC1rvGPekA=; b=b4bvZtvGCu3WjxqZKt5jFa6SBkAlNXDmPjBNSAsvOoY6Ka3kv8yxSOHo8nTBpRx5ju KAyFlFne/ZHmD46mJh00dAno/ocJeT3sS0QX+/3b3H7cs4WiNntI2KJYMH+76RFv+4GO /y7jcBZFFa+10Rbcd8yR2fDQ0456Artk9yhVCMNNQED7mgV0E/JpqzUjTvRWV6iBboXC 3eFTuvB0BM+Dg2YpA6EQfL7n2sLg7TsABdQ1QGtpeSHUZ3XbFZhkq+NXm02BYPJOhjPI +By8KnqU/bJDG2A30O3qZTYWvx3WDfbk3W5SqGGloQzK+GxTs9vIWIjQQ+KAeIATJrzW rBFQ== X-Gm-Message-State: AOAM5303pROAF1hQ3KMwqYF3Y8zy2DdlufdkpELx3XrKFWThsKXx5jwE 2Eu7ChesFQaEt8mj4oFiInC3yePrSIM2xA== X-Google-Smtp-Source: ABdhPJxtLXV5aK1ndpGVIYnuIv23b6sngP8vs+UaoVtIBT92/ZQXFfobj0+tSaQwquOlEydkwv8WTA== X-Received: by 2002:a5d:508d:: with SMTP id a13mr22213303wrt.41.1636753756994; Fri, 12 Nov 2021 13:49:16 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:16 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 11/18] Makefile: stop needing @@GIT_VERSION@@ in *.perl scripts Date: Fri, 12 Nov 2021 22:48:55 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the hardcoding of @@GIT_VERSION@@ in generated *.perl scripts to instead shell out to "git version". This means that we can stop re-building during development every time the HEAD changes. These codepaths are not "hot", so shelling out to get the version shouldn't matter to users, in the one case where it potentially would in send-email (the loop for each E-Mail we send) we now cache the value, so we'll only retrieve it once. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 2 +- git-cvsserver.perl | 6 +++--- git-send-email.perl | 7 ++----- git-svn.perl | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c698c5b058a..8205614c6ec 100644 --- a/Makefile +++ b/Makefile @@ -2333,7 +2333,7 @@ PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl perl_localedir_SQ = endif -$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE +$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER $(QUIET_GEN) \ sed -e '1{' \ -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 64319bed43f..76f0e8bbbef 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -26,8 +26,6 @@ use File::Basename; use Getopt::Long qw(:config require_order no_ignore_case); -my $VERSION = '@@GIT_VERSION@@'; - my $log = GITCVS::log->new(); my $cfg; @@ -126,7 +124,9 @@ or die $usage; if ($state->{version}) { - print "git-cvsserver version $VERSION\n"; + my $version = qx[git version]; + $version =~ s/^(git)\b/$1-cvsserver/; + print $version; exit; } if ($state->{help}) { diff --git a/git-send-email.perl b/git-send-email.perl index 5262d88ee32..041cd2fb96d 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1468,6 +1468,7 @@ sub file_name_is_absolute { # # If an error occurs sending the email, this just dies. +my $gitversion; sub send_message { my @recipients = unique_email_list(@to); @cc = (grep { my $cc = extract_valid_address_or_die($_); @@ -1478,11 +1479,6 @@ sub send_message { @recipients = unique_email_list(@recipients,@cc,@initial_bcc); @recipients = (map { extract_valid_address_or_die($_) } @recipients); my $date = format_2822_time($time++); - my $gitversion = '@@GIT_VERSION@@'; - if ($gitversion =~ m/..GIT_VERSION../) { - $gitversion = Git::version(); - } - my $cc = join(",\n\t", unique_email_list(@cc)); my $ccline = ""; if ($cc ne '') { @@ -1497,6 +1493,7 @@ sub send_message { Message-Id: $message_id "; if ($use_xmailer) { + $gitversion ||= Git::version(); $header .= "X-Mailer: git-send-email $gitversion\n"; } if ($in_reply_to) { diff --git a/git-svn.perl b/git-svn.perl index be987e316f9..727431412be 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -9,7 +9,6 @@ $_revision $_repository $_q $_authors $_authors_prog %users/; $AUTHOR = 'Eric Wong '; -$VERSION = '@@GIT_VERSION@@'; use Carp qw/croak/; use File::Basename qw/dirname basename/; @@ -47,6 +46,7 @@ command_close_bidi_pipe get_record ); +$VERSION = Git::version(); BEGIN { Memoize::memoize 'Git::config'; From patchwork Fri Nov 12 21:48:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CB51C43217 for ; Fri, 12 Nov 2021 21:49:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55E6360F70 for ; Fri, 12 Nov 2021 21:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236006AbhKLVwX (ORCPT ); Fri, 12 Nov 2021 16:52:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235953AbhKLVwO (ORCPT ); Fri, 12 Nov 2021 16:52:14 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7575C06122B for ; Fri, 12 Nov 2021 13:49:19 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id d5so17907317wrc.1 for ; Fri, 12 Nov 2021 13:49:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xEJiBWFHSI9P56F7PPLXMo3n3X/3994AFRcJIHKkfDw=; b=h55w2isCT5yQjoCuGPn2cGniHahReinGrCbwX2zoLKlJ+H+1CcKReYVQ3iZ41BTvBy blCkEf7S6OdVeMhrLXDCJYankf8jaUOZuzRSbPh9tqN4UONBWSRX6bQQT42osQjM2NzJ 4r6HAlaJGfeMob7bKgGyLCYfX1gwMFuZO6Ozh5DxlkvxxNNQDeZMK03zPNGPBfGG0ON5 h6Rc9xTUZIQItcLKvxxI7yyU11FTI/PgO2wzM6X2bRq/2UN14KreuBrXbNsOHKla29Zw 5j9tuZB582T8eYQyQyNsgSXxPnR5k4401B7tUM+0s33DTbfHvHJ+til0rcaixAVn8UHH 5Hrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xEJiBWFHSI9P56F7PPLXMo3n3X/3994AFRcJIHKkfDw=; b=mbkmaj2JvPPBfnpOGw+SMwx1nInLZVS9DWTKkbw8PfVh43eyXur2aP3CfZKwabrVFV BRDteqq961P0tg8/pQhIhSLYZ1btnyYnVGFrHr+hq9fmBpDmBEiZPDhb6YCC7FSath/u rBzdRxyEtox9crAxeJ9NjjAou4/5dzGuM5QA9eJg/92oOAoddZjrMqwI4nBCE+SfQECH m6ng88wQEsGIl4vmK07Cyc3ZEnPD/f3pN5QyQSvCMSef5xIRi8417xNCPU0RFZeR3mX7 R1hIfeuD7WvWjHgG02zkhrY/dUg6FTQFXUOda1zd8p2udcLiL8BxpkMPDl8+yMyBFC3c TmTA== X-Gm-Message-State: AOAM530gPQ2Jho50U6hRv8QtWefqYeZEILwiowrYbYJIB3VV9xNEZBL0 poVYE96+a6QOa+UzQHaS5GJyDV+UYdBteQ== X-Google-Smtp-Source: ABdhPJxgxiZqqpMXc6cdHoNU1+pliLGJbJYPCmhtJqLWFvtXufMvFotOZ+Rcm3dsEs83FtnkWR5s1g== X-Received: by 2002:a5d:6da5:: with SMTP id u5mr22922426wrs.374.1636753757918; Fri, 12 Nov 2021 13:49:17 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:17 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 12/18] Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to it Date: Fri, 12 Nov 2021 22:48:56 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We have various behavior that's shared across our Makefiles, or that really should be (e.g. via defined templates). Let's create a top-level "shared.mak" to house those sorts of things, and start by adding the ".DELETE_ON_ERROR" flag to it. See my own 7b76d6bf221 (Makefile: add and use the ".DELETE_ON_ERROR" flag, 2021-06-29) and db10fc6c09f (doc: simplify Makefile using .DELETE_ON_ERROR, 2021-05-21) for the addition and use of the ".DELETE_ON_ERROR" flag. This does have the potential downside that if e.g. templates/Makefile would like to include this "shared.mak" in the future the semantics of such a Makefile will change, but as noted in the above commits (and GNU make's own documentation) any such change would be for the better, so it's safe to do this. This also doesn't introduce a bug by e.g. having this ".DELETE_ON_ERROR" flag only apply to this new shared.mak, Makefiles have no such scoping semantics. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/Makefile | 6 +++--- Makefile | 13 +++---------- shared.mak | 9 +++++++++ 3 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 shared.mak diff --git a/Documentation/Makefile b/Documentation/Makefile index ed656db2ae9..ba27456c86a 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -1,3 +1,6 @@ +# Import tree-wide shared Makefile behavior and libraries +include ../shared.mak + # Guard against environment variables MAN1_TXT = MAN5_TXT = @@ -524,7 +527,4 @@ doc-l10n install-l10n:: $(MAKE) -C po $@ endif -# Delete the target file on error -.DELETE_ON_ERROR: - .PHONY: FORCE diff --git a/Makefile b/Makefile index 8205614c6ec..5ae7d012cfb 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +# Import tree-wide shared Makefile behavior and libraries +include shared.mak + # The default target of this Makefile is... all:: @@ -2158,16 +2161,6 @@ shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell strip: $(PROGRAMS) git$X $(STRIP) $(STRIP_OPTS) $^ -### Flags affecting all rules - -# A GNU make extension since gmake 3.72 (released in late 1994) to -# remove the target of rules if commands in those rules fail. The -# default is to only do that if make itself receives a signal. Affects -# all targets, see: -# -# info make --index-search=.DELETE_ON_ERROR -.DELETE_ON_ERROR: - ### Target-specific flags and dependencies # The generic compilation pattern rule and automatically diff --git a/shared.mak b/shared.mak new file mode 100644 index 00000000000..0170bb397ae --- /dev/null +++ b/shared.mak @@ -0,0 +1,9 @@ +### Flags affecting all rules + +# A GNU make extension since gmake 3.72 (released in late 1994) to +# remove the target of rules if commands in those rules fail. The +# default is to only do that if make itself receives a signal. Affects +# all targets, see: +# +# info make --index-search=.DELETE_ON_ERROR +.DELETE_ON_ERROR: From patchwork Fri Nov 12 21:48:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82233C433EF for ; Fri, 12 Nov 2021 21:49:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D34E60F70 for ; Fri, 12 Nov 2021 21:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236012AbhKLVwY (ORCPT ); Fri, 12 Nov 2021 16:52:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235957AbhKLVwO (ORCPT ); Fri, 12 Nov 2021 16:52:14 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50D57C06122C for ; Fri, 12 Nov 2021 13:49:20 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id s13so17927204wrb.3 for ; Fri, 12 Nov 2021 13:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2U3JhPnF19jBTuRChU0Pqjnec5yia5NO0jdIRsdiBqg=; b=gMEYoiXXA4nqfPIxYtne2rwT+pu2tg+42WgG+d+MxcoVUJuvj1+lccGoPTOqXUrt26 b3meyPjz5nojvHW0dVPpirUtjz0UvZKh4r6QVFmHzYi0gGLFcf8hS7PnUybJeJJmsAdB YLF93Eg3/buqao1H+PXYFin0+u5KhK/isCn16mp94a/S173JOOhjRq+GFrVt2BvK1jwu ESEzRbc2ss6SsOw6ZWIKlNfq+k2/Lvh4gI3cnApLOjJDoRyaMDMyKBnXFkvrXMk8kDUq +zAkP3aWfqwU+x/zMXFikDkGNJo7FtBAYAoPgH5IuGCG9bK65XqEy+/lEy56TjIiHsEc K/nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2U3JhPnF19jBTuRChU0Pqjnec5yia5NO0jdIRsdiBqg=; b=HPnqC+FI3w9zXXT0zube6E/nWpP6ZtcHnsB0JgCQ4YjwnPhy5nv6v8wO3Td9NqfzK4 s42kIq8C9tXnXcmm8MV4YURF4PrgIR++pXuPsH6NLwjCakA5L1tKQpD5MoPHjMw+Xlcw HQGxtJJwbwe7OS+AFCXX5sjc/5v7xS7qS/4P88z0/XFWvpY75Z9Xt1ftM76HAtSjWsfh wlzOYgTNUW3ZIajdeF7n0RBt5DwI2+RLqKIfNB2EcZh4rS4sAMjDDgpcevuep2p9HpEu DaTF68L4Si5Y2ndirhXmzNawlzCur2dgYfSY2+lWoIIg5LlWdnP/Proh0X0LfPib8MJa y1kg== X-Gm-Message-State: AOAM5307x0+NLJYXAL2TQLReUjy7dbPfQFsmw2tO1Sjs8oyk1GkooVSC G2xQdM9+uPlVgc3Af59J0sVKx5xfVPLFqA== X-Google-Smtp-Source: ABdhPJxjTBTVBN08xt7dmZ/SVtLJg+KOdQ0Y182Jd9QBU43udY73cjayWkZ6ZTcC7WZKBXI6gtkk/Q== X-Received: by 2002:a5d:628f:: with SMTP id k15mr22991187wru.363.1636753758734; Fri, 12 Nov 2021 13:49:18 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:18 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 13/18] Makefile: move $(comma), $(empty) and $(space) to shared.mak Date: Fri, 12 Nov 2021 22:48:57 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Move these variables over to the shared.max, we'll make use of them in a subsequent commit. There was no reason for these to be "simply expanded variables", so let's use the normal lazy "=" assignment here. See 425ca6710b2 (Makefile: allow combining UBSan with other sanitizers, 2017-07-15) for the commit that introduced these. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 4 ---- shared.mak | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5ae7d012cfb..7130e32a251 100644 --- a/Makefile +++ b/Makefile @@ -1252,10 +1252,6 @@ endif ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS) -comma := , -empty := -space := $(empty) $(empty) - ifdef SANITIZE SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag)) BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE) diff --git a/shared.mak b/shared.mak index 0170bb397ae..2d597ef7603 100644 --- a/shared.mak +++ b/shared.mak @@ -7,3 +7,11 @@ # # info make --index-search=.DELETE_ON_ERROR .DELETE_ON_ERROR: + +### Global variables + +## comma, empty, space: handy variables as these tokens are either +## special or can be hard to spot among other Makefile syntax. +comma = , +empty = +space = $(empty) $(empty) From patchwork Fri Nov 12 21:48:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 728BEC43219 for ; Fri, 12 Nov 2021 21:49:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47F3C60F36 for ; Fri, 12 Nov 2021 21:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236013AbhKLVwZ (ORCPT ); Fri, 12 Nov 2021 16:52:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235956AbhKLVwO (ORCPT ); Fri, 12 Nov 2021 16:52:14 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 842D7C0613F5 for ; Fri, 12 Nov 2021 13:49:21 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id i12so8053783wmq.4 for ; Fri, 12 Nov 2021 13:49:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cZslkb8kdITQnO5ys7yGVykw0i6d+Kxe+ErUw/5Is6U=; b=i9MhYDiEgXEzJ5xfRCde+NCkwT1Dj9wNKu0nyLMMM9Qk+4hDsq2NPsCpZtOVubLQ2L dNBdQYvC8avOmwyU1BOWz9TMzwbbUobs33XOAMuNVnT8jpDawDZj5XFKOkJxNQ8rPluh gqbZ/pczntznznDcwKCq9yLKCXAptp+vk6OkJtN0LGw0HEIhlaL/1jcsj/RkOPQGPv2k bwrNj4/Lsj9xCFI6XbXijz/+ypVK9iPVr7JJfaDjziDv+u1gZqlglmdR0nm0EZy+vShy w7nymlmZC5j78mI40kiUQ6RQ05yZpJcSIET3Mt/vbM5wRMH8JqgvOpuT1qpGhR0KtAkE 4ruA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cZslkb8kdITQnO5ys7yGVykw0i6d+Kxe+ErUw/5Is6U=; b=tTjecfe7JOOU/kQdm0jyT6YjfiVZ/gA5Paqsu0vLfG9mFMRRf5FMD1pi9mhZZL88wz /y/2ETnyokpt/1erBjRoOfjMA5QJfiB46U2q/MsfhJ+hVqU4WudhhGnlKTd9NLewb2ml 9QmFyKwnhkB2CzIHvh6OqQMvImBJxcFRhPYth3iVkvxEoD8Xl+WwFTSiPqW4ZSRI0K7x q8aQXHQmpvgXucH4D6j3lHQlUymxD6DCsNzRr+YbrTq5+uxVkoeOPwTnq5ESYSXVlvv/ ulVBKn1SxirHwrIKI7l+Sm8L+cZTixpbhrSPRjLW8io+JIIF+nRuRspVmKnq+rohricM LGdA== X-Gm-Message-State: AOAM5303foWZQ5OETDE0VUxn2OdC1rp/5kSH9pi72B/88T9/p5G7Ps1n j4jXdkFUG5NS/Ph9im38SV3lModryh6yqA== X-Google-Smtp-Source: ABdhPJxYMZ4FNk6YpL212YJjhj5yGBIwv1lfJCDiMdnguOWcnJNsufRiStRs+0LS9irqkOMlUy6iDA== X-Received: by 2002:a05:600c:4e91:: with SMTP id f17mr20901000wmq.195.1636753759745; Fri, 12 Nov 2021 13:49:19 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:19 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 14/18] Makefile: re-add and use the "shellquote" macros Date: Fri, 12 Nov 2021 22:48:58 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Re-add and use, and expand on "shellquote" macros added in 4769948afe7 (Deal with $(bindir) and friends with whitespaces., 2005-10-10). We avoided using them due to the "$(call)" feature of GNU make being relatively new at the time, but it isn't anymore. We hard depend on GNU make versions that have it. The use of "$(call)" was removed in 39c015c556f (Fixes for ancient versions of GNU make, 2006-02-18) and 7ffe7098dca (Fix installation of templates on ancient systems., 2006-07-29) due to those incompatibilities with older GNU make versions, and we've used the more verbose *_SQ pattern ever since. The "$(call)" feature was introduced in GNU make version 3.78, released on the 22nd of September, 1999. That release also introduced "$(error)" and "$(warning)", which we've been making use of since f2fabbf76e4 (Teach Makefile to check header dependencies, 2010-01-26). This extends upon the macros added in 4769948afe7: We now have macros for quoting a ' inside '', and a ' with no surrounding '' as before. Additionally provide and use a "shelldquote" macro along with "shellquote" for the common case of wanting to quote a C string we pass to the compiler with a -D flag. This doesn't get rid of all of our shell quoting. We've still got some in the main Makefile, let's leave most of it to avoid in-flight conflicts. I've fully converted "templates/Makefile" and "t/Makefile" though. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 15 +++++---------- shared.mak | 14 ++++++++++++++ t/Makefile | 34 +++++++++++++++------------------- templates/Makefile | 14 +++++--------- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 7130e32a251..b458c24d95e 100644 --- a/Makefile +++ b/Makefile @@ -1996,11 +1996,7 @@ ifneq ("$(PROFILE)","") endif endif -# Shell quote (do not use $(call) to accommodate ancient setups); - -ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG)) -ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES)) - +# Shell quote, should be changed to use $(call shellquote,...) DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) NO_GETTEXT_SQ = $(subst ','\'',$(NO_GETTEXT)) bindir_SQ = $(subst ','\'',$(bindir)) @@ -2535,11 +2531,11 @@ builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \ config.sp config.s config.o: GIT-PREFIX config.sp config.s config.o: EXTRA_CPPFLAGS = \ - -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' + -DETC_GITCONFIG=$(call shelldquote,$(ETC_GITCONFIG)) attr.sp attr.s attr.o: GIT-PREFIX attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \ - -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"' + -DETC_GITATTRIBUTES=$(call shelldquote,$(ETC_GITATTRIBUTES)) gettext.sp gettext.s gettext.o: GIT-PREFIX gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \ @@ -2700,14 +2696,13 @@ perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES $(QUIET_GEN)mkdir -p $(dir $@) && \ sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \ -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \ - -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ + -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(call shq,$(NO_PERL_CPAN_FALLBACKS))|g' \ < $< > $@ all:: $(LIB_PERL_GEN) ifndef NO_PERL_CPAN_FALLBACKS all:: $(LIB_CPAN_GEN) endif -NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS)) endif # install-man depends on Git.3pm even with NO_PERL=Y @@ -3021,7 +3016,7 @@ else $(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)' endif endif - $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install + $(MAKE) -C templates DESTDIR=$(call shellquote,$(DESTDIR)) install $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)' $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)' ifndef NO_GETTEXT diff --git a/shared.mak b/shared.mak index 2d597ef7603..ef03c2bc094 100644 --- a/shared.mak +++ b/shared.mak @@ -8,6 +8,20 @@ # info make --index-search=.DELETE_ON_ERROR .DELETE_ON_ERROR: +### Quoting helpers + +## Quote a ' inside a '': FOO='$(call shq,$(BAR))' +shq = $(subst ','\'',$(1)) + +## Quote a ' and provide a '': FOO=$(call shq,$(BAR)) +shellquote = '$(call shq,$(1))' + +## Quote a " inside a "" +shdq = $(subst ",\",$(1)) + +## Quote ' for the shell, and embedded " for C: -DFOO=$(call shelldquote,$(BAR)) +shelldquote = '"$(call shdq,$(call shq,$(1)))"' + ### Global variables ## comma, empty, space: handy variables as these tokens are either diff --git a/t/Makefile b/t/Makefile index 882d26eee30..4168b5c6ce6 100644 --- a/t/Makefile +++ b/t/Makefile @@ -1,3 +1,6 @@ +# Import tree-wide shared Makefile behavior and libraries +include ../shared.mak + # Run tests # # Copyright (c) 2005 Junio C Hamano @@ -24,13 +27,6 @@ TEST_RESULTS_DIRECTORY = test-results CHAINLINTTMP = chainlinttmp endif -# Shell quote; -SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) -TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH)) -PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) -TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY)) -CHAINLINTTMP_SQ = $(subst ','\'',$(CHAINLINTTMP)) - T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)) TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh)) THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh))) @@ -44,38 +40,38 @@ test: pre-clean check-chainlint $(TEST_LINT) $(MAKE) aggregate-results-and-cleanup failed: - @failed=$$(cd '$(TEST_RESULTS_DIRECTORY_SQ)' && \ + @failed=$$(cd $(call shellquote,$(TEST_RESULTS_DIRECTORY)) && \ grep -l '^failed [1-9]' *.counts | \ sed -n 's/\.counts$$/.sh/p') && \ test -z "$$failed" || $(MAKE) $$failed prove: pre-clean check-chainlint $(TEST_LINT) - @echo "*** prove ***"; $(PROVE) --exec '$(TEST_SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS) + @echo "*** prove ***"; $(PROVE) --exec $(call shellquote,$(SHELL_PATH)) $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS) $(MAKE) clean-except-prove-cache $(T): - @echo "*** $@ ***"; '$(TEST_SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) + @echo "*** $@ ***"; $(call shellquote,$(SHELL_PATH)) $@ $(GIT_TEST_OPTS) pre-clean: - $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)' + $(RM) -r $(call shellquote,$(TEST_RESULTS_DIRECTORY)) clean-except-prove-cache: clean-chainlint - $(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)' + $(RM) -r 'trash directory'.* $(call shellquote,$(TEST_RESULTS_DIRECTORY)) $(RM) -r valgrind/bin clean: clean-except-prove-cache $(RM) .prove clean-chainlint: - $(RM) -r '$(CHAINLINTTMP_SQ)' + $(RM) -r $(call shellquote,$(CHAINLINTTMP)) check-chainlint: - @mkdir -p '$(CHAINLINTTMP_SQ)' && \ + @mkdir -p $(call shellquote,$(CHAINLINTTMP)) && \ err=0 && \ for i in $(CHAINLINTTESTS); do \ $(CHAINLINT) '$(CHAINLINTTMP_SQ)'/$$i.actual && \ - diff -u chainlint/$$i.expect '$(CHAINLINTTMP_SQ)'/$$i.actual || err=1; \ + sed -e '/^# LINT: /d' >$(call shellquote,$(CHAINLINTTMP))/$$i.actual && \ + diff -u chainlint/$$i.expect $(call shellquote,$(CHAINLINTTMP))/$$i.actual || err=1; \ done && exit $$err test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \ @@ -92,7 +88,7 @@ test-lint-executable: echo >&2 "non-executable tests:" $$bad; exit 1; } test-lint-shell-syntax: - @'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T) $(THELPERS) $(TPERF) + @$(call shellquote,$(PERL_PATH)) check-non-portable-shell.pl $(T) $(THELPERS) $(TPERF) test-lint-filenames: @# We do *not* pass a glob to ls-files but use grep instead, to catch @@ -107,9 +103,9 @@ aggregate-results-and-cleanup: $(T) $(MAKE) clean aggregate-results: - for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \ + for f in $(call shellquote,$(TEST_RESULTS_DIRECTORY))/t*-*.counts; do \ echo "$$f"; \ - done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh + done | $(call shellquote,$(SHELL_PATH)) ./aggregate-results.sh gitweb-test: $(MAKE) $(TGITWEB) diff --git a/templates/Makefile b/templates/Makefile index d22a71a3999..c9251a96622 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -1,3 +1,6 @@ +# Import tree-wide shared Makefile behavior and libraries +include ../shared.mak + # make and install sample templates ifndef V @@ -18,13 +21,6 @@ ifndef PERL_PATH PERL_PATH = perl endif -SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) -PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) - -# Shell quote (do not use $(call) to accommodate ancient setups); -DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) -template_instdir_SQ = $(subst ','\'',$(template_instdir)) - all: boilerplates.made custom # Put templates that can be copied straight from the source @@ -61,6 +57,6 @@ clean: $(RM) -r blt boilerplates.made install: all - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' + $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(template_instdir)) (cd blt && $(TAR) cf - .) | \ - (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -) + (cd $(call shellquote,$(DESTDIR)$(template_instdir)) && umask 022 && $(TAR) xof -) From patchwork Fri Nov 12 21:48:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54FEFC43217 for ; Fri, 12 Nov 2021 21:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F30160F36 for ; Fri, 12 Nov 2021 21:49:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235962AbhKLVw1 (ORCPT ); Fri, 12 Nov 2021 16:52:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235960AbhKLVwO (ORCPT ); Fri, 12 Nov 2021 16:52:14 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C288C061203 for ; Fri, 12 Nov 2021 13:49:22 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id i8-20020a7bc948000000b0030db7b70b6bso10950307wml.1 for ; Fri, 12 Nov 2021 13:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1OWx/7MXzps6T+zd+fvgE814+eutIhqIUB2lfB+MtN4=; b=Ss57UoO/ox3b1lb871WBlak7vuvSJuhk+28HktYW3FG0HWYvDsBhrefF6vHBOIXfmx wSCMFNFzAQaYonDHcmmJeWuhdqtj3lNETEY5zCo+mI+uc1bWqVXTDrcabRG+nTOk5myb 1gakXMdgoztwHjQyb9p3mJd14s+Bx7noR1D60mtZ9atbYA7UD1Ka+a4KUZq5SmmVu2qE z02TuDbmatB3/ANIe/dTg9SUD9eGUQubzoIww6MqzuL9ZnMnY20YDi2bu6dTIyLx3b6o iQGNTEC8eGPlaQbNkagSOEOak0nyDGFdhibukFa3AL1wHmrR2t5rl1k7nsBN0V4a9d+K y9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1OWx/7MXzps6T+zd+fvgE814+eutIhqIUB2lfB+MtN4=; b=T5u1388ankHTYqjCnfhYEPqpdLIG5yB4yp6w0evwHw+mXeL023Cf9eLVotA+n88a3i sKqojmPaDrQ3pdS1Y7xFRTXLUnw2AusEUIfLAk+1jwjv+XuQX4DCAqW+rz49ptfaJOsR 0R4YQoyQy+LEH5W9ZL9dcHklkRZ+FIYxHEwJPR0VbjRWqnY2SUTyt66CQe3ObXm3qGzZ BA9l54ZZmQYRgkalCDZYwl5js5xC/oNdT5l8WWiN82Yh8Mk+mDwPA26fyZf2x0OcPMhG qdgaDC1rlW7DIEXNyn/IH8dXNsZ0P1X9DobwCxrBYeQ4llzJYCG/IV6egVGojldzQEld 1QyQ== X-Gm-Message-State: AOAM530u0ds83dQBg5H2wO9sTmqm6hMHCNuSFNkPiCVkqbJCv719zOiH Hsc9+8WJCh0LqeLn2WKVdTzXeGPX6IU0Bw== X-Google-Smtp-Source: ABdhPJydAaE99/YOsKDJZf0kK4oXDDpZBoJMPxecQlgg5kNd18pxTr/aTquAglXjfRGvK2n+O9ewww== X-Received: by 2002:a1c:7e41:: with SMTP id z62mr8636688wmc.62.1636753760653; Fri, 12 Nov 2021 13:49:20 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:20 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 15/18] Makefile: add a "TRACK_template" for GIT-*{FLAGS,DEFINES,...} Date: Fri, 12 Nov 2021 22:48:59 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Move the mostly copy/pasted code in the "Makefile" and "Documentation/Makefile" which FORCE-generates a file based on a variable in play in the Makefile to use a template. This will make it easier later on to move these to rules that aren't FORCE-run using optional gmake 4.2+ features, but for now just getting rid of the repetition is worth it. The message for the new generated rule will say whether or not we're generating the file for the first time, as opposed to the old messages saying "new" whether we had flag modifications, or were building for the first time. Example output before: $ make clean [...] $ make GIT_VERSION = 2.34.0-rc1-dev * new build flags CC grep.o $ make CFLAGS=-I$RANDOM grep.o * new build flags CC grep.o After: $ make clean [...] $ make grep.o GIT_VERSION = 2.34.0-rc1-dev GIT-CFLAGS PARAMETERS (new) CC grep.o $ make CFLAGS=-I$RANDOM grep.o GIT-CFLAGS PARAMETERS (changed) CC grep.o Note: It's important that "@FLAGS" here be defined as '$$($(2))', and not the eagerly expanded '$($(2))'. The latter will break if e.g. curl-config isn't installed, since we'll end up recursively expanding that part of the variable even if NO_CURL isn't defined, which happens e.g. for the "check-docs" target in CI. We're also introducing a $(wspfx) variable here to control the whitespace prefixing. It matches the $(QUIET...) variables, who'll be using these variables in a subsequent commit. Note that it's important that we call the shell quote escaping macros inline (or equivalent), because if we'd like variables to be overridable we need to support e.g.: $ make CFLAGS=-I$RANDOM grep.o wspfx='$(space)->' -> GIT-CFLAGS PARAMETERS (changed) CC grep.o If we simply quoted and used $(wspfx) then the user would need to provide us with a quoted version, so there's still some use-cases for these $(*_sq) variables. It could also be done inline, but that's a lot more verbose. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/Makefile | 8 +------ Makefile | 51 ++++++------------------------------------ shared.mak | 22 ++++++++++++++++++ 3 files changed, 30 insertions(+), 51 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index ba27456c86a..4a939cc2c25 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -343,13 +343,7 @@ mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*) date >$@ TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK)) - -GIT-ASCIIDOCFLAGS: FORCE - @FLAGS='$(TRACK_ASCIIDOCFLAGS)'; \ - if test x"$$FLAGS" != x"`cat GIT-ASCIIDOCFLAGS 2>/dev/null`" ; then \ - echo >&2 " * new asciidoc flags"; \ - echo "$$FLAGS" >GIT-ASCIIDOCFLAGS; \ - fi +$(eval $(call TRACK_template,GIT-ASCIIDOCFLAGS,TRACK_ASCIIDOCFLAGS)) clean: $(RM) -rf .build/ diff --git a/Makefile b/Makefile index b458c24d95e..c8a0a1586ca 100644 --- a/Makefile +++ b/Makefile @@ -2087,10 +2087,7 @@ endif GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT)) GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))" GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ)) -GIT-USER-AGENT: FORCE - @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \ - echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \ - fi +$(eval $(call TRACK_template,GIT-USER-AGENT,GIT_USER_AGENT_SQ)) ifdef DEFAULT_HELP_FORMAT BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"' @@ -2238,12 +2235,7 @@ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\ $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\ $(gitwebdir_SQ):$(PERL_PATH_SQ):$(PAGER_ENV):\ $(perllibdir_SQ) -GIT-SCRIPT-DEFINES: FORCE - @FLAGS='$(SCRIPT_DEFINES)'; \ - if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \ - echo >&2 " * new script parameters"; \ - echo "$$FLAGS" >$@; \ - fi +$(eval $(call TRACK_template,GIT-SCRIPT-DEFINES,SCRIPT_DEFINES)) define cmd_munge_script sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ @@ -2355,13 +2347,7 @@ git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES chmod +x $@+ && \ mv $@+ $@ endif # NO_PERL - -GIT-PERL-DEFINES: FORCE - @FLAGS='$(PERL_DEFINES)'; \ - if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \ - echo >&2 " * new perl-specific parameters"; \ - echo "$$FLAGS" >$@; \ - fi +$(eval $(call TRACK_template,GIT-PERL-DEFINES,PERL_DEFINES)) # As with NO_PERL=Y we'll still make GIT-PYTHON-DEFINES if "NO_PYTHON" # is defined, for creating the "unimplemented.sh" scripts. @@ -2390,12 +2376,7 @@ $(SCRIPT_PYTHON_GEN): % : %.py GIT-PYTHON-DEFINES mv $@+ $@ endif # NO_PYTHON -GIT-PYTHON-DEFINES: FORCE - @FLAGS='$(PYTHON_DEFINES)'; \ - if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \ - echo >&2 " * new python-specific parameters"; \ - echo "$$FLAGS" >$@; \ - fi +$(eval $(call TRACK_template,GIT-PYTHON-DEFINES,PYTHON_DEFINES)) CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ configure.ac >configure.ac+ && \ @@ -2751,31 +2732,13 @@ cscope: cscope.out ### Detect prefix changes TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\ $(localedir_SQ) - -GIT-PREFIX: FORCE - @FLAGS='$(TRACK_PREFIX)'; \ - if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \ - echo >&2 " * new prefix flags"; \ - echo "$$FLAGS" >GIT-PREFIX; \ - fi +$(eval $(call TRACK_template,GIT-PREFIX,TRACK_PREFIX)) TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME) - -GIT-CFLAGS: FORCE - @FLAGS='$(TRACK_CFLAGS)'; \ - if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \ - echo >&2 " * new build flags"; \ - echo "$$FLAGS" >GIT-CFLAGS; \ - fi +$(eval $(call TRACK_template,GIT-CFLAGS,TRACK_CFLAGS)) TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS)) - -GIT-LDFLAGS: FORCE - @FLAGS='$(TRACK_LDFLAGS)'; \ - if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \ - echo >&2 " * new link flags"; \ - echo "$$FLAGS" >GIT-LDFLAGS; \ - fi +$(eval $(call TRACK_template,GIT-LDFLAGS,TRACK_LDFLAGS)) # We need to apply sq twice, once to protect from the shell # that runs GIT-BUILD-OPTIONS, and then again to protect it diff --git a/shared.mak b/shared.mak index ef03c2bc094..3b4163e652a 100644 --- a/shared.mak +++ b/shared.mak @@ -29,3 +29,25 @@ shelldquote = '"$(call shdq,$(call shq,$(1)))"' comma = , empty = space = $(empty) $(empty) + +## wspfx: the whitespace prefix padding for $(QUIET...) and similarly +## aligned output. +wspfx = $(space)$(space)$(space) +wspfx_sq = $(call shellquote,$(wspfx)) + +### Templates + +## Template for making a GIT-SOMETHING, which changes if a +## TRACK_SOMETHING variable changes. +define TRACK_template +.PHONY: FORCE +$(1): FORCE + @FLAGS='$$($(2))'; \ + if ! test -f $(1) ; then \ + echo $(wspfx_sq) "$(1) PARAMETERS (new)" $@; \ + echo "$$$$FLAGS" >$(1); \ + elif test x"$$$$FLAGS" != x"`cat $(1) 2>/dev/null`" ; then \ + echo $(wspfx_sq) "$(1) PARAMETERS (changed)" $@; \ + echo "$$$$FLAGS" >$(1); \ + fi +endef From patchwork Fri Nov 12 21:49:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB71DC433FE for ; Fri, 12 Nov 2021 21:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9860560FE7 for ; Fri, 12 Nov 2021 21:49:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235960AbhKLVw1 (ORCPT ); Fri, 12 Nov 2021 16:52:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235838AbhKLVwO (ORCPT ); Fri, 12 Nov 2021 16:52:14 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B086C061208 for ; Fri, 12 Nov 2021 13:49:23 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id 133so8927271wme.0 for ; Fri, 12 Nov 2021 13:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XQ5xeBHjZa60yUgfC8O4gIeHCN7/iJAwfCfoJ/ENCTw=; b=J52YuoQ5f8ks7arMi4iMMqy61kkO4hVMaYbrSzUm7LsZy0+lt49ihO64SaDImtrZSc vJtYX7wkaGl5+bmWOLIjekJZJMKuGu29dB/L0QFGis7smpLbEJWNWi+fCFc9bciG20Aq 08PHpiwc3WRlMnzYnk91UlontxYPO1rNPGJ5I9wjwz4uLjdQtS+SgLUC4dJGPgD9vL46 nKHhs8dbc/SgCW7In9zWFf/p5pfj4cNojK/72I658VO4j6/vL9jox5V0aD/PaVnOx7LJ Pm00M6T6wbG5fAECUPhPBQyQKi6CJXW7r+aMePjAhYE8hnGD2cAGJDk4B49vqxy+StOb QnGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XQ5xeBHjZa60yUgfC8O4gIeHCN7/iJAwfCfoJ/ENCTw=; b=ALe5YNMK2Wq0SHMOV1uD6csQh9vkjtNQLktxtVuU9z19apvhxFJYybLeaOOgbAgzog oFC7YaqWZxZaVQrHTQlQuarLS8U3OocMTGmMCd5AdpZQXN5nvtHEeBYg1YMJfJ8deNRm 0vh7TiNcZ+hy/MDMW8UqQp7HJbwmGrpsmf09crvkYZOmTtRUiCqJb0ETy360+3w8sAMj 0C8iQtWpJB5qwsv1zqLmbCHchgAFVj+vIO2Adz/0VfjTQLtJpgmlpi9Horccbql3Ejku t4jcZn5An+QG+iuPdCRui15Sc0yaj8ojhcXwCYStTwRsEbOVMjOrm9tFvHta3rNq+Jrg HV6g== X-Gm-Message-State: AOAM530hxZNTVfJqq6OZNGnYI6ZGk2uiDXjaCSOw93ZmeMD6wYWqBSpB JIdAomIq8mr4SMmktUqLghK0Mv9n7AHqZw== X-Google-Smtp-Source: ABdhPJz3ShPx+nZG7hZuC+8jVf+fs5boUjAYrspIr2g+qWCTqSS2uLmJQjafZdT+YIr6766lduASMw== X-Received: by 2002:a05:600c:1990:: with SMTP id t16mr20403668wmq.48.1636753761771; Fri, 12 Nov 2021 13:49:21 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:20 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 16/18] Makefile: add "$(QUIET)" boilerplate to shared.mak Date: Fri, 12 Nov 2021 22:49:00 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The $(QUIET) variables we define are largely duplicated between our various Makefiles, let's define them in the new "shared.mak" instead. Since we're not using the environment to pass these around we don't need to export the "QUIET_GEN" and "QUIET_BUILT_IN" variables anymore. The "QUIET_GEN" variable is used in "git-gui/Makefile" and "gitweb/Makefile", but they've got their own definition for those. The "QUIET_BUILT_IN" variable is only used in the top-level "Makefile". We still need to export the "V" variable. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/Makefile | 32 ------------------------- Makefile | 33 -------------------------- config.mak.uname | 1 - shared.mak | 53 ++++++++++++++++++++++++++++++++++++++++++ templates/Makefile | 5 ---- 5 files changed, 53 insertions(+), 71 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index 4a939cc2c25..69a9af35397 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -218,38 +218,6 @@ DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR)) ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)' endif -QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir -QUIET_SUBDIR1 = - -ifneq ($(findstring $(MAKEFLAGS),w),w) -PRINT_DIR = --no-print-directory -else # "make -w" -NO_SUBDIR = : -endif - -ifneq ($(findstring $(MAKEFLAGS),s),s) -ifndef V - QUIET = @ - QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@; - QUIET_XMLTO = @echo ' ' XMLTO $@; - QUIET_DB2TEXI = @echo ' ' DB2TEXI $@; - QUIET_MAKEINFO = @echo ' ' MAKEINFO $@; - QUIET_DBLATEX = @echo ' ' DBLATEX $@; - QUIET_XSLTPROC = @echo ' ' XSLTPROC $@; - QUIET_GEN = @echo ' ' GEN $@; - QUIET_STDERR = 2> /dev/null - QUIET_SUBDIR0 = +@subdir= - QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ - $(MAKE) $(PRINT_DIR) -C $$subdir - - QUIET_LINT_GITLINK = @echo ' ' LINT GITLINK $<; - QUIET_LINT_MANSEC = @echo ' ' LINT MAN SEC $<; - QUIET_LINT_MANEND = @echo ' ' LINT MAN END $<; - - export V -endif -endif - all: html man html: $(DOC_HTML) diff --git a/Makefile b/Makefile index c8a0a1586ca..c437aea9e4a 100644 --- a/Makefile +++ b/Makefile @@ -1939,39 +1939,6 @@ ifndef PAGER_ENV PAGER_ENV = LESS=FRX LV=-c endif -QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir -QUIET_SUBDIR1 = - -ifneq ($(findstring w,$(MAKEFLAGS)),w) -PRINT_DIR = --no-print-directory -else # "make -w" -NO_SUBDIR = : -endif - -ifneq ($(findstring s,$(MAKEFLAGS)),s) -ifndef V - QUIET_CC = @echo ' ' CC $@; - QUIET_AR = @echo ' ' AR $@; - QUIET_LINK = @echo ' ' LINK $@; - QUIET_BUILT_IN = @echo ' ' BUILTIN $@; - QUIET_GEN = @echo ' ' GEN $@; - QUIET_LNCP = @echo ' ' LN/CP $@; - QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; - QUIET_MSGFMT = @echo ' ' MSGFMT $@; - QUIET_GCOV = @echo ' ' GCOV $@; - QUIET_SP = @echo ' ' SP $<; - QUIET_HDR = @echo ' ' HDR $(<:hcc=h); - QUIET_RC = @echo ' ' RC $@; - QUIET_SPATCH = @echo ' ' SPATCH $<; - QUIET_SUBDIR0 = +@subdir= - QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ - $(MAKE) $(PRINT_DIR) -C $$subdir - export V - export QUIET_GEN - export QUIET_BUILT_IN -endif -endif - ifdef NO_INSTALL_HARDLINKS export NO_INSTALL_HARDLINKS endif diff --git a/config.mak.uname b/config.mak.uname index d0701f9beb0..1a12d8c635f 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -715,7 +715,6 @@ vcxproj: git diff-index --cached --quiet HEAD -- # Make .vcxproj files and add them - unset QUIET_GEN QUIET_BUILT_IN; \ perl contrib/buildsystems/generate -g Vcxproj git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj diff --git a/shared.mak b/shared.mak index 3b4163e652a..80176f705fc 100644 --- a/shared.mak +++ b/shared.mak @@ -35,6 +35,59 @@ space = $(empty) $(empty) wspfx = $(space)$(space)$(space) wspfx_sq = $(call shellquote,$(wspfx)) +### Quieting +## common +QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir +QUIET_SUBDIR1 = + +ifneq ($(findstring w,$(MAKEFLAGS)),w) +PRINT_DIR = --no-print-directory +else # "make -w" +NO_SUBDIR = : +endif + +ifneq ($(findstring s,$(MAKEFLAGS)),s) +ifndef V +## common + QUIET_SUBDIR0 = +@subdir= + QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ + $(MAKE) $(PRINT_DIR) -C $$subdir + + QUIET = @ + QUIET_GEN = @echo ' ' GEN $@; + +## Used in "Makefile" + QUIET_CC = @echo ' ' CC $@; + QUIET_AR = @echo ' ' AR $@; + QUIET_LINK = @echo ' ' LINK $@; + QUIET_BUILT_IN = @echo ' ' BUILTIN $@; + QUIET_LNCP = @echo ' ' LN/CP $@; + QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; + QUIET_MSGFMT = @echo ' ' MSGFMT $@; + QUIET_GCOV = @echo ' ' GCOV $@; + QUIET_SP = @echo ' ' SP $<; + QUIET_HDR = @echo ' ' HDR $(<:hcc=h); + QUIET_RC = @echo ' ' RC $@; + QUIET_SPATCH = @echo ' ' SPATCH $<; + +## Used in "Documentation/Makefile" + QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@; + QUIET_XMLTO = @echo ' ' XMLTO $@; + QUIET_DB2TEXI = @echo ' ' DB2TEXI $@; + QUIET_MAKEINFO = @echo ' ' MAKEINFO $@; + QUIET_DBLATEX = @echo ' ' DBLATEX $@; + QUIET_XSLTPROC = @echo ' ' XSLTPROC $@; + QUIET_GEN = @echo ' ' GEN $@; + QUIET_STDERR = 2> /dev/null + + QUIET_LINT_GITLINK = @echo ' ' LINT GITLINK $<; + QUIET_LINT_MANSEC = @echo ' ' LINT MAN SEC $<; + QUIET_LINT_MANEND = @echo ' ' LINT MAN END $<; + + export V +endif +endif + ### Templates ## Template for making a GIT-SOMETHING, which changes if a diff --git a/templates/Makefile b/templates/Makefile index c9251a96622..b056e710b7e 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -2,11 +2,6 @@ include ../shared.mak # make and install sample templates - -ifndef V - QUIET = @ -endif - INSTALL ?= install TAR ?= tar RM ?= rm -f From patchwork Fri Nov 12 21:49:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA428C43219 for ; Fri, 12 Nov 2021 21:49:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4AA560FE7 for ; Fri, 12 Nov 2021 21:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235964AbhKLVw2 (ORCPT ); Fri, 12 Nov 2021 16:52:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235816AbhKLVwQ (ORCPT ); Fri, 12 Nov 2021 16:52:16 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31E4C06120B for ; Fri, 12 Nov 2021 13:49:24 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id s13so17927492wrb.3 for ; Fri, 12 Nov 2021 13:49:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3OwKm/HU1WpT1yIwrMvNcrq2ZhOaCcpZp9Vl5Whjmjs=; b=c1bH9+WoWjVZWkdA4ubM1F+97KILN+QuLVA9eiQZwvXTs8G9Id6lF4zM2T+Xcownb9 iw3j1NjG5mJSmV16WVnT4L5vmnG47VzLt7P0SKJNCyBW7DqKN8TLg6pefq3Wwkjy3Drw jtXkmi7hq8+9HDJ/Pk8Z6L4nhGceeG0ZxXsrziEYM3XJuixiB25yM2z0z/6+RVhgY829 xNwLCID1Laj4uIRIMfFJZnTsYulPmjsFhE2uN3BSE68piFXqU3qXhsbrvfOT01LNU0qx OedwZSMMPVi/aXhDdHM9wpy9NVE3OSBOPxzVRA3Xdm9Kxx8zgYbZfz6tx8PRkiabOuWc bFOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3OwKm/HU1WpT1yIwrMvNcrq2ZhOaCcpZp9Vl5Whjmjs=; b=d6zWbCLKT1K6uqJBzWDyyO3OoArYzB2Ot2ayU5t0u/x8+owckOf5Nfr9S+oK+UiPPe mhaxTHD19C0BnOlVmm1DysFlAEospCbSe0v2J2KSoIF5EgvY2uYrd2wOGnC7gBvOz0yD zNV5WiSkGR6+DTfob/fppPjUaIZ5+6AVdlG7a/HmV684y3QRJqsQR7DzqqNob/GFBzaI q90ed3QprlFCpTWjsn3sSGvEpQ4NGiikiiagxbeNfiZdpCMOBwhFHxCBlmNv1sNPbmEJ ky9tcfGpITRhb7Dvi64qqK/QJESoYqsfPexAImgmlR3TqPBXoQmVi4O17cFMTtfykX6l 26yg== X-Gm-Message-State: AOAM531urW4SCz5fwobDB2g5+XpPrvrjyKqnx0ud0dGHyQluWywUJM1X Zulb9Y4xZ+JFEC/7FUVjohmdo1/2/Mxqhg== X-Google-Smtp-Source: ABdhPJz5qO9L4r0vxvSjIGlnga6Rsh4E8ZRRs3OTEg0HgB9c5ZO3vAk1nl2Z0griEXUDRv4GooaCFw== X-Received: by 2002:a05:6000:18ad:: with SMTP id b13mr22272312wri.195.1636753762842; Fri, 12 Nov 2021 13:49:22 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:22 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 17/18] Makefile: use $(wspfx) for $(QUIET...) in shared.mak Date: Fri, 12 Nov 2021 22:49:01 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the mostly move-only change in the preceding commit to use the $(wspfx) variable for defining the QUIET padding, to guarantee that it's consistent with the "TRACK_template" template. $ make CFLAGS=-I$RANDOM grep.o wspfx='$(space)->' -> GIT-CFLAGS PARAMETERS (changed) -> CC grep.o Signed-off-by: Ævar Arnfjörð Bjarmason --- shared.mak | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/shared.mak b/shared.mak index 80176f705fc..a1b62b272f8 100644 --- a/shared.mak +++ b/shared.mak @@ -50,39 +50,39 @@ ifneq ($(findstring s,$(MAKEFLAGS)),s) ifndef V ## common QUIET_SUBDIR0 = +@subdir= - QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ + QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo $(wspfx_sq) SUBDIR $$subdir; \ $(MAKE) $(PRINT_DIR) -C $$subdir QUIET = @ - QUIET_GEN = @echo ' ' GEN $@; + QUIET_GEN = @echo $(wspfx_sq) GEN $@; ## Used in "Makefile" - QUIET_CC = @echo ' ' CC $@; - QUIET_AR = @echo ' ' AR $@; - QUIET_LINK = @echo ' ' LINK $@; - QUIET_BUILT_IN = @echo ' ' BUILTIN $@; - QUIET_LNCP = @echo ' ' LN/CP $@; - QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; - QUIET_MSGFMT = @echo ' ' MSGFMT $@; - QUIET_GCOV = @echo ' ' GCOV $@; - QUIET_SP = @echo ' ' SP $<; - QUIET_HDR = @echo ' ' HDR $(<:hcc=h); - QUIET_RC = @echo ' ' RC $@; - QUIET_SPATCH = @echo ' ' SPATCH $<; + QUIET_CC = @echo $(wspfx_sq) CC $@; + QUIET_AR = @echo $(wspfx_sq) AR $@; + QUIET_LINK = @echo $(wspfx_sq) LINK $@; + QUIET_BUILT_IN = @echo $(wspfx_sq) BUILTIN $@; + QUIET_LNCP = @echo $(wspfx_sq) LN/CP $@; + QUIET_XGETTEXT = @echo $(wspfx_sq) XGETTEXT $@; + QUIET_MSGFMT = @echo $(wspfx_sq) MSGFMT $@; + QUIET_GCOV = @echo $(wspfx_sq) GCOV $@; + QUIET_SP = @echo $(wspfx_sq) SP $<; + QUIET_HDR = @echo $(wspfx_sq) HDR $(<:hcc=h); + QUIET_RC = @echo $(wspfx_sq) RC $@; + QUIET_SPATCH = @echo $(wspfx_sq) SPATCH $<; ## Used in "Documentation/Makefile" - QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@; - QUIET_XMLTO = @echo ' ' XMLTO $@; - QUIET_DB2TEXI = @echo ' ' DB2TEXI $@; - QUIET_MAKEINFO = @echo ' ' MAKEINFO $@; - QUIET_DBLATEX = @echo ' ' DBLATEX $@; - QUIET_XSLTPROC = @echo ' ' XSLTPROC $@; - QUIET_GEN = @echo ' ' GEN $@; + QUIET_ASCIIDOC = @echo $(wspfx_sq) ASCIIDOC $@; + QUIET_XMLTO = @echo $(wspfx_sq) XMLTO $@; + QUIET_DB2TEXI = @echo $(wspfx_sq) DB2TEXI $@; + QUIET_MAKEINFO = @echo $(wspfx_sq) MAKEINFO $@; + QUIET_DBLATEX = @echo $(wspfx_sq) DBLATEX $@; + QUIET_XSLTPROC = @echo $(wspfx_sq) XSLTPROC $@; + QUIET_GEN = @echo $(wspfx_sq) GEN $@; QUIET_STDERR = 2> /dev/null - QUIET_LINT_GITLINK = @echo ' ' LINT GITLINK $<; - QUIET_LINT_MANSEC = @echo ' ' LINT MAN SEC $<; - QUIET_LINT_MANEND = @echo ' ' LINT MAN END $<; + QUIET_LINT_GITLINK = @echo $(wspfx_sq) LINT GITLINK $<; + QUIET_LINT_MANSEC = @echo $(wspfx_sq) LINT MAN SEC $<; + QUIET_LINT_MANEND = @echo $(wspfx_sq) LINT MAN END $<; export V endif From patchwork Fri Nov 12 21:49:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12617349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B74CFC433EF for ; Fri, 12 Nov 2021 21:49:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BB7260F70 for ; Fri, 12 Nov 2021 21:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235968AbhKLVwa (ORCPT ); Fri, 12 Nov 2021 16:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235945AbhKLVwQ (ORCPT ); Fri, 12 Nov 2021 16:52:16 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACBF4C06120D for ; Fri, 12 Nov 2021 13:49:25 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id b184-20020a1c1bc1000000b0033140bf8dd5so7754337wmb.5 for ; Fri, 12 Nov 2021 13:49:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qgJZ5mZFclkoeSBZGUQ5y8eNq/+jyEQ9f4lU8k5OVOk=; b=IMphrKT+sRxPAdTbiuzDLcm5zK9iJq7i9zN91wL9u4AlBIy8QLT8wMU7HMgz7Ncn58 qtsVUzsKbzpzcEJ7hUVOyYB0R2X/DO4PuLhLHqn05EsEzcJwNDUFVNxCRWdSOH8P7+iy 8aLnlZoF1q1ywhZXKvgLAScLb7xHMJqeb0HJddJZT/UjUOVc/TtqaWMEVttj7NMGtYva g9J5vjnZNowZUncYDNjWdnqo7f8fVy9Y46Hm54JC2gUcqdAdRbxJjVFRHuqwL/rTDEYa Ti2VGjE5IiOrBVBehFVKlAl0VmTUgUlR/pSjo7oRXlFfeY4LfA7aQBtNlLv4Ttozl9p5 BJYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qgJZ5mZFclkoeSBZGUQ5y8eNq/+jyEQ9f4lU8k5OVOk=; b=dx0OFZPkKScnO2pz0/WkSW0rfchcz0PlXBMRKat+kpTUnw2nQ8jFxnlabODOYq02P7 3+ZfYEvm07GlT3xBQWIB6X4u/xETUrOlfjOJ6ame3Dgzn+aaF2H3MZFNsZsQsbCg3bdQ Woyh2ksre7fW9EejTFTuXlzk0Dh9xQX9UeyY3LrlnygL8EHBbtnPlXDJn8ySfd1hmr/R 3Gp8qzR76CAaq3/UvUS9rio1l9U/LOSg9GVIE4oybylICqfeG3ny/agivdUjoyN/to8/ cPdCkcHuAZWtlGcjczU/RpuoJYSxe8/3malTL+57WBNmAkG2kWOVMPBnjSJVAjr1xFL/ LFEw== X-Gm-Message-State: AOAM533iWWUSES4zAcs3Fu21AbaObBuhnDru/Mn+vYKpZHjXwZGWXBWv 0EPKltfKo1RgsWWUXneXGHMBXLAbW6B7cg== X-Google-Smtp-Source: ABdhPJzTk/vG//4h5NJ47zA2vwsF6qr/NIMGJPDWsPYPY9OEEH6ajK5KFDqJnqwjZ3f4VBhTrQQPBg== X-Received: by 2002:a05:600c:511c:: with SMTP id o28mr21290087wms.96.1636753763908; Fri, 12 Nov 2021 13:49:23 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id h27sm14117189wmc.43.2021.11.12.13.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:49:23 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 18/18] Makefiles: add and use wildcard "mkdir -p" template Date: Fri, 12 Nov 2021 22:49:02 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.rc2.795.g926201d1cc8 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a template to do the "mkdir -p" of $(@D) (the parent dir of $@) for us, and use it for the "make lint-docs" targets I added in 8650c6298c1 (doc lint: make "lint-docs" non-.PHONY, 2021-10-15). As seen in 4c64fb5aad9 (Documentation/Makefile: fix lint-docs mkdir dependency, 2021-10-26) maintaining these manual lists of parent directory dependencies is fragile, in addition to being obviously verbose. I used this pattern at the time because I couldn't find another method than "order-only" prerequisites to avoid doing a "mkdir -p $(@D)" for every file being created, which as noted in [1] would be significantly slower. But as it turns out we can use this neat trick of only doing a "mkdir -p" if the $(wildcard) macro tells us the path doesn't exist. A re-run of a performance test similar to thatnoted downthread of [1] in [2] shows that this is faster, in addition to being less verbose and more reliable (this uses my "git-hyperfine" thin wrapper for "hyperfine"[3]): $ git hyperfine -L rev HEAD~0,HEAD~1 -b 'make -C Documentation lint-docs' -p 'rm -rf Documentation/.build' 'make -C Documentation lint-docs' Benchmark 1: make -C Documentation lint-docs' in 'HEAD~0 Time (mean ± σ): 2.129 s ± 0.011 s [User: 1.840 s, System: 0.321 s] Range (min … max): 2.121 s … 2.158 s 10 runs Benchmark 2: make -C Documentation lint-docs' in 'HEAD~1 Time (mean ± σ): 2.659 s ± 0.002 s [User: 2.306 s, System: 0.397 s] Range (min … max): 2.657 s … 2.662 s 10 runs Summary 'make -C Documentation lint-docs' in 'HEAD~0' ran 1.25 ± 0.01 times faster than 'make -C Documentation lint-docs' in 'HEAD~1' So let's use that pattern both for the "lint-docs" target, and a few miscellaneous other targets. This method of creating parent directories is explicitly racy in that we don't know if we're going to say always create a "foo" followed by a "foo/bar" under parallelism, or skip the "foo" because we created "foo/bar" first. In this case it doesn't matter for anything except that we aren't guaranteed to get the same number of rules firing when running make in parallel. 1. https://lore.kernel.org/git/211028.861r45y3pt.gmgdl@evledraar.gmail.com/ 2. https://lore.kernel.org/git/211028.86o879vvtp.gmgdl@evledraar.gmail.com/ 3. https://gitlab.com/avar/git-hyperfine/ Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/Makefile | 25 +++---------------------- Makefile | 12 +++++++----- shared.mak | 7 +++++++ 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index 69a9af35397..d16b653394c 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -428,25 +428,11 @@ quick-install-html: require-htmlrepo print-man1: @for i in $(MAN1_TXT); do echo $$i; done -## Lint: Common -.build: - $(QUIET)mkdir $@ -.build/lint-docs: | .build - $(QUIET)mkdir $@ - ## Lint: gitlink -.build/lint-docs/gitlink: | .build/lint-docs - $(QUIET)mkdir $@ -.build/lint-docs/gitlink/howto: | .build/lint-docs/gitlink - $(QUIET)mkdir $@ -.build/lint-docs/gitlink/config: | .build/lint-docs/gitlink - $(QUIET)mkdir $@ LINT_DOCS_GITLINK = $(patsubst %.txt,.build/lint-docs/gitlink/%.ok,$(HOWTO_TXT) $(DOC_DEP_TXT)) -$(LINT_DOCS_GITLINK): | .build/lint-docs/gitlink -$(LINT_DOCS_GITLINK): | .build/lint-docs/gitlink/howto -$(LINT_DOCS_GITLINK): | .build/lint-docs/gitlink/config $(LINT_DOCS_GITLINK): lint-gitlink.perl $(LINT_DOCS_GITLINK): .build/lint-docs/gitlink/%.ok: %.txt + $(call mkdir_p_parent_template) $(QUIET_LINT_GITLINK)$(PERL_PATH) lint-gitlink.perl \ $< \ $(HOWTO_TXT) $(DOC_DEP_TXT) \ @@ -457,23 +443,18 @@ $(LINT_DOCS_GITLINK): .build/lint-docs/gitlink/%.ok: %.txt lint-docs-gitlink: $(LINT_DOCS_GITLINK) ## Lint: man-end-blurb -.build/lint-docs/man-end-blurb: | .build/lint-docs - $(QUIET)mkdir $@ LINT_DOCS_MAN_END_BLURB = $(patsubst %.txt,.build/lint-docs/man-end-blurb/%.ok,$(MAN_TXT)) -$(LINT_DOCS_MAN_END_BLURB): | .build/lint-docs/man-end-blurb $(LINT_DOCS_MAN_END_BLURB): lint-man-end-blurb.perl $(LINT_DOCS_MAN_END_BLURB): .build/lint-docs/man-end-blurb/%.ok: %.txt + $(call mkdir_p_parent_template) $(QUIET_LINT_MANEND)$(PERL_PATH) lint-man-end-blurb.perl $< >$@ .PHONY: lint-docs-man-end-blurb -lint-docs-man-end-blurb: $(LINT_DOCS_MAN_END_BLURB) ## Lint: man-section-order -.build/lint-docs/man-section-order: | .build/lint-docs - $(QUIET)mkdir $@ LINT_DOCS_MAN_SECTION_ORDER = $(patsubst %.txt,.build/lint-docs/man-section-order/%.ok,$(MAN_TXT)) -$(LINT_DOCS_MAN_SECTION_ORDER): | .build/lint-docs/man-section-order $(LINT_DOCS_MAN_SECTION_ORDER): lint-man-section-order.perl $(LINT_DOCS_MAN_SECTION_ORDER): .build/lint-docs/man-section-order/%.ok: %.txt + $(call mkdir_p_parent_template) $(QUIET_LINT_MANSEC)$(PERL_PATH) lint-man-section-order.perl $< >$@ .PHONY: lint-docs-man-section-order lint-docs-man-section-order: $(LINT_DOCS_MAN_SECTION_ORDER) diff --git a/Makefile b/Makefile index c437aea9e4a..0a3f292bf82 100644 --- a/Makefile +++ b/Makefile @@ -2632,7 +2632,8 @@ all:: $(MOFILES) endif po/build/locale/%/LC_MESSAGES/git.mo: po/%.po - $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $< + $(call mkdir_p_parent_template) + $(QUIET_MSGFMT)$(MSGFMT) -o $@ $< ifndef NO_PERL LIB_PERL = $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm) @@ -2641,7 +2642,8 @@ LIB_CPAN = $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm) LIB_CPAN_GEN = $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN)) perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES - $(QUIET_GEN)mkdir -p $(dir $@) && \ + $(call mkdir_p_parent_template) + $(QUIET_GEN) \ sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \ -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \ -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(call shq,$(NO_PERL_CPAN_FALLBACKS))|g' \ @@ -2655,8 +2657,8 @@ endif # install-man depends on Git.3pm even with NO_PERL=Y perl/build/man/man3/Git.3pm: perl/Git.pm - $(QUIET_GEN)mkdir -p $(dir $@) && \ - pod2man $< $@ + $(call mkdir_p_parent_template) + $(QUIET_GEN)pod2man $< $@ FIND_SOURCE_FILES = ( \ git ls-files \ @@ -2780,7 +2782,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $( all:: $(TEST_PROGRAMS) $(test_bindir_programs) bin-wrappers/%: wrap-for-bin.sh - @mkdir -p bin-wrappers + $(call mkdir_p_parent_template) $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@@BUILD_DIR@@|$(shell pwd)|' \ -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \ diff --git a/shared.mak b/shared.mak index a1b62b272f8..363138a5577 100644 --- a/shared.mak +++ b/shared.mak @@ -56,6 +56,8 @@ ifndef V QUIET = @ QUIET_GEN = @echo $(wspfx_sq) GEN $@; + QUIET_MKDIR_P_PARENT = @echo $(wspfx_sq) MKDIR -p $(@D); + ## Used in "Makefile" QUIET_CC = @echo $(wspfx_sq) CC $@; QUIET_AR = @echo $(wspfx_sq) AR $@; @@ -88,6 +90,11 @@ ifndef V endif endif +## Helpers +define mkdir_p_parent_template +$(if $(wildcard $(@D)),,$(QUIET_MKDIR_P_PARENT)$(shell mkdir -p $(@D))) +endef + ### Templates ## Template for making a GIT-SOMETHING, which changes if a