bug-make
[Top][All Lists]
Advanced

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

Re: Order-only Prerequisites Suppress some Error Checking


From: Tony Strauss
Subject: Re: Order-only Prerequisites Suppress some Error Checking
Date: Tue, 22 Apr 2008 09:41:16 -0400

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.
Thank you for correcting the example!  I'm not sure whether it completely address my point, however.  Section 4.7 says that gmake always runs rules with no prerequisites and commands for a nonexistent file.  I understand your point above to be that
#$(DERIVED_OBJ_DIR)/test.o: | $(DERIVED_OBJ_DIR)
is very different than
$(DERIVED_OBJ_DIR)/test.o: # | $(DERIVED_OBJ_DIR)
because the latter makes $(DERIVED_OBJ_DIR)/test.o fall under section 4.7.  Point taken.
 
I guess I'm questioning, however, why (example3.mk
$(DERIVED_OBJ_DIR)/test.o: | $(DERIVED_OBJ_DIR)
counts as a "real" rule in the section 4.7 sense at all, given that its only purpose was to express an ordering relationship.  To put it another way, imagine that order-only prerequisites were specified through a different syntax mechanism that did not look like an ordinary rule to gmake.  Would this (should this) order-only prerequisite count as a "real rule" for section 4.7 purposes, given that no statement for how the target actually is built has been made?
 
Thank you!
 
Tony

reply via email to

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