Thank you paul. The section of order-only prerequisites does not explain the function of this sort of prerequisite well in my opinion. After one sentence , it starts several lines about how to specify an order-only prerequisite by pipe symbol and so on(only it insists on syntax issue).
I asked you to explain it but you only repeated what was in the manual!! I have the manual dear and if it was clear I never asked you. I am sorry but I want to take up your time again and ask some more questions: 1) If I specify an order-only prerequisite, will be evaluated sooner than other normal prerequisites? if yes, why the manual clearly does not say that? 2) Instead of "target to be updated" you could say, the command or recipe of the target which is to be executed" as follows: If a target has an order-only prerequisite and that order-only prerequisite is a file(or directory) and it is updated(because it may be the target of some other rule itself), the command or recipe of that target will not be executed. Did i understand the purpose of the order-only prerequisite? Is my sentence more clear than the manual?!! Thank you to read my message and sorry to take up the time of all people and user's of the list. On Tue, Sep 7, 2010 at 4:51 PM, Paul Smith <[email protected]> wrote: > On Tue, 2010-09-07 at 10:12 +0430, ali hagigat wrote: >> 1) a target is updated when it does not exist or its last modification >> time is older than its prerequisites. For order-only prerequisites, >> the same rule applies? means if a target does not exist or its last >> modification time is older than its order-only prerequisites will be >> updated(the rule of the target will be executed)? > > Obviously not, since that would make order-only prerequisites exactly > the same as normal prerequisites. The documentation says (in the > section you did not quote): > > [...] A normal prerequisite makes > two statements: first, it imposes an order in which recipes will be > invoked: the recipes for all prerequisites of a target will be > completed before the recipe for the target is run. Second, it imposes > a dependency relationship: if any prerequisite is newer than the > target, then the target is considered out-of-date and must be rebuilt. > > Normally, this is exactly what you want: if a target's prerequisite > is updated, then the target should also be updated. > > Occasionally, however, you have a situation where you want to impose > a specific ordering on the rules to be invoked _without_ forcing the > target to be updated if one of those rules is executed. In that case, > you want to define "order-only" prerequisites. > > This answers exactly your question. > >> 2) In the example of the make manual, there are two rules for the >> prerequisites of 'all' target, one pattern rule at the beginning and >> then $(OBJS): | $(OBJDIR). Will these rules be executed in order and >> both will be considered? or the explicit rule will be evaluated first? > > The second one does not have a recipe. It just adds prerequisites to > existing rules. > > There is only one recipe defined for each .o, so that's the recipe that > will be executed. It's the same as writing: > > foo.o: foo.c > $(CC) $(CFLAGS) -o $@ -c $< > foo.o: foo.h > foo.o: bar.h > >> 3) After reading the manual one can not understand whether files >> objdir/foo.o, objdir/bar.o and objdir/baz.o will be updated(if objdir >> directory already does not exist) or the command $(COMPILE.c) >> $(OUTPUT_OPTION) $< will be executed at last? > > Sorry you didn't understand. See above. > >> 4) If objdir exists, what that makefile will do? > > The same thing as make would do for any other target. There's nothing > special here about the TARGET objdir. > >> 5) if objdir does not exist but object files exist, will $(OBJDIR): >> ;mkdir $(OBJDIR) be executed? > > How can the object files exist if the directory doesn't exist? The > files are IN the directory. You're just being ridiculous now. > > -- > ------------------------------------------------------------------------------- > Paul D. Smith <[email protected]> Find some GNU make tips at: > http://www.gnu.org http://make.mad-scientist.net > "Please remain calm...I may be mad, but I am a professional." --Mad Scientist > > _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
