@matheusbsbs / matheus-bagliano / commits / 0c0ead7e79
Fork 0

Makefile: fix misdetection of relative pathnames

The installation rules wanted to differentiate between a template_dir that is given as an absolute path (e.g. /usr/share/git-core/templates) and a relative one (e.g. share/git-core/templates) but it was done by checking if $(abspath $(template_dir)) and $(template_dir) yield the same string. This was wrong in at least two ways. * The user can give template_dir with a trailing slash from the command line to invoke make or from the included config.mak. A directory path ought to mean the same thing with or without such a trailing slash but use of $(abspath) means an absolute path with a trailing slash fails the test. * Versions of GNU make older than 3.81 do not have $(abspath) to begin with. This changes the detection logic to see if the given path begins with a slash. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Feb 5, 2009 at 00:04 UTC 0c0ead7e79559013d6f9eea6f7e55d1845c11171
1 file changed +2 -2
Makefile
+2 -2
@@ -1434,14 +1434,14 @@ remove-dashes:
1434
1435 ### Installation rules
1436
1437 -ifeq ($(abspath $(template_dir)),$(template_dir))
1437 +ifneq ($(filter /%,$(firstword $(template_dir))),)
1438 template_instdir = $(template_dir)
1439 else
1440 template_instdir = $(prefix)/$(template_dir)
1441 endif
1442 export template_instdir
1443
1444 -ifeq ($(abspath $(gitexecdir)),$(gitexecdir))
1444 +ifneq ($(filter /%,$(firstword $(gitexecdir))),)
1445 gitexec_instdir = $(gitexecdir)
1446 else
1447 gitexec_instdir = $(prefix)/$(gitexecdir)