diff options
author | John Keeping | 2013-03-06 21:22:08 +0000 |
---|---|---|
committer | Jason A. Donenfeld | 2013-03-20 21:08:32 +0100 |
commit | d6768a67093166810621d2521f10fd016bd75721 (patch) | |
tree | 8eb04db917f11a34d3910376fb9494bb0563c7fd | |
parent | 1a6feaf5fafdaec4a1adb1c0d54b95106122ede5 (diff) | |
download | cgit-d6768a67093166810621d2521f10fd016bd75721.tar.gz cgit-d6768a67093166810621d2521f10fd016bd75721.tar.bz2 cgit-d6768a67093166810621d2521f10fd016bd75721.zip |
cgit.mk: don't rebuild everything if CGIT_VERSION changes
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 and make them depend on VERSION.
Signed-off-by: John Keeping <john@keeping.me.uk>
-rw-r--r-- | cgit.mk | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -15,7 +15,6 @@ $(CGIT_PREFIX)VERSION: force-version | |||
15 | 15 | ||
16 | # CGIT_CFLAGS is a separate variable so that we can track it separately | 16 | # CGIT_CFLAGS is a separate variable so that we can track it separately |
17 | # and avoid rebuilding all of Git when these variables change. | 17 | # and avoid rebuilding all of Git when these variables change. |
18 | CGIT_CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' | ||
19 | CGIT_CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' | 18 | CGIT_CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' |
20 | CGIT_CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' | 19 | CGIT_CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' |
21 | CGIT_CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' | 20 | CGIT_CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' |
@@ -53,6 +52,14 @@ CGIT_OBJ_NAMES += vector.o | |||
53 | 52 | ||
54 | CGIT_OBJS := $(addprefix $(CGIT_PREFIX),$(CGIT_OBJ_NAMES)) | 53 | CGIT_OBJS := $(addprefix $(CGIT_PREFIX),$(CGIT_OBJ_NAMES)) |
55 | 54 | ||
55 | # Only cgit.c reference CGIT_VERSION so we only rebuild its objects when the | ||
56 | # version changes. | ||
57 | CGIT_VERSION_OBJS := $(addprefix $(CGIT_PREFIX),cgit.o) | ||
58 | $(CGIT_VERSION_OBJS): $(CGIT_PREFIX)VERSION | ||
59 | $(CGIT_VERSION_OBJS): EXTRA_CPPFLAGS = \ | ||
60 | -DCGIT_VERSION='"$(CGIT_VERSION)"' | ||
61 | |||
62 | |||
56 | ifeq ($(wildcard $(CGIT_PREFIX).depend),) | 63 | ifeq ($(wildcard $(CGIT_PREFIX).depend),) |
57 | missing_dep_dirs += $(CGIT_PREFIX).depend | 64 | missing_dep_dirs += $(CGIT_PREFIX).depend |
58 | endif | 65 | endif |