Makefile: make mandir, htmldir and infodir absolute

This matches the use of the variables with the same names in autotools, reducing the potential for user surprise. Using relative paths in these variables also causes issues if they are exported from the Makefile, as discussed in commit c09d62f (Makefile: do not export mandir/htmldir/infodir, 2013-02-12). Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Keeping committed Feb 24, 2013 at 19:55 UTC 971f85388f958f5e1b6ceac9973813102ed5a499
1 file changed +21 -15
Makefile
+21 -15
@@ -354,33 +354,39 @@ STRIP ?= strip
354 # Among the variables below, these:
355 # gitexecdir
356 # template_dir
357 -# mandir
358 -# infodir
359 -# htmldir
357 # sysconfdir
358 # can be specified as a relative path some/where/else;
359 # this is interpreted as relative to $(prefix) and "git" at
360 # runtime figures out where they are based on the path to the executable.
361 +# Additionally, the following will be treated as relative by "git" if they
362 +# begin with "$(prefix)/":
363 +# mandir
364 +# infodir
365 +# htmldir
366 # This can help installing the suite in a relocatable way.
367
368 prefix = $(HOME)
369 bindir_relative = bin
370 bindir = $(prefix)/$(bindir_relative)
369 -mandir = share/man
370 -infodir = share/info
371 +mandir = $(prefix)/share/man
372 +infodir = $(prefix)/share/info
373 gitexecdir = libexec/git-core
374 mergetoolsdir = $(gitexecdir)/mergetools
375 sharedir = $(prefix)/share
376 gitwebdir = $(sharedir)/gitweb
377 localedir = $(sharedir)/locale
378 template_dir = share/git-core/templates
377 -htmldir = share/doc/git-doc
379 +htmldir = $(prefix)/share/doc/git-doc
380 ETC_GITCONFIG = $(sysconfdir)/gitconfig
381 ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
382 lib = lib
383 # DESTDIR =
384 pathsep = :
385
386 +mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
387 +infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
388 +htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
389 +
390 export prefix bindir sharedir sysconfdir gitwebdir localedir
391
392 CC = cc
@@ -1999,12 +2005,12 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
2005 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
2006 bindir_SQ = $(subst ','\'',$(bindir))
2007 bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
2002 -mandir_SQ = $(subst ','\'',$(mandir))
2003 -infodir_SQ = $(subst ','\'',$(infodir))
2008 +mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
2009 +infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
2010 localedir_SQ = $(subst ','\'',$(localedir))
2011 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
2012 template_dir_SQ = $(subst ','\'',$(template_dir))
2007 -htmldir_SQ = $(subst ','\'',$(htmldir))
2013 +htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
2014 prefix_SQ = $(subst ','\'',$(prefix))
2015 gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
2016
@@ -2136,9 +2142,9 @@ strip: $(PROGRAMS) git$X
2142
2143 git.sp git.s git.o: GIT-PREFIX
2144 git.sp git.s git.o: EXTRA_CPPFLAGS = \
2139 - '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
2140 - '-DGIT_MAN_PATH="$(mandir_SQ)"' \
2141 - '-DGIT_INFO_PATH="$(infodir_SQ)"'
2145 + '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2146 + '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2147 + '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
2148
2149 git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
2150 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
@@ -2148,9 +2154,9 @@ help.sp help.s help.o: common-cmds.h
2154
2155 builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX
2156 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
2151 - '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
2152 - '-DGIT_MAN_PATH="$(mandir_SQ)"' \
2153 - '-DGIT_INFO_PATH="$(infodir_SQ)"'
2157 + '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2158 + '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2159 + '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
2160
2161 version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
2162 version.sp version.s version.o: EXTRA_CPPFLAGS = \