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

 
 

bug #30762: another make -n exception

Submitter:  None
Submitted:  Thu 12 Aug 2010 10:52:45 PM UTC
   
 
Severity:  3 - Normal Item Group:  Documentation
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.82 Operating System:  None
Fixed Release:  4.0 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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
-email is unavailable-

Anonymous

 

(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)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-08-29 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Component VersionNone 3.82
        Fixed ReleaseNone 4.0

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code