Use git config file for committer name and email info
[git.git] / Makefile
index ac384c7..5e7d055 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -158,11 +158,17 @@ LIB_OBJS = \
        object.o pack-check.o patch-delta.o path.o pkt-line.o \
        quote.o read-cache.o refs.o run-command.o \
        server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
-       tag.o tree.o usage.o $(DIFF_OBJS)
+       tag.o tree.o usage.o config.o environment.o $(DIFF_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
 #
@@ -196,6 +202,7 @@ ifeq ($(uname_O),Cygwin)
        PLATFORM_DEFINES += -DUSE_SYMLINK_HEAD=0
 endif
 ifeq ($(uname_S),OpenBSD)
+       NO_STRCASESTR = YesPlease
        NEEDS_LIBICONV = YesPlease
        PLATFORM_DEFINES += -I/usr/local/include -L/usr/local/lib
 endif
@@ -203,6 +210,8 @@ ifneq (,$(findstring arm,$(uname_M)))
        ARM_SHA1 = YesPlease
 endif
 
+-include config.mak
+
 ifndef NO_CURL
        ifdef CURLDIR
                # This is still problematic -- gcc does not want -R.
@@ -235,7 +244,7 @@ ifndef NO_OPENSSL
                OPENSSL_LINK =
        endif
 else
-       DEFINES += '-DNO_OPENSSL'
+       DEFINES += -DNO_OPENSSL
        MOZILLA_SHA1 = 1
        OPENSSL_LIBSSL =
 endif
@@ -294,14 +303,14 @@ endif
 endif
 endif
 
-DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
+DEFINES += -DSHA1_HEADER=$(call shellquote,$(SHA1_HEADER))
 
 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
          $(patsubst %.perl,%,$(SCRIPT_PERL)) \
          $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
          gitk
 
-export prefix TAR INSTALL DESTDIR SHELL_PATH
+export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
 ### Build rules
 
 all: $(PROGRAMS) $(SCRIPTS)
@@ -311,7 +320,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 +329,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 +374,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 +406,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