threads / patch / 8784

patchMakefile: USE_SYMLINK option

Subject: [PATCH] Makefile: USE_SYMLINK option

## tl;dr

2 messages between Jun 30, 2007 and Jun 30, 2007. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Matthias Lederhofer· Jun 30, 2007, 18:14 UTC · lore
When USE_SYMLINK is defined symlinks will be used instead of hardlinks.
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
I found no real drawback using symlinks and symlinks are sometimes
more practical, for example when copying/creating a tarball of the
installation.
---
 Makefile |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
Show changes to Makefile +13 −4
diff --git a/Makefile b/Makefile
index 4ea5e45..db0b818 100644
--- a/Makefile
+++ b/Makefile
@@ -181,6 +181,11 @@ INSTALL = install
 RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
+ifdef USE_SYMLINK
+LN = ln -s
+else
+LN = ln
+endif
 
 export TCL_PATH TCLTK_PATH
 
@@ -759,10 +764,10 @@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
 help.o: common-cmds.h
 
 git-merge-subtree$X: git-merge-recursive$X
-	$(QUIET_BUILT_IN)rm -f $@ && ln git-merge-recursive$X $@
+	$(QUIET_BUILT_IN)rm -f $@ && $(LN) git-merge-recursive$X $@
 
 $(BUILT_INS): git$X
-	$(QUIET_BUILT_IN)rm -f $@ && ln git$X $@
+	$(QUIET_BUILT_IN)rm -f $@ && $(LN) git$X $@
 
 common-cmds.h: ./generate-cmdlist.sh
 
@@ -1004,12 +1009,16 @@ ifndef NO_TCLTK
 endif
 	if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
 	then \
-		ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
+		$(LN) -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
 			'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' || \
 		cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
 			'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \
 	fi
-	$(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
+ifdef USE_SYMLINK
+	$(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && $(LN) 'git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
+else
+	$(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && $(LN) '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
+endif
 ifneq (,$X)
 	$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
 endif
-- 
1.5.0.3
Junio C Hamano· Jun 30, 2007, 18:46 UTC · re: Matthias Lederhofer · lore

Re: [PATCH] Makefile: USE_SYMLINK option

Matthias Lederhofer <matled@gmx.net> writes:
> I found no real drawback using symlinks and symlinks are sometimes
> more practical, for example when copying/creating a tarball of the
> installation.

Well, tar handles hard links just fine, thanks. The real drawbacks of doing symlinks people often cite (and I agree to) are that they can become dangling, and they consume i-nodes.

← back to recent threads