Subject: Re: [PATCH 1/2] Makefile: use "find" to determine static header dependencies

From: Jonathan Nieder <[email-masked]>
Date: Thu, 21 Aug 2014 07:48:18 -0700

Hi,

Jeff King wrote:

> However, we do always define $(LIB_H) as a dependency of
> po/git.pot. Even though we do not actually try to build that
> target, make will still evaluate the dependencies when
> reading the Makefile, and expand the variable. This is not
> ideal

Would the following work?  The current dependencies for po/git.pot are
not correct anyway --- they include LOCALIZED_C but not LOCALIZED_SH
or LOCALIZED_PERL, so someone hacking on shell scripts and then trying
'make po/git.pot' could end up with the pot file not being
regenerated.

-- >8 --
Subject: i18n: treat "make pot" as an explicitly-invoked target

po/git.pot is normally used as-is and not regenerated by people
building git, so it is okay if an explicit "make po/git.pot" always
automatically regenerates it.  Depend on the magic FORCE target
instead of explicitly keeping track of dependencies.

This simplifies the makefile, in particular preparing for a moment
when $(LIB_H), which is part of $(LOCALIZED_C), can be computed on the
fly.

We still need a dependency on GENERATED_H, to force those files to be
built when regenerating git.pot.

Signed-off-by: Jonathan Nieder <[email-masked]>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 2320de5..cf0ccdf 100644
--- a/Makefile
+++ b/Makefile
@@ -2138,7 +2138,7 @@ LOCALIZED_SH += t/t0200/test.sh
 LOCALIZED_PERL += t/t0200/test.perl
 endif
 
-po/git.pot: $(LOCALIZED_C)
+po/git.pot: $(GENERATED_H) FORCE
 	$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
 	$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
 		$(LOCALIZED_SH)
--