[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:
/home/simeon/c++/opengl
I would like to be able to declare a variable in the
Makefile which will be automatically initialized in
opengl
If you use bash shell this can be easily done by the
following script:
=======================================
#!/bin/bash
cdir=`pwd`
echo "current dir is: $cdir"
mydir=${cdir##*/}
echo "last part of its name is: $mydir"
=======================================
If I tried the same thing in the Makefile using the
shell function:
CURRENTDIR=`pwd`
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.
Stop.
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!
Simeon.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
- retrieve current directory,
Simeon Nifos <=