git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 02/11] Makefile: don't set up "perl/build" rules under NO_PERL=Y

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 17, 2021, 00:26 UTC
Message-ID
<patch-02.11-37eeccc5646-20211217T002023Z-avarab@gmail.com>
In-Reply-To
<cover-00.11-00000000000-20211217T002023Z-avarab@gmail.com>

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 <avarab@gmail.com>
---
 Makefile | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index b21ffe25c2a..d4c31a2718f 100644
--- a/Makefile
+++ b/Makefile
@@ -2731,19 +2731,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' \
@@ -2751,6 +2744,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 $< $@
-- 
2.34.1.1119.g7a3fc8778ee
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 of 13 in “Makefile: fix "Perl" and "Python" rules, speed up re-builds”
  1. 00/11 Makefile: fix "Perl" and "Python" rules, speed up re-buildsÆvar Arnfjörð Bjarmason, Dec 17, 2021
  2. 01/11 Makefile: clean perl/build/ even with NO_PERL=YÆvar Arnfjörð Bjarmason, Dec 17, 2021
  3. 02/11 Makefile: don't set up "perl/build" rules under NO_PERL=YÆvar Arnfjörð Bjarmason, Dec 17, 2021
  4. 03/11 Makefile: use "=" not ":=" for po/* and perl/*Ævar Arnfjörð Bjarmason, Dec 17, 2021
  5. 04/11 Makefile: remove "mv $@ $@+" dance redundant to .DELETE_ON_ERRORÆvar Arnfjörð Bjarmason, Dec 17, 2021
  6. 05/11 Makefile: guard Perl-only variable assignmentsÆvar Arnfjörð Bjarmason, Dec 17, 2021
  7. 06/11 Makefile: change "ifndef NO_PERL" to "ifdef NO_PERL"Ævar Arnfjörð Bjarmason, Dec 17, 2021
  8. 07/11 Makefile: adjust Perl-related comments & whitespaceÆvar Arnfjörð Bjarmason, Dec 17, 2021
  9. 08/11 Makefile: correct "GIT-PERL-{DEFINES,HEADER}" dependency graphÆvar Arnfjörð Bjarmason, Dec 17, 2021
  10. 09/11 Makefile: sort PERL_DEFINES listÆvar Arnfjörð Bjarmason, Dec 17, 2021
  11. 10/11 Makefile: create a GIT-PYTHON-DEFINES, like "PERL"Ævar Arnfjörð Bjarmason, Dec 17, 2021
  12. 11/11 Makefile: stop needing @@GIT_VERSION@@ in *.perl scriptsÆvar Arnfjörð Bjarmason, Dec 17, 2021
  13. Ævar Arnfjörð BjarmasonFeb 21, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.