From mboxrd@z Thu Jan 1 00:00:00 1970 From: jamie.couture at gmail.com (Jamie Couture) Date: Wed, 6 Mar 2013 09:59:34 -0500 Subject: [PATCH v2 2/2] cgit.mk: don't rebuild everything if CGIT_VERSION changes In-Reply-To: <41530884659726413fc212cdf204cc2a34bb67d1.1362525063.git.john@keeping.me.uk> References: <8db36564afeacd1c9e49f5752c0de3903c649430.1362525063.git.john@keeping.me.uk> <41530884659726413fc212cdf204cc2a34bb67d1.1362525063.git.john@keeping.me.uk> Message-ID: <20130306145934.GB16478@neptune> On Tue, Mar 05, 2013 at 11:12:53PM +0000, John Keeping wrote: > If CGIT_VERSION is in CGIT_CFLAGS then a change in version (for example > because you have committed your changes) causes all of the CGit objects > to be rebuilt. Avoid this by using EXTRA_CPPFLAGS to add the version > for only those files that are affected. > > Signed-off-by: John Keeping > --- > cgit.mk | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/cgit.mk b/cgit.mk > index 4869c55..640bf57 100644 > --- a/cgit.mk > +++ b/cgit.mk > @@ -15,7 +15,6 @@ $(CGIT_PREFIX)VERSION: force-version > > # CGIT_CFLAGS is a separate variable so that we can track it separately > # and avoid rebuilding all of Git when these variables change. > -CGIT_CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' > CGIT_CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' > CGIT_CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' > CGIT_CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' > @@ -53,6 +52,14 @@ CGIT_OBJ_NAMES += vector.o > > CGIT_OBJS := $(addprefix $(CGIT_PREFIX),$(CGIT_OBJ_NAMES)) > > +# Only cgit.c and ui-patch.c reference CGIT_VERSION so we only rebuild > +# their objects when the version changes. > +CGIT_VERSION_OBJS := $(addprefix $(CGIT_PREFIX),cgit.o ui-patch.o) > +$(CGIT_VERSION_OBJS): $(CGIT_PREFIX)VERSION > +$(CGIT_VERSION_OBJS): EXTRA_CPPFLAGS = \ > + -DCGIT_VERSION='"$(CGIT_VERSION)"' > + > + > ifeq ($(wildcard $(CGIT_PREFIX).depend),) > missing_dep_dirs += $(CGIT_PREFIX).depend > endif > -- > 1.8.2.rc2.4.g7799588 > > > _______________________________________________ > cgit mailing list > cgit at hjemli.net > http://hjemli.net/mailman/listinfo/cgit Acked-by: Jamie Couture