aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-10 13:50:01 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-10 13:51:52 -0700
commit4769948afe7c502d37746edc2ee2c084c9dcb325 (patch)
treecb6045a7e6dc192bfce076ed8c1bab3795822b5d
parentd5b0c9ea178dab3599674ccff50645c0464b8c31 (diff)
downloadgit-4769948afe7c502d37746edc2ee2c084c9dcb325.tar.gz
git-4769948afe7c502d37746edc2ee2c084c9dcb325.tar.xz
Deal with $(bindir) and friends with whitespaces.
... using HPA's shellquote macro. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--Makefile34
-rwxr-xr-xgit-merge-recursive.py2
-rw-r--r--t/Makefile8
-rw-r--r--templates/Makefile10
4 files changed, 36 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index ac384c7dc..f7eee4708 100644
--- a/Makefile
+++ b/Makefile
@@ -163,6 +163,12 @@ LIB_OBJS = \
LIBS = $(LIB_FILE)
LIBS += -lz
+# Shell quote;
+# Result of this needs to be placed inside ''
+shq = $(subst ','\'',$(1))
+# This has surrounding ''
+shellquote = '$(call shq,$(1))'
+
#
# Platform specific tweaks
#
@@ -235,7 +241,7 @@ ifndef NO_OPENSSL
OPENSSL_LINK =
endif
else
- DEFINES += '-DNO_OPENSSL'
+ DEFINES += -DNO_OPENSSL
MOZILLA_SHA1 = 1
OPENSSL_LIBSSL =
endif
@@ -294,7 +300,7 @@ endif
endif
endif
-DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
+DEFINES += -DSHA1_HEADER=$(call shellquote,$(SHA1_HEADER))
SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
@@ -311,7 +317,7 @@ all:
git: git.sh Makefile
rm -f $@+ $@
- sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
+ sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@X@@/$(X)/g' \
$(GIT_LIST_TWEAK) <$@.sh >$@+
@@ -320,22 +326,22 @@ git: git.sh Makefile
$(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
rm -f $@
- sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
+ sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.sh >$@
chmod +x $@
$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
rm -f $@
- sed -e '1s|#!.*perl|#!$(PERL_PATH)|' \
+ sed -e '1s|#!.*perl|#!$(call shq,$(PERL_PATH))|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.perl >$@
chmod +x $@
$(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
rm -f $@
- sed -e '1s|#!.*python|#!$(PYTHON_PATH)|' \
- -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \
+ sed -e '1s|#!.*python|#!$(call shq,$(PYTHON_PATH))|' \
+ -e 's|@@GIT_PYTHON_PATH@@|$(call shq,$(GIT_PYTHON_DIR))|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.py >$@
chmod +x $@
@@ -365,7 +371,7 @@ git-rev-list$X: LIBS += $(OPENSSL_LIBSSL)
init-db.o: init-db.c
$(CC) -c $(ALL_CFLAGS) \
- -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c
+ -DDEFAULT_GIT_TEMPLATE_DIR=$(call shellquote,"$(template_dir)") $*.c
$(LIB_OBJS): $(LIB_H)
$(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H)
@@ -397,13 +403,13 @@ check:
### Installation rules
install: $(PROGRAMS) $(SCRIPTS)
- $(INSTALL) -d -m755 $(DESTDIR)$(bindir)
- $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
- $(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
- sh ./cmd-rename.sh $(DESTDIR)$(bindir)
+ $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(bindir))
+ $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(call shellquote,$(DESTDIR)$(bindir))
+ $(INSTALL) git-revert $(call shellquote,$(DESTDIR)$(bindir)/git-cherry-pick)
+ sh ./cmd-rename.sh $(call shellquote,$(DESTDIR)$(bindir))
$(MAKE) -C templates install
- $(INSTALL) -d -m755 $(DESTDIR)$(GIT_PYTHON_DIR)
- $(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR)
+ $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
+ $(INSTALL) $(PYMODULES) $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
install-doc:
$(MAKE) -C Documentation install
diff --git a/git-merge-recursive.py b/git-merge-recursive.py
index b80a86035..626d85493 100755
--- a/git-merge-recursive.py
+++ b/git-merge-recursive.py
@@ -4,7 +4,7 @@ import sys, math, random, os, re, signal, tempfile, stat, errno, traceback
from heapq import heappush, heappop
from sets import Set
-sys.path.append('@@GIT_PYTHON_PATH@@')
+sys.path.append('''@@GIT_PYTHON_PATH@@''')
from gitMergeCommon import *
originalIndexFile = os.environ.get('GIT_INDEX_FILE',
diff --git a/t/Makefile b/t/Makefile
index e71da7782..5c76afff8 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -7,10 +7,16 @@
SHELL_PATH ?= $(SHELL)
TAR ?= $(TAR)
+# Shell quote;
+# Result of this needs to be placed inside ''
+shq = $(subst ','\'',$(1))
+# This has surrounding ''
+shellquote = '$(call shq,$(1))'
+
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
all:
- @$(foreach t,$T,echo "*** $t ***"; $(SHELL_PATH) $t $(GIT_TEST_OPTS) || exit; )
+ @$(foreach t,$T,echo "*** $t ***"; $(call shellquote,$(SHELL_PATH)) $t $(GIT_TEST_OPTS) || exit; )
@rm -fr trash
clean:
diff --git a/templates/Makefile b/templates/Makefile
index c23aee866..07e928e56 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -6,6 +6,12 @@ prefix ?= $(HOME)
template_dir ?= $(prefix)/share/git-core/templates/
# DESTDIR=
+# Shell quote;
+# Result of this needs to be placed inside ''
+shq = $(subst ','\'',$(1))
+# This has surrounding ''
+shellquote = '$(call shq,$(1))'
+
all: boilerplates.made custom
find blt
@@ -38,6 +44,6 @@ clean:
rm -rf blt boilerplates.made
install: all
- $(INSTALL) -d -m755 $(DESTDIR)$(template_dir)
+ $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(template_dir))
(cd blt && $(TAR) cf - .) | \
- (cd $(DESTDIR)$(template_dir) && $(TAR) xf -)
+ (cd $(call shellquote,$(DESTDIR)$(template_dir)) && $(TAR) xf -)