help-make
[Top][All Lists]
Advanced

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

Re: creating directories through dependency


From: John Graham-Cumming
Subject: Re: creating directories through dependency
Date: Tue, 09 Jan 2007 11:31:42 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

Michal Nowikowski wrote:
I have a problem of chicken-and-egg type. Makefile:
---
BUILDDIR=build

$(BUILDDIR):
  mkdir -p $(BUILDDIR)

$(objs):%.o:%.c $(BUILDDIR)
  $(CC) -c $< -o $(BUILDDIR)/$@
---

In this situation BUILDDIR is created before sources are compiled.
But when everything is compiled and I re-run make it tries to recompile
some source files because make claims that BUILDDIR is newer then
some object files. It is like that because BUILDDIR had been changing when
new object file were generated and put into it.

How to solve this problem i.e. avoid recompiling files during subsequent
make run?

I wrote an article for CM Crossroads all about directory creation in GNU Make. You can read it here:

http://www.cmcrossroads.com/content/view/6936/120/

John.





reply via email to

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