Skip to content

Commit 54dadbd

Browse files
Matt McCutchengitster
authored andcommitted
Makefile: rebuild git.o on version change, clean up git$X flags
Commit 334d28a factored out git.o as an intermediate stage between git.c and git$X. However: - It left some no-longer-relevant flags in the rule for git$X. - It failed to replace git$X with git.o in the list of files that record GIT_VERSION. This broke incorporation of a changed GIT_VERSION into git$X because, when GIT_VERSION changes, git.o isn't remade and git$X is relinked from the git.o that still contains the old GIT_VERSION. This patch removes the irrelevant flags and fixes incorporation of a changed GIT_VERSION into git$X. Signed-off-by: Matt McCutchen <hashproduct@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 52aaf64 commit 54dadbd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,7 @@ git.o: git.c common-cmds.h GIT-CFLAGS
753753
$(ALL_CFLAGS) -c $(filter %.c,$^)
754754

755755
git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
756-
$(QUIET_LINK)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
757-
$(ALL_CFLAGS) -o $@ $(filter %.c,$^) git.o \
756+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
758757
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
759758

760759
help.o: common-cmds.h
@@ -857,7 +856,7 @@ configure: configure.ac
857856
rm -f $<+
858857

859858
# These can record GIT_VERSION
860-
git$X git.spec \
859+
git.o git.spec \
861860
$(patsubst %.sh,%,$(SCRIPT_SH)) \
862861
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
863862
: GIT-VERSION-FILE

0 commit comments

Comments
 (0)