]> Pileus Git - ~andy/git/commitdiff
Makefile: fix misdetection of relative pathnames
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 Feb 2009 08:04:17 +0000 (00:04 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Feb 2009 08:28:43 +0000 (00:28 -0800)
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>
Makefile

index a82f173cb462f246a3efa5d26f1b53e18bcd4fe1..605b147e72aa6772a9857606387b1109883f645e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1434,14 +1434,14 @@ remove-dashes:
 
 ### Installation rules
 
-ifeq ($(abspath $(template_dir)),$(template_dir))
+ifneq ($(filter /%,$(firstword $(template_dir))),)
 template_instdir = $(template_dir)
 else
 template_instdir = $(prefix)/$(template_dir)
 endif
 export template_instdir
 
-ifeq ($(abspath $(gitexecdir)),$(gitexecdir))
+ifneq ($(filter /%,$(firstword $(gitexecdir))),)
 gitexec_instdir = $(gitexecdir)
 else
 gitexec_instdir = $(prefix)/$(gitexecdir)