[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Order-only dependencies don't work
From: |
Daniel Olivier |
Subject: |
Order-only dependencies don't work |
Date: |
Thu, 21 Oct 2004 13:38:30 -0400 |
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 a
second time, because the obj_dir directory (dependency) is newer than the
(target) obj1.o, the rule is re-run, causing the "compiler" (touch in this
simplified case) and "linker" to be re-invoked once each, despite the fact
that the this is an order-only dependency.
address@hidden ~/temp
$ mkdir src_dir
address@hidden ~/temp
$ touch src_dir/obj1.c
address@hidden ~/temp
$ touch src_dir/obj2.c
address@hidden ~/temp
$ make lib_dir/test.b
[ -d obj_dir ] || mkdir -p obj_dir
touch obj_dir/obj1.o
touch obj_dir/obj2.o
[ -d lib_dir ] || mkdir -p lib_dir
touch lib_dir/test.b
address@hidden ~/temp
$ make lib_dir/test.b
touch obj_dir/obj1.o
touch lib_dir/test.b
Please help. I don't understand this behavior.
Note: my environment is: make 3.80 + cygwin + win XP SP2.
address@hidden ~/temp
$ rm -rf obj_dir/ lib_dir/
address@hidden ~/temp
$ make -d lib_dir/test.b > make-d1.txt
address@hidden ~/temp
$ make -d lib_dir/test.b > make-d2.txt
make-d1.txt
Description: Text document
make-d2.txt
Description: Text document
cygcheck.txt
Description: Text document
- Order-only dependencies don't work,
Daniel Olivier <=