Makefile: keep "git" when bindir is execdir
authorJunio C Hamano <gitster@pobox.com>
Sat, 11 Jul 2009 03:17:33 +0000 (20:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 11 Jul 2009 03:17:33 +0000 (20:17 -0700)
For some reason there still are people who use the old style layout
to put everything in $(bindir).  The previous commit breaks the install
for them, because it tries to unconditionally remove git from execdir
and cp/ln from bindir --- oops.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile

index 311ce7d745e28af8f93dc0caade13a82fe943fb0..4be508e877cafc0eff363c8d342d7e1c7a9af6c7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1641,10 +1641,11 @@ ifneq (,$X)
 endif
        bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
        execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
-       { $(RM) "$$execdir/git$X" && \
+       { test "$$bindir/" = "$$execdir/" || \
+               { $(RM) "$$execdir/git$X" && \
                test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
                ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
-               cp "$$bindir/git$X" "$$execdir/git$X"; } && \
+               cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
        { for p in $(BUILT_INS); do \
                $(RM) "$$execdir/$$p" && \
                ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \