[Top][All Lists]

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

retrieve current directory

From: Simeon Nifos
Subject: retrieve current directory
Date: Wed, 28 Jun 2006 09:05:21 -0700 (PDT)

Hi there,
I would like to be able in the Makefile to 
retrieve the last part of the name of the current 
directory. If for instance my current directory is:


I would like to be able to declare a variable in the
Makefile which will be automatically initialized in 


If you use bash shell this can be easily done by the
following script:


echo "current dir is: $cdir"

echo "last part of its name is: $mydir"

If I tried the same thing in the Makefile using the
shell function:

CDIR=${shell echo "${CURDIR##*/}" }

it doesn't seem to work with or without quotes.
I get the following error message:

Makefile:25: *** unterminated variable reference. 

I think this is because the symbol # is used by make
for starting comments. But then what can I do?
It seems that there is not an easy way out with 
the shell approach. Does anybody know how to do it?

I think another way is by using awk. But I am not
familiar with its syntax. Can somebody help me?

Thanks in advance!

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

reply via email to

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