Git fork

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

+21 -15
+21 -15
Makefile
··· 358 358 # Among the variables below, these: 359 359 # gitexecdir 360 360 # template_dir 361 - # mandir 362 - # infodir 363 - # htmldir 364 361 # sysconfdir 365 362 # can be specified as a relative path some/where/else; 366 363 # this is interpreted as relative to $(prefix) and "git" at 367 364 # runtime figures out where they are based on the path to the executable. 365 + # Additionally, the following will be treated as relative by "git" if they 366 + # begin with "$(prefix)/": 367 + # mandir 368 + # infodir 369 + # htmldir 368 370 # This can help installing the suite in a relocatable way. 369 371 370 372 prefix = $(HOME) 371 373 bindir_relative = bin 372 374 bindir = $(prefix)/$(bindir_relative) 373 - mandir = share/man 374 - infodir = share/info 375 + mandir = $(prefix)/share/man 376 + infodir = $(prefix)/share/info 375 377 gitexecdir = libexec/git-core 376 378 mergetoolsdir = $(gitexecdir)/mergetools 377 379 sharedir = $(prefix)/share 378 380 gitwebdir = $(sharedir)/gitweb 379 381 localedir = $(sharedir)/locale 380 382 template_dir = share/git-core/templates 381 - htmldir = share/doc/git-doc 383 + htmldir = $(prefix)/share/doc/git-doc 382 384 ETC_GITCONFIG = $(sysconfdir)/gitconfig 383 385 ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes 384 386 lib = lib 385 387 # DESTDIR = 386 388 pathsep = : 389 + 390 + mandir_relative = $(patsubst $(prefix)/%,%,$(mandir)) 391 + infodir_relative = $(patsubst $(prefix)/%,%,$(infodir)) 392 + htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir)) 387 393 388 394 export prefix bindir sharedir sysconfdir gitwebdir localedir 389 395 ··· 1539 1545 DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) 1540 1546 bindir_SQ = $(subst ','\'',$(bindir)) 1541 1547 bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) 1542 - mandir_SQ = $(subst ','\'',$(mandir)) 1543 - infodir_SQ = $(subst ','\'',$(infodir)) 1548 + mandir_relative_SQ = $(subst ','\'',$(mandir_relative)) 1549 + infodir_relative_SQ = $(subst ','\'',$(infodir_relative)) 1544 1550 localedir_SQ = $(subst ','\'',$(localedir)) 1545 1551 gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) 1546 1552 template_dir_SQ = $(subst ','\'',$(template_dir)) 1547 - htmldir_SQ = $(subst ','\'',$(htmldir)) 1553 + htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative)) 1548 1554 prefix_SQ = $(subst ','\'',$(prefix)) 1549 1555 gitwebdir_SQ = $(subst ','\'',$(gitwebdir)) 1550 1556 ··· 1676 1682 1677 1683 git.sp git.s git.o: GIT-PREFIX 1678 1684 git.sp git.s git.o: EXTRA_CPPFLAGS = \ 1679 - '-DGIT_HTML_PATH="$(htmldir_SQ)"' \ 1680 - '-DGIT_MAN_PATH="$(mandir_SQ)"' \ 1681 - '-DGIT_INFO_PATH="$(infodir_SQ)"' 1685 + '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \ 1686 + '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \ 1687 + '-DGIT_INFO_PATH="$(infodir_relative_SQ)"' 1682 1688 1683 1689 git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS) 1684 1690 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \ ··· 1688 1694 1689 1695 builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX 1690 1696 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \ 1691 - '-DGIT_HTML_PATH="$(htmldir_SQ)"' \ 1692 - '-DGIT_MAN_PATH="$(mandir_SQ)"' \ 1693 - '-DGIT_INFO_PATH="$(infodir_SQ)"' 1697 + '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \ 1698 + '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \ 1699 + '-DGIT_INFO_PATH="$(infodir_relative_SQ)"' 1694 1700 1695 1701 version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT 1696 1702 version.sp version.s version.o: EXTRA_CPPFLAGS = \