Skip to content

Commit 46beb55

Browse files
Johannes Sixtgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c70a8d9 commit 46beb55

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,19 +1332,19 @@ ifndef NO_TCLTK
13321332
$(MAKE) -C gitk-git install
13331333
$(MAKE) -C git-gui install
13341334
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'
13441335
ifneq (,$X)
13451336
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
13461337
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"
13481348

13491349
install-doc:
13501350
$(MAKE) -C Documentation install

0 commit comments

Comments
 (0)