@matheusbsbs / matheus-bagliano / commits / 46beb55988
Fork 0

Makefile: Normalize $(bindir) and $(gitexecdir) before comparing

The install target needs to check whether the user has opted to make $(gitexecdir) equal to $(bindir). It did so by a straight string comparison. Since we are going to allow a relative $(gitexecdir), we have to normalize paths before comparison, which we do with $(cd there && pwd). The normalized paths are stored in shell variables. These we can now reuse in the subsequent install statements, which conveniently shortens the lines a bit. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Jul 21, 2008 at 21:19 UTC 46beb55988e68da04c2e9d319c71b9b940f0854c
1 file changed +10 -10
Makefile
+10 -10
@@ -1332,19 +1332,19 @@ ifndef NO_TCLTK
1332 $(MAKE) -C gitk-git install
1333 $(MAKE) -C git-gui install
1334 endif
1335 - if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
1336 - then \
1337 - ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
1338 - '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' || \
1339 - cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
1340 - '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \
1341 - fi
1342 - $(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
1343 - $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'
1335 ifneq (,$X)
1336 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
1337 endif
1347 - ./check_bindir 'z$(bindir_SQ)' 'z$(gitexecdir_SQ)' '$(DESTDIR_SQ)$(bindir_SQ)/git-shell$X'
1338 + bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
1339 + execdir=$$(cd '$(DESTDIR_SQ)$(gitexecdir_SQ)' && pwd) && \
1340 + if test "z$$bindir" != "z$$execdir"; \
1341 + then \
1342 + ln -f "$$bindir/git$X" "$$execdir/git$X" || \
1343 + cp "$$bindir/git$X" "$$execdir/git$X"; \
1344 + fi && \
1345 + { $(foreach p,$(BUILT_INS), $(RM) "$$execdir/$p" && ln "$$execdir/git$X" "$$execdir/$p" ;) } && \
1346 + $(RM) "$$execdir/git$X" && \
1347 + ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-shell$X"
1348
1349 install-doc:
1350 $(MAKE) -C Documentation install