Unix Programming - makedepend question

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2006 > makedepend question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author makedepend question
jithu

2006-10-17, 1:25 pm

Hi
I am posting it here since, after searching in google for
Makefiles, i got lot of reference material on Makefile. But very few of
them specified on creating Makefiles for any directory structure. I
mean i got very few references for things like seperating object files
from sources files . The only useful thing i got was
http://make.paulandlesley.org/multi-arch.html which is too complex for
a newbie like me.So if you have some good material on makefile for
directory structures please post them as reply. Now if you have time
please answer my question.

I have 2 directories named "cppsrc" and "public" inside another
direcory PRJ_DIR. All the cpp source files are present inside the
"cppsrc" and all the header files are present in "public". My
"Makefile" is present in PRJ_DIR. I use "makedepend" in my makefile as
below.

SRC_FILE = cppsrc/main.cpp cppsrc/test.cpp
makedepend -f- -I public $(SRC_FILE) > .depend

But this create the the dependancy list as below
cppsrc/main.o: public/test.h
cppsrc/test.o: public/test.h

What i need is a list like
main.o: public/test.h
test.o: public/test.h.

How to create this list. Remeber my Makefile is in PRJ_DIR and
makedepend is invoked from it.I know by giving cd cppsrc; followed by
makedepend will help some what. But then i have to use " .." in the
makedepend command and gets me confusing output like

(cd cppsrc; makedepend -f- -I../public $(notdir $(SRC_FILE)) >
.../.depend)

.../main.o: ../public/test.h
.../test.o: ../public/test.h


But the aim of this question is more (70%) to get some good references
on the subject from the masters itself and still the (30%) is to get a
better solution.

Thanks in Advance
Kiran.

Maxim Yegorushkin

2006-10-17, 7:37 pm

jithu wrote:
> Hi
> I am posting it here since, after searching in google for
> Makefiles, i got lot of reference material on Makefile. But very few of
> them specified on creating Makefiles for any directory structure. I
> mean i got very few references for things like seperating object files
> from sources files . The only useful thing i got was
> http://make.paulandlesley.org/multi-arch.html which is too complex for
> a newbie like me.So if you have some good material on makefile for
> directory structures please post them as reply. Now if you have time
> please answer my question.


That link is very good. I believe you can find some good hints there.

> I have 2 directories named "cppsrc" and "public" inside another
> direcory PRJ_DIR. All the cpp source files are present inside the
> "cppsrc" and all the header files are present in "public". My
> "Makefile" is present in PRJ_DIR. I use "makedepend" in my makefile as
> below.
>
> SRC_FILE = cppsrc/main.cpp cppsrc/test.cpp
> makedepend -f- -I public $(SRC_FILE) > .depend
>
> But this create the the dependancy list as below
> cppsrc/main.o: public/test.h
> cppsrc/test.o: public/test.h
>
> What i need is a list like
> main.o: public/test.h
> test.o: public/test.h.


Interesting. If you compile from the safe folder from which you run
makedepend you need exactly the dependencies it creates without any
modification. Do you compile from another folder?

[]

> But the aim of this question is more (70%) to get some good references
> on the subject from the masters itself and still the (30%) is to get a
> better solution.


http://make.paulandlesley.org/autodep.html
http://www.gnu.org/software/make/manual/

and the link you mentioned may provide 99% of information you need.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com