Thread (49 messages) flat view 49 messages, 4 authors, 2016-06-15

Re: [PATCHv3 07/11] Makefile: split prefix flags from GIT-CFLAGS

From: Jeff King <hidden>
Date: 2016-06-15 22:54:09

On Wed, Jun 20, 2012 at 04:28:33PM -0500, Jonathan Nieder wrote:
Jeff King wrote:
quoted
Most of the build targets do not care about the setting of
$prefix (or its derivative variables), but will be rebuilt
if the prefix changes. For most setups this doesn't matter
(they set prefix once and never change it), but for a setup
which puts each branch or version in its own prefix, this
unnecessarily causes a full rebuild whenever the branc is
changed.
Micronit: s/branc/branch/.
The worst part is that Junio already corrected that in v1 and I didn't
propagate it into my re-roll. <sigh>
quoted
 ### Detect prefix changes
-TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):\
-             $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
-             $(localedir_SQ):$(USE_GETTEXT_SCHEME)
+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 1>&2 "    * new prefix flags"; \
+		echo "$$FLAGS" >GIT-PREFIX; \
+	fi
Hmm, nothing to do with this particular patch but the above list
includes gitexecdir and not htmldir.  Is there any particular logic
behind the list of variables?
The list came from what was in CFLAGS before. But looking at it again, I
think it is not right (e.g., git.o builds with $(htmldir_SQ), but nobody
actually depends on it). IOW, it was broken before, and I have
propagated that breakage. But nobody has noticed because they usually
set prefix and not the htmldir separately.

I probably need to go through the whole Makefile again and make sure
everything is in the list.  What a royal pain. I can't help but feel
that there is a better way to do this. GNU make supports user-defined
functions via the "call" function. Maybe we can turn this into a
single-line of Makefile per variable, and get per-variable resolution of
rebuilding, and still end up with fewer lines.

I'll take a look.
Nit: I think it would be easier to understand a name like GIT-PATHS
(making the absence of htmldir a bug, if not a particularly important
one).  No other complaints. :)
Yeah, I hate the name GIT-PREFIX. But I was worried people might
misinterpret GIT-PATHS. Maybe these should all go into a subdir full of
auto-built file magic, which will make it more obvious what they are
(and we would want to do that anyway if we start having a larger number
of them).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help