On Sun, 2008-04-20 at 12:46 -0400, Tony Strauss wrote: > This works very well. Now, suppose that I comment out the implicit > rule and the order-only prerequisite (attached as example2.mk):
> #$(DERIVED_OBJ_DIR)/test.o: | $(DERIVED_OBJ_DIR) > > Make correctly dies with: > gmake: *** No rule to make target `_linux/test.o', needed by `all'. > Stop. > > Now, if I uncomment out the order-only prerequisite (example3.mk): > $(DERIVED_OBJ_DIR)/test.o: | $(DERIVED_OBJ_DIR) > > Make exits successfully, but does *not* build anything (because it > does not know how to build $(DERIVED_OBJECT)/test.o, since test.cc > (attached) is in the current directory. Specifying the order-only > prerequisite, even though it is not a "real" rule (in that there is no > command, and I have not specified any normal prerequisites for > $(DERIVED_OBJECT)/test.o) has given make the idea that it knows how to > build $(DERIVED_OBJECT)/test.o, even though it has no more idea than > before. I think that make should exit with the same error code in the > second and third examples (that a target just having order-only > prerequisites should not count as a "real" rule to make). Thank you! I don't think this is correct. Your "comment out" example (example2.mk) is not accurate. To be accurate, you should comment out ONLY the order-only prerequisite part, like this: $(DERIVED_OBJ_DIR)/test.o: # | $(DERIVED_OBJ_DIR) Not the entire line. If you do this, you'll see this example behaves the same way as your 3rd example. Why? Read section 4.7, "Rules without Commands or Prerequisites" in the GNU make manual. I believe GNU make's behavior in this situation is correct. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.us "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make