diff mbox series

[05/16] Makefile: correct "GIT-PERL-{DEFINES,HEADER}" dependency graph

Message ID patch-05.16-d8e14cb723d-20211106T205717Z-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series Makefiles: dependency correctness & speedup | expand

Commit Message

Ævar Arnfjörð Bjarmason Nov. 6, 2021, 9:03 p.m. UTC
Fix several small issues with the dependency graph of the generated
"GIT-PERL-DEFINES" and "GIT-PERL-HEADER" files:

1. 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, and change it from depending on "localedir_relative_SQ"
   instead of "localedir".

   The former is what we'll actually use, and 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 it
   clearer what's going on here by bringing 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.

2. 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,
   but makes it clear  that (unlike GIT-BUILD-OPTIONS) they are not

3. 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), now that our dependency graph is correct we can be
   confident in dropping it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Eric Sunshine Nov. 7, 2021, 1:51 a.m. UTC | #1
On Sat, Nov 6, 2021 at 5:03 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> Fix several small issues with the dependency graph of the generated
> "GIT-PERL-DEFINES" and "GIT-PERL-HEADER" files:
>
> 1. 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, and change it from depending on "localedir_relative_SQ"
>    instead of "localedir".
>
>    The former is what we'll actually use, and 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 it
>    clearer what's going on here by bringing 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.
>
> 2. 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,
>    but makes it clear  that (unlike GIT-BUILD-OPTIONS) they are not

Too many spaces between "clear" and "that".

Is the last sentence of this paragraph incomplete?

> 3. 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), now that our dependency graph is correct we can be
>    confident in dropping it.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index fd4fe6c1045..181dc52f152 100644
--- a/Makefile
+++ b/Makefile
@@ -2293,6 +2293,9 @@  $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
 
 ifndef NO_PERL
 PERL_DEFINES =
+PERL_DEFINES += $(gitexecdir_relative_SQ)
+PERL_DEFINES += $(perllibdir_relative_SQ)
+PERL_DEFINES += $(localedir_relative_SQ)
 PERL_DEFINES += $(PERL_PATH_SQ)
 PERL_DEFINES += $(PERLLIB_EXTRA_SQ)
 PERL_DEFINES += $(perllibdir_SQ)
@@ -2311,8 +2314,6 @@  else
 PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
 endif
 
-PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-
 $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
 	$(QUIET_GEN) \
 	sed -e '1{' \
@@ -2325,7 +2326,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 \
@@ -2333,7 +2333,7 @@  GIT-PERL-DEFINES: FORCE
 		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)' && \