On 6/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to