help-make
[Top][All Lists]
Advanced

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

Re: Strange behaviour using the function $(dir ....)


From: Jason Pearce
Subject: Re: Strange behaviour using the function $(dir ....)
Date: Wed, 09 Feb 2005 12:23:49 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910

You are mixing up Make commands with shell commands.
$(dir xxxx) is the Make command, but that has already been expanded when the shell runs. That is why you get .\ for every output. You want the shell version of $(dir xxx), try dirname $$i and you should have sucess.

Jason

address@hidden wrote:


Hi All,

I am using gmake 3.80 version. I have this simple makefile to get the directory part of the files as mentioned below.

D=d:/bg/123/ # change to /tmp/123 on unix

A=src/1.c src/2.c src/3.c src/4.c
C=$(addprefix $(D),$(A))

all:
        @for i in $(C); do \
        echo $$i; \
        echo $(dir $$i);\
        done

The results are as follows:
*_on Unix:_*

$gmake -f test.mk
/tmp/123/src/1.c
./
/tmp/123/src/2.c
./
/tmp/123/src/3.c
./
/tmp/123/src/4.c
./

*_On Windows:_*

gmake -f D:\bg.mk
d:/bg/123/src/1.c
./
d:/bg/123/src/2.c
./
d:/bg/123/src/3.c
./
d:/bg/123/src/4.c
./

Am I missing something or is this a bug.

Thanks & Regards,
Bhaskar G
=================================================
Technical Leader
Philips Semiconductors / CTO / Design Technology Group

E-mail:        address@hidden
Phone:       +91 80 2557 9000, Ext 3016
Fax:            +91 80 2556 0581
GSM:         +91 944 876 1340

Office:        Philips Innovation Campus, 3rd floor
Address:   No 1, Murphy Road, Ulsoor, Bangalore - 560 008
Country:    INDIA
=================================================

------------------------------------------------------------------------

_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make





reply via email to

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