@@ -182,28 +182,32 @@ STRIP ?= strip
182182# Among the variables below, these:
183183# gitexecdir
184184# template_dir
185+ # mandir
186+ # infodir
185187# htmldir
186188# ETC_GITCONFIG (but not sysconfdir)
187- # can be specified as a relative path ../ some/where/else (which must begin
188- # with ../); this is interpreted as relative to $(bindir ) and "git" at
189+ # can be specified as a relative path some/where/else;
190+ # this is interpreted as relative to $(prefix ) and "git" at
189191# runtime figures out where they are based on the path to the executable.
190192# This can help installing the suite in a relocatable way.
191193
192194prefix = $(HOME )
193- bindir = $(prefix ) /bin
194- mandir = $(prefix ) /share/man
195- infodir = $(prefix ) /share/info
196- gitexecdir = $(prefix ) /libexec/git-core
195+ bindir_relative = bin
196+ bindir = $(prefix ) /$(bindir_relative )
197+ mandir = share/man
198+ infodir = share/info
199+ gitexecdir = libexec/git-core
197200sharedir = $(prefix ) /share
198- template_dir = $( sharedir ) /git-core/templates
199- htmldir = $( sharedir ) /doc/git-doc
201+ template_dir = share /git-core/templates
202+ htmldir = share /doc/git-doc
200203ifeq ($(prefix ) ,/usr)
201204sysconfdir = /etc
205+ ETC_GITCONFIG = $(sysconfdir ) /gitconfig
202206else
203207sysconfdir = $(prefix ) /etc
208+ ETC_GITCONFIG = etc/gitconfig
204209endif
205210lib = lib
206- ETC_GITCONFIG = $(sysconfdir ) /gitconfig
207211# DESTDIR=
208212
209213# default configuration for gitweb
@@ -790,6 +794,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
790794 SNPRINTF_RETURNS_BOGUS = YesPlease
791795 NO_SVN_TESTS = YesPlease
792796 NO_PERL_MAKEMAKER = YesPlease
797+ RUNTIME_PREFIX = YesPlease
793798 NO_POSIX_ONLY_PROGRAMS = YesPlease
794799 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
795800 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
@@ -798,9 +803,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
798803 COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
799804 EXTLIBS += -lws2_32
800805 X = .exe
801- gitexecdir = ../libexec/git-core
802- template_dir = ../share/git-core/templates/
803- ETC_GITCONFIG = ../etc/gitconfig
804806endif
805807ifneq (,$(findstring arm,$(uname_M ) ) )
806808 ARM_SHA1 = YesPlease
@@ -1038,6 +1040,9 @@ ifdef INTERNAL_QSORT
10381040 COMPAT_CFLAGS += -DINTERNAL_QSORT
10391041 COMPAT_OBJS += compat/qsort.o
10401042endif
1043+ ifdef RUNTIME_PREFIX
1044+ COMPAT_CFLAGS += -DRUNTIME_PREFIX
1045+ endif
10411046
10421047ifdef NO_PTHREADS
10431048 THREADED_DELTA_SEARCH =
@@ -1097,6 +1102,7 @@ ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
10971102
10981103DESTDIR_SQ = $(subst ','\'',$(DESTDIR ) )
10991104bindir_SQ = $(subst ','\'',$(bindir ) )
1105+ bindir_relative_SQ = $(subst ','\'',$(bindir_relative ) )
11001106mandir_SQ = $(subst ','\'',$(mandir ) )
11011107infodir_SQ = $(subst ','\'',$(infodir ) )
11021108gitexecdir_SQ = $(subst ','\'',$(gitexecdir ) )
@@ -1262,7 +1268,12 @@ git.o git.spec \
12621268 $(QUIET_CC )$(CC ) -o $* .o -c $(ALL_CFLAGS ) $<
12631269
12641270exec_cmd.o : exec_cmd.c GIT-CFLAGS
1265- $(QUIET_CC )$(CC ) -o $* .o -c $(ALL_CFLAGS ) ' -DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
1271+ $(QUIET_CC )$(CC ) -o $* .o -c $(ALL_CFLAGS ) \
1272+ ' -DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
1273+ ' -DBINDIR="$(bindir_relative_SQ)"' \
1274+ ' -DPREFIX="$(prefix_SQ)"' \
1275+ $<
1276+
12661277builtin-init-db.o : builtin-init-db.c GIT-CFLAGS
12671278 $(QUIET_CC )$(CC ) -o $* .o -c $(ALL_CFLAGS ) -DDEFAULT_GIT_TEMPLATE_DIR=' "$(template_dir_SQ)"' $<
12681279
@@ -1422,17 +1433,17 @@ remove-dashes:
14221433
14231434# ## Installation rules
14241435
1425- ifeq ($(firstword $(subst /, ,$(template_dir ) ) ) ,..)
1426- template_instdir = $(bindir ) /$(template_dir )
1427- else
1436+ ifeq ($(abspath $(template_dir ) ) ,$(template_dir ) )
14281437template_instdir = $(template_dir )
1438+ else
1439+ template_instdir = $(prefix ) /$(template_dir )
14291440endif
14301441export template_instdir
14311442
1432- ifeq ($(firstword $(subst /, ,$(gitexecdir ) ) ) ,..)
1433- gitexec_instdir = $(bindir ) /$(gitexecdir )
1434- else
1443+ ifeq ($(abspath $(gitexecdir ) ) ,$(gitexecdir ) )
14351444gitexec_instdir = $(gitexecdir )
1445+ else
1446+ gitexec_instdir = $(prefix ) /$(gitexecdir )
14361447endif
14371448gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir ) )
14381449export gitexec_instdir
0 commit comments