]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.mk
cgit.mk: don't rebuild everything if CGIT_VERSION changes
[ps-cgit] / cgit.mk
diff --git a/cgit.mk b/cgit.mk
index 4869c5555622582fe0e086fd3b0af9f8e8c32316..c8ecd3a4b1e3b22a720a39a3ab30c94d05a4f8a3 100644 (file)
--- 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 reference CGIT_VERSION so we only rebuild its objects when the
+# version changes.
+CGIT_VERSION_OBJS := $(addprefix $(CGIT_PREFIX),cgit.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