This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
makedepend usage problem
- From: "Mariappan, MaharajanX" <m_mariappanX at trillium dot com>
- To: "'gcc-help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Cc: "Mariappan, MaharajanX" <m_mariappanX at trillium dot com>
- Date: Thu, 28 Mar 2002 05:29:19 -0800
- Subject: makedepend usage problem
Hi GNU Gurus!
I've a problem with makedepend command usage inside the Makefile.
I have placeed Makefile in DIR1, c sources are present in DIR2. I want to
place object files in DIR3
so I write the top Makefile like below
SUBDIRS = DIR1
ifneq "$(strip $(SUBDIRS)) ""
req_dirs := $(subst /,X/,$(SUBDIRS))
$(req_dirs):
$(MAKE) -w -C $(subt X/,/,$@) PWD=$(subt X/,/,$@);
endif
target: $(req_dirs)
ifneq "$(strip $(SUBDIRS)) ""
req_dirs := $(subst /,X/,$(SUBDIRS))
$(dep_req_dirs):
$(MAKE) -w -C $(subt X/,/,$@) PWD=$(subt X/,/,$@) localdepend;
endif
localdepend:
(cd $(SRCDIR); \
$(MAKEDEPEND) -Y -p$(OBJDIR) $(notdir $(SRCS)) \
)
makedepend: $(dep_req_dirs) localdepend
The Makefile in DIR1 looks like,
SRCDIR = DIR2
OBJDIR = DIR3
SRCS := $(wildcard $(SRCDIR)/*.c)
When I run gmake makedepend in top dir.
It will create dependency like below:
DIR3/filename.o : headerfile.h
But when I run build target, make will start in DIR1[where Makefile present]
and it cann't locate the header file, since this file exists in DIR2, not in
DIR1]
So I tried to cahnge the localdepend target like below:-
localdepend:
( \
$(MAKEDEPEND) -Y -p$(OBJDIR) $(SRCS) \
)
But now the problem is:
DIR3/DIR2/filename.o : DIR2/headerfile.h
But I want something like below line..
DIR3/filename.o : Dir2/headerfile.h
The pathname of src file need not be present when I pass -p<objdir> option
in the lhs of dependency list, but present the pathname in the rhs.
I've tried to find a way to fix this problem, but cudn't. I'm really
appreciating any help regarding this.
TIA,
Maharajan.