bugmake - Bugs: bug #30762, another make -n exception

 
 

bug #30762: another make -n exception

Submitted by:  None
Submitted on:  Thu 12 Aug 2010 10:52:45 PM UTC  
 
Severity: 3 - NormalItem Group: Documentation
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.82Operating System: None
Fixed Release: 4.0Triage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 29 Aug 2010 10:33:54 PM UTC, comment #1:

I couldn't come up with wording I liked in that section, so I added some extra wording in the section that documents the -n flag itself.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu 12 Aug 2010 10:52:45 PM UTC, original submission:

The following simple Makefile demonstrates a "-n" issue:
----------------------------
-include fred.d

fred.o:
echo FRED.O > fred.o
cat fred.o

fred.d:
echo "fred.o:" > fred.d
cat fred.d
-----------------------------

Assume an empty directory (other than Makefile above).

make -n

should, according to documentation for -n, show:
echo FRED.O > fred.o
cat fred.o

but, it actually shows (and executes):
-------------------------
echo "fred.o:" > fred.d
cat fred.d
fred.o:
echo FRED.O > fred.o
cat fred.o
-------------------------
In other words, because of the "include" and a declaration to create the file "fred.d", make actually makes the file (and recursively restarts with the new fred.d). This is a correct action, but it is not well documented.

Documentation in Section 9.3 says that if -n is specified, recipe lines are not run, with the exceptions of + and ${MAKE} lines. However, this example shows a case where a recipe line might be run, even though it does not have one of those markers.

Section 3.3 does state: "Once it has finished reading makefiles, make will try to remake any that are out of date or don't exist.", but for someone debugging a Makefile, this location is obscure and not optimal.

To help makefile authors figure out what's going on, I would suggest adding to Section 9.3 something of the form:

----------------- add below to section 9.3 -----------------
In situations where a remake of sub-makefiles can occur, such as with an "include", recipe lines used to remake a missing or out-of-date included file will be executed even if -n, -q, or -t has been specified.
----------------- add above to section 9.3 -----------------

Sincerely,

Stan Tomlinson
-unavailable-

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 29 Aug 2010 10:33:54 PM UTCpsmithStatusNone=>Fixed
      Assigned toNone=>psmith
      Open/ClosedOpen=>Closed
      Component VersionNone=>3.82
      Fixed ReleaseNone=>4.0

    Back to the top


    Powered by Savane 3.1-cleanup1