Skip to content

Commit 9fb1e69

Browse files
j6tgitster
authored andcommitted
Honor $(prefix) set in config.mak* when defining ETC_GIT*
Notice that the prefix specified for the build influenced the definitions of ETC_GITCONFIG and ETC_GITATTRIBUTES only when it was exactly '/usr'. Kacper Kornet noticed that this was furthermore only the case when the build was triggered using 'make prefix=/usr', i.e., the prefix was given on the command line; it did not work when the prefix was specified in config.mak because this file is included much later in the Makefile. To fix this, move the conditional after the inclusion of config.mak. Additionally, it is desirable to specify the etc directory for a build (for example, a build with prefix /usr/local may still want to have the system configuration in /etc/gitconfig). For this purpose, promote the variable 'sysconfdir' from a helper variable to a configuration variable. The prefix check that was moved must now be wrapped so that it does not override sysconfdir setting given in config.mak. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 410ee20 commit 9fb1e69

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ STRIP ?= strip
274274
# mandir
275275
# infodir
276276
# htmldir
277-
# ETC_GITCONFIG (but not sysconfdir)
278-
# ETC_GITATTRIBUTES
277+
# sysconfdir
279278
# can be specified as a relative path some/where/else;
280279
# this is interpreted as relative to $(prefix) and "git" at
281280
# runtime figures out where they are based on the path to the executable.
@@ -291,15 +290,8 @@ sharedir = $(prefix)/share
291290
gitwebdir = $(sharedir)/gitweb
292291
template_dir = share/git-core/templates
293292
htmldir = share/doc/git-doc
294-
ifeq ($(prefix),/usr)
295-
sysconfdir = /etc
296293
ETC_GITCONFIG = $(sysconfdir)/gitconfig
297294
ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
298-
else
299-
sysconfdir = $(prefix)/etc
300-
ETC_GITCONFIG = etc/gitconfig
301-
ETC_GITATTRIBUTES = etc/gitattributes
302-
endif
303295
lib = lib
304296
# DESTDIR=
305297
pathsep = :
@@ -1196,6 +1188,14 @@ endif
11961188
-include config.mak.autogen
11971189
-include config.mak
11981190

1191+
ifndef sysconfdir
1192+
ifeq ($(prefix),/usr)
1193+
sysconfdir = /etc
1194+
else
1195+
sysconfdir = etc
1196+
endif
1197+
endif
1198+
11991199
ifdef CHECK_HEADER_DEPENDENCIES
12001200
COMPUTE_HEADER_DEPENDENCIES =
12011201
USE_COMPUTED_HEADER_DEPENDENCIES =

0 commit comments

Comments
 (0)