bugmake - Bugs: bug #48970, unclear which prerequisites...

 
 

bug #48970: unclear which prerequisites included in $? for intermediate targets

Submitter:  Sam Fok <fragapanagos>
Submitted:  Thu 01 Sep 2016 07:22:48 PM UTC
   
 
Severity:  3 - Normal Item Group:  Documentation
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.81 Operating System:  POSIX-Based
Fixed Release:  4.3 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 09 Sep 2018 08:11:47 PM UTC, comment #1: 

The reason INTERMEDIATE files are not mentioned in the definition of $? is that they're not relevant when computing the value.  The fact that the target may or may not be intermediate is not considered when generating automatic variables.

I understand that you're asking for the documentation to be clarified.  I'll look at it although honestly it seems very complex to explain why INTERMEDIATE might be relevant.

What if I just made an affirmative statement, like:

The names of all the prerequisites that are newer than the target, with spaces between them. If the target does not exist, all prerequisites will be included.

?

Paul D. Smith <psmith>
Group administrator
Thu 01 Sep 2016 07:22:48 PM UTC, original submission:  

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.

Sam Fok <fragapanagos>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by fragapanagos (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-15 psmith Fixed ReleaseNone 4.3
    2018-09-15 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code