Browse Source

Merge branch 'jk/common-make-variables-export-safety'

Make the three variables safer to be exported to submakes by
ensuring that they are full paths so that they can be used as
installation location.

* jk/common-make-variables-export-safety:
  Makefile: make mandir, htmldir and infodir absolute
maint
Junio C Hamano 12 years ago
parent
commit
e81890548c
  1. 36
      Makefile

36
Makefile

@ -358,33 +358,39 @@ STRIP ?= strip
# Among the variables below, these: # Among the variables below, these:
# gitexecdir # gitexecdir
# template_dir # template_dir
# mandir
# infodir
# htmldir
# sysconfdir # sysconfdir
# can be specified as a relative path some/where/else; # can be specified as a relative path some/where/else;
# this is interpreted as relative to $(prefix) and "git" at # this is interpreted as relative to $(prefix) and "git" at
# runtime figures out where they are based on the path to the executable. # runtime figures out where they are based on the path to the executable.
# Additionally, the following will be treated as relative by "git" if they
# begin with "$(prefix)/":
# mandir
# infodir
# htmldir
# This can help installing the suite in a relocatable way. # This can help installing the suite in a relocatable way.


prefix = $(HOME) prefix = $(HOME)
bindir_relative = bin bindir_relative = bin
bindir = $(prefix)/$(bindir_relative) bindir = $(prefix)/$(bindir_relative)
mandir = share/man mandir = $(prefix)/share/man
infodir = share/info infodir = $(prefix)/share/info
gitexecdir = libexec/git-core gitexecdir = libexec/git-core
mergetoolsdir = $(gitexecdir)/mergetools mergetoolsdir = $(gitexecdir)/mergetools
sharedir = $(prefix)/share sharedir = $(prefix)/share
gitwebdir = $(sharedir)/gitweb gitwebdir = $(sharedir)/gitweb
localedir = $(sharedir)/locale localedir = $(sharedir)/locale
template_dir = share/git-core/templates template_dir = share/git-core/templates
htmldir = share/doc/git-doc htmldir = $(prefix)/share/doc/git-doc
ETC_GITCONFIG = $(sysconfdir)/gitconfig ETC_GITCONFIG = $(sysconfdir)/gitconfig
ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
lib = lib lib = lib
# DESTDIR = # DESTDIR =
pathsep = : pathsep = :


mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))

export prefix bindir sharedir sysconfdir gitwebdir localedir export prefix bindir sharedir sysconfdir gitwebdir localedir


CC = cc CC = cc
@ -1539,12 +1545,12 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
bindir_SQ = $(subst ','\'',$(bindir)) bindir_SQ = $(subst ','\'',$(bindir))
bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
mandir_SQ = $(subst ','\'',$(mandir)) mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
infodir_SQ = $(subst ','\'',$(infodir)) infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
localedir_SQ = $(subst ','\'',$(localedir)) localedir_SQ = $(subst ','\'',$(localedir))
gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
template_dir_SQ = $(subst ','\'',$(template_dir)) template_dir_SQ = $(subst ','\'',$(template_dir))
htmldir_SQ = $(subst ','\'',$(htmldir)) htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
prefix_SQ = $(subst ','\'',$(prefix)) prefix_SQ = $(subst ','\'',$(prefix))
gitwebdir_SQ = $(subst ','\'',$(gitwebdir)) gitwebdir_SQ = $(subst ','\'',$(gitwebdir))


@ -1676,9 +1682,9 @@ strip: $(PROGRAMS) git$X


git.sp git.s git.o: GIT-PREFIX git.sp git.s git.o: GIT-PREFIX
git.sp git.s git.o: EXTRA_CPPFLAGS = \ git.sp git.s git.o: EXTRA_CPPFLAGS = \
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \ '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
'-DGIT_MAN_PATH="$(mandir_SQ)"' \ '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
'-DGIT_INFO_PATH="$(infodir_SQ)"' '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'


git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS) git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \ $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
@ -1688,9 +1694,9 @@ help.sp help.s help.o: common-cmds.h


builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX
builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \ '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
'-DGIT_MAN_PATH="$(mandir_SQ)"' \ '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
'-DGIT_INFO_PATH="$(infodir_SQ)"' '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'


version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
version.sp version.s version.o: EXTRA_CPPFLAGS = \ version.sp version.s version.o: EXTRA_CPPFLAGS = \

Loading…
Cancel
Save