help-make
[Top][All Lists]
Advanced

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

makedepend usage problem


From: Mariappan, MaharajanX
Subject: makedepend usage problem
Date: Thu, 28 Mar 2002 21:05:40 -0800

Hi GNU Make 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.






reply via email to

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