help-make
[Top][All Lists]
Advanced

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

Re: Automatic dependency generation - make won't create intermediate dir


From: Dave Hylands
Subject: Re: Automatic dependency generation - make won't create intermediate dirs for me
Date: Sat, 3 Dec 2005 13:08:13 -0800

Sending to the list.

Hi,

> Then I wanted make to automatically create the ".dep/" and ".obj/" subdirs
> for me if they don't exist, and that doesn't work.  It seems like make
> wants to build my .d files first, though I thought I told it to make
> $(DEPDIR) first.

Add an explicit dependency here

> $(DEPDIR)%.d: %.cpp $(DEPDIR)

Then make will create the directory before trying to create the dependencies.

The reason it wasn't woprking before is that make had an implicit
dependency on any included files (i.e. your dep files) and it will try
to build those before building your all target.

> Also, if I start with a clean directory, just containing main.cpp and
> Makefile, 'make clean' fails; it's like it won't clean stuff until the .d
> files exist, and it can't create them because ".dep/" doesn't exist.

I normally include my dep files using something like this:

ifeq ($(strip $(filter clean%, $(MAKECMDGOALS))),)
-include $(DEP_FILES)
endif

That way it won't bother inlucding the dependcy files for targets
which don't need them.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/




reply via email to

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