Browse Source

Deal with $(bindir) and friends with whitespaces.

... using HPA's shellquote macro.

Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Junio C Hamano 20 years ago
parent
commit
4769948afe
  1. 34
      Makefile
  2. 2
      git-merge-recursive.py
  3. 8
      t/Makefile
  4. 10
      templates/Makefile

34
Makefile

@ -163,6 +163,12 @@ LIB_OBJS = \ @@ -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 @@ -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 @@ -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: @@ -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 @@ -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) @@ -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: @@ -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

2
git-merge-recursive.py

@ -4,7 +4,7 @@ import sys, math, random, os, re, signal, tempfile, stat, errno, traceback @@ -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',

8
t/Makefile

@ -7,10 +7,16 @@ @@ -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:

10
templates/Makefile

@ -6,6 +6,12 @@ prefix ?= $(HOME) @@ -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: @@ -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 -)

Loading…
Cancel
Save