help-make
[Top][All Lists]
Advanced

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

The explanation of order-only prerequisites is not clear


From: ali hagigat
Subject: The explanation of order-only prerequisites is not clear
Date: Tue, 7 Sep 2010 10:12:43 +0430

The explanation of order-only prerequisites in the make manual ( pages
22 and 23) is ambiguous and not enough. Lets take a look:
-----------------------------------------------------------------------------------------------------
4.2 Types of Prerequisites
OBJDIR := objdir
OBJS := $(addprefix $(OBJDIR)/,foo.o bar.o baz.o)
$(OBJDIR)/%.o : %.c
          $(COMPILE.c) $(OUTPUT_OPTION) $<
all: $(OBJS)
$(OBJS): | $(OBJDIR)
$(OBJDIR):
         mkdir $(OBJDIR)
-----------------------------------------------------------------------------------------------------
There are some questions about this example:
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)?
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?
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?
4) If objdir exists, what that makefile will do?
5) if objdir does not exist but object files exist, will  $(OBJDIR):
;mkdir $(OBJDIR) be executed?
6) The explanations of this part is like the authors want to raise a
puzzle and to challenge people not to help them understand! I wonder
if it can be changed in future versions.



reply via email to

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