help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Added function - contract-path


From: Shawn Halpenny
Subject: Re: Added function - contract-path
Date: Thu, 30 Jun 2005 22:42:35 -0400

On 6/29/05, address@hidden <address@hidden> wrote:

Hi all,

I've added a function (A make function) named contract-path to the 3.80 sources.
It takes a path with garbage like 'dir/..' or 'dir1//2/' or 'dir/./dir2' and
contracts it as much as possible, e.g.:

a/b/..    ==> a
a/./.     ==> a
a\b\\c/d  ==> a/b/c/d

You can do this with a suitably recent beta of GNUmake (e.g. 3.81beta3).

GNUmakefile:

path1 = a/b/../
path2 = a/./.
path3 = a\b\\c/d      # backslashes as path separators makes my skin crawl...

all: ; @echo path1=$(subst $(CURDIR)/,,$(abspath $(path1))); \
        echo path2=$(subst $(CURDIR)/,,$(abspath $(path2))); \
        echo path3=$(subst $(CURDIR)/,,$(abspath $(subst \,/,$(path3))));

$ gmake
path1=a
path2=a
path3=a/b/c/d

--
Shawn Halpenny




reply via email to

[Prev in Thread] Current Thread [Next in Thread]