From: Jeff King Date: Wed, 05 Feb 2014 17:53:16 GMT Subject: [PATCH 07/13] Makefile: always create files via make-var Message-ID: <20140205175316.GG15218@sigill.intra.peff.net> In-Reply-To: <20140205174823.GA15070@sigill.intra.peff.net> If we are trying to store an empty sentinel value for a make-var, we would consider a missing file the same as an empty variable. E.g., repeatedly running: make GIT_USER_AGENT= will not create MAKE/USER-AGENT at all if it does not exist, and subsequent make invocations will force a rebuild. This is not generally a problem in practice, since most of the files always have some boilerplate (even LDFLAGS, because it is formed with "+=", will have a stray space in it). But this does fix the rare case, and future-proofs us as we add more similar variables. Signed-off-by: Jeff King --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7fecdf1..e12039f 100644 --- a/Makefile +++ b/Makefile @@ -1569,7 +1569,7 @@ endif define make-var MAKE/$1: FORCE @VALUE='$$(subst ','\'',$3)'; \ - if test x"$$$$VALUE" != x"`cat $$@ 2>/dev/null`"; then \ + if ! test -e $$@ || test x"$$$$VALUE" != x"`cat $$@`"; then \ echo >&2 " * new $2"; \ printf '%s\n' "$$$$VALUE" >$$@+ && \ mv $$@+ $$@; \ -- 1.8.5.2.500.g8060133