URL: <http://savannah.gnu.org/bugs/?30762>
Summary: another make -n exception Project: make Submitted by: None Submitted on: Thu 12 Aug 2010 10:52:45 PM UTC Severity: 3 - Normal Item Group: Documentation Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: None Operating System: None Fixed Release: None Triage Status: None _______________________________________________________ Details: 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 s...@tomlinson.com _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?30762> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make