URL: <http://savannah.gnu.org/bugs/?48970>
Summary: unclear which prerequisites included in $? for intermediate targets Project: make Submitted by: fragapanagos Submitted on: Thu 01 Sep 2016 07:22:48 PM GMT Severity: 3 - Normal Item Group: Documentation Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 3.81 Operating System: POSIX-Based Fixed Release: None Triage Status: None _______________________________________________________ Details: I have the following Makefile with intermediate target ${LIST}. ------------------------------ TGT := tgt LIST := list all: ${TGT} ${TGT}: ${LIST} touch `cat ${LIST}` touch $@ ${LIST}: foo1.in foo2.in echo $(?:in=out) > ${LIST} foo%.in: touch foo$*.in clean: rm -f foo* rm -f ${LIST} rm -f ${TGT} .PHONY: all clean .INTERMEDIATE: ${LIST} ------------------------------ When any of ${LIST}'s prerequisite's is newer than ${TGT}, the ${LIST} recipe is executed. However, if .INTERMEDIATE file ${LIST} does not exist, it is unclear from the documentation which ${LIST} prerequisite would be included in ${?} in the ${LIST} recipe. Would it be only the prerequisites that were newer than ${TGT} or all prerequisites because ${LIST} does not exist? The following shell session illustrates the confusion. ------------------------------ $ ls # to show directory state. Makefile $ make touch foo1.in touch foo2.in echo foo1.out foo2.out > list touch `cat list` touch tgt rm list $ make # to show that make ran successfully make: Nothing to be done for `all'. $ touch foo1.in # update foo1.in to be newer than tgt $ make echo foo1.out foo2.out > list touch `cat list` touch tgt ------------------------------ Since list's prerequisite foo1.in was newer than tgt, list's recipe was executed. However, I expected only foo1.in to be included in ${?} because foo1.in alone was newer than tgt and so foo1.in alone caused list's recipe to be executed. On intermediate files, the documentation states that " The first difference is what happens if the intermediate file does not exist. If an ordinary file b does not exist, and make considers a target that depends on b, it invariably creates b and then updates the target from b. But if b is an intermediate file, then make can leave well enough alone. It won’t bother updating b, or the ultimate target, unless some prerequisite of b is newer than that target or there is some other reason to update that target. " There is no mention of which prerequisites of b will be considered to be newer than b. The documentation for $? also does not mention intermediate targets. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?48970> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make