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: Noel Yap
Subject: Re: Strange behaviour using the function $(dir ....)
Date: Wed, 09 Feb 2005 07:18:52 -0500
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

You're missing something:  make functions are evaluated at makefile parse time, 
not during the execution of actions.

Try using "echo `dirname $$i`" in the below.

HTH,
Noel

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]