summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-02-01 01:43:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-01 01:43:59 (GMT)
commited096c4a23476810831e12d2e9227403c21bd774 (patch)
tree7a5173cf1d2eed820f92a4e30e85713c0352e55b /Makefile
parentfa5bc8abb35e34f673c41cb5c66d0a2f21536861 (diff)
parent25655221745fd27d5da3bda7ad0fe49f2005d776 (diff)
downloadgit-ed096c4a23476810831e12d2e9227403c21bd774.zip
git-ed096c4a23476810831e12d2e9227403c21bd774.tar.gz
git-ed096c4a23476810831e12d2e9227403c21bd774.tar.bz2
Merge branch 'sp/runtime-prefix'
* sp/runtime-prefix: Windows: Revert to default paths and convert them by RUNTIME_PREFIX Compute prefix at runtime if RUNTIME_PREFIX is set Modify setup_path() to only add git_exec_path() to PATH Add calls to git_extract_argv0_path() in programs that call git_config_* git_extract_argv0_path(): Move check for valid argv0 from caller to callee Refactor git_set_argv0_path() to git_extract_argv0_path() Move computation of absolute paths from Makefile to runtime (in preparation for RUNTIME_PREFIX)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile49
1 files changed, 30 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index d10895f..9f3a8ab 100644
--- a/Makefile
+++ b/Makefile
@@ -182,28 +182,32 @@ STRIP ?= strip
# Among the variables below, these:
# gitexecdir
# template_dir
+# mandir
+# infodir
# htmldir
# ETC_GITCONFIG (but not sysconfdir)
-# can be specified as a relative path ../some/where/else (which must begin
-# with ../); this is interpreted as relative to $(bindir) and "git" at
+# can be specified as a relative path some/where/else;
+# this is interpreted as relative to $(prefix) and "git" at
# runtime figures out where they are based on the path to the executable.
# This can help installing the suite in a relocatable way.
prefix = $(HOME)
-bindir = $(prefix)/bin
-mandir = $(prefix)/share/man
-infodir = $(prefix)/share/info
-gitexecdir = $(prefix)/libexec/git-core
+bindir_relative = bin
+bindir = $(prefix)/$(bindir_relative)
+mandir = share/man
+infodir = share/info
+gitexecdir = libexec/git-core
sharedir = $(prefix)/share
-template_dir = $(sharedir)/git-core/templates
-htmldir=$(sharedir)/doc/git-doc
+template_dir = share/git-core/templates
+htmldir = share/doc/git-doc
ifeq ($(prefix),/usr)
sysconfdir = /etc
+ETC_GITCONFIG = $(sysconfdir)/gitconfig
else
sysconfdir = $(prefix)/etc
+ETC_GITCONFIG = etc/gitconfig
endif
lib = lib
-ETC_GITCONFIG = $(sysconfdir)/gitconfig
# DESTDIR=
# default configuration for gitweb
@@ -790,6 +794,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
SNPRINTF_RETURNS_BOGUS = YesPlease
NO_SVN_TESTS = YesPlease
NO_PERL_MAKEMAKER = YesPlease
+ RUNTIME_PREFIX = YesPlease
NO_POSIX_ONLY_PROGRAMS = YesPlease
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
@@ -798,9 +803,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
EXTLIBS += -lws2_32
X = .exe
- gitexecdir = ../libexec/git-core
- template_dir = ../share/git-core/templates/
- ETC_GITCONFIG = ../etc/gitconfig
endif
ifneq (,$(findstring arm,$(uname_M)))
ARM_SHA1 = YesPlease
@@ -1038,6 +1040,9 @@ ifdef INTERNAL_QSORT
COMPAT_CFLAGS += -DINTERNAL_QSORT
COMPAT_OBJS += compat/qsort.o
endif
+ifdef RUNTIME_PREFIX
+ COMPAT_CFLAGS += -DRUNTIME_PREFIX
+endif
ifdef NO_PTHREADS
THREADED_DELTA_SEARCH =
@@ -1097,6 +1102,7 @@ ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
bindir_SQ = $(subst ','\'',$(bindir))
+bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
mandir_SQ = $(subst ','\'',$(mandir))
infodir_SQ = $(subst ','\'',$(infodir))
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
@@ -1262,7 +1268,12 @@ git.o git.spec \
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
exec_cmd.o: exec_cmd.c GIT-CFLAGS
- $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
+ $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
+ '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
+ '-DBINDIR="$(bindir_relative_SQ)"' \
+ '-DPREFIX="$(prefix_SQ)"' \
+ $<
+
builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
@@ -1422,17 +1433,17 @@ remove-dashes:
### Installation rules
-ifeq ($(firstword $(subst /, ,$(template_dir))),..)
-template_instdir = $(bindir)/$(template_dir)
-else
+ifeq ($(abspath $(template_dir)),$(template_dir))
template_instdir = $(template_dir)
+else
+template_instdir = $(prefix)/$(template_dir)
endif
export template_instdir
-ifeq ($(firstword $(subst /, ,$(gitexecdir))),..)
-gitexec_instdir = $(bindir)/$(gitexecdir)
-else
+ifeq ($(abspath $(gitexecdir)),$(gitexecdir))
gitexec_instdir = $(gitexecdir)
+else
+gitexec_instdir = $(prefix)/$(gitexecdir)
endif
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
export gitexec_instdir