Is 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.

[EMAIL PROTECTED] ~/temp
$ mkdir src_dir

[EMAIL PROTECTED] ~/temp
$ touch src_dir/obj1.c

[EMAIL PROTECTED] ~/temp
$ touch src_dir/obj2.c

[EMAIL PROTECTED] ~/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

[EMAIL PROTECTED] ~/temp
$ make lib_dir/test.b
touch obj_dir/obj1.o
touch lib_dir/test.b

Please help. I don't understand this behavior.



_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to