[Top][All Lists]

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

Re: Order-only dependencies don't work

From: Earnie Boyd
Subject: Re: Order-only dependencies don't work
Date: Wed, 27 Oct 2004 21:49:27 -0400 (EDT)
User-agent: SquirrelMail/1.4.3a

Posted on DATE by AUTHOR Daniel Olivier
> Isn't this supposed to work?
> obj_dir lib_dir :
>       [ -d $@ ] || mkdir -p $@
> obj_dir/%.o : src_dir/%.c | obj_dir
> #     [ -d obj_dir ] || mkdir -p obj_dir # this does work
>       touch $@
> lib_dir/%.b : obj_dir/obj1.o obj_dir/obj2.o | lib_dir
>       touch $@
> obj_dir/obj2.o : src_dir/obj2.c
> obj_dir/obj1.o : src_dir/obj1.c
> lib_dir/test.b : obj_dir/obj2.o obj_dir/obj1.o
> It builds fine the first time, but for some reason. If I attempt to make
> second time, because the obj_dir directory (dependency) is newer than
> (target) obj1.o, the rule is re-run, causing the "compiler" (touch in
> simplified case) and "linker" to be re-invoked once each, despite the
> that the this is an order-only dependency.

The directory that contains the file will always be newer than the oldest
file in the directory.  The directory timestamp is updated when the
directory contents changes.

Hardcoding the directories as you have above isn't good design, IMNSHO.


reply via email to

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