Hello, Aditya Kher,
Oh, please! Is that just a typo? After
changing objects to $(objects), it does
not appear to be a meaningful makefile. Run it yourself, it will output
somthing like make: *** No rule to make target `/xxx/Your-current-dir/yyy.o', needed by `all'. Stop.
That is, it(run by make) does not output something
like g++ -o /home/usr/boo/../source_dir/foo.o ../source_dir/foo.cpp
Please be kind enough to provide us a runnable example that really
describe what you've encountered and what you would expect it to
be.
BTW: I'm using make 3.81 .
======== 2007-10-23 17:41:57 You
wrote: ========
sorry. there was a typo.
it should be
all: $(objects)
cheers!
On 10/23/07, Chen Jun (陈军) <address@hidden>
wrote:
Hello, Aditya
Kher,
It's something odd in your
reply. Could you please present a complete makefile and
show its output?
At least, the makefile snippet you gave
below was not a reasonable makefile -- at least, no
rule to make the target "objects".
CPP_DIR:=/home/user/source_dir CPP=g++ objects:=$(patsubst ${CPP_DIR}/%.cpp,${CURDIR}/%.o,$(wildcard ${CPP_DIR}/*.cpp)) all: objects
========
2007-10-23 16:55:49 You
wrote: ========
[[CC the Help-make]]
> Nope. that doesnt work
> consider my setup like this:
>
> /home/usr/boo/Makefile:
> ------
> CPP_DIR:=/home/user/source_dir
> CPP=g++
> objects:=$(patsubst ${CPP_DIR}/%.cpp,${CURDIR}/%.o,$(wildcard
> ${CPP_DIR}/*.cpp))
>
> all:objects
>
> -------
> I get
> %pwd
> /home/usr/boo
> %gmake -n
> g++ -o /home/usr/boo/../source_dir/foo.o ../source_dir/foo.cpp
>
> while without $CURDIR in the variable definition, I get
> %gmake -n
> g++ -o /home/usr/source_dir/foo.o ../source_dir/foo.cpp
>
> so its essentially the same regardless of use of $CURDIR.
> -aditya
>
>
> >
> >
> >
> >
>
> Hello, Aditya Kher,
>
> objects:=$(patsubst ${CPP_DIR}/%.cpp,${CURDIR}/%.o,$(wildcard ${CPP_DIR}/*.cpp))
> >
>
> Is that what you want?
> >
>
> $(CURDIR) is a make internal variable representing current working directory.
> >
>
--
Aditya Kher
|
= = = = = = = = = = = = = = = =
= = = = = =
Best Regards
Chen Jun
(陈军)
2007-10-23 |
-- Aditya Kher http://kher.org
|
= = = = = = = = = = = = = = = = = = = = = =
Best Regards
Chen Jun
(陈军)
2007-10-24 |