View Issue Details

IDProjectCategoryView StatusLast Update
00005181003.1(2008)/Issue 7Shell and Utilitiespublic2024-06-11 08:53
Reporterdwheeler Assigned Toajosey  
PrioritynormalSeverityObjectionTypeClarification Requested
Status ClosedResolutionAccepted As Marked 
NameDavid A. Wheeler
Organization
User Reference
Sectionmake
Page Number2912
Line Number95667-95688
Interp Status---
Final Accepted Text0000518:0001190
Summary0000518: Allow make's "include" to include multiple files
DescriptionIn many cases it's useful to tell "make" to include a set of files, not just a single file. This list of files may, for example, be in a make variable. This can happen when dealing with automated dependencies (see bug #328), but it can happen in other cases too.

Currently the standard specifically does not require support for multiple filenames in include - but it doesn't forbid it, either.

Adding this feature lets you do stuff like the following (presuming bug #330 and bug #512 are accepted), as a sample use case among many:

all: prog
SRCS ::= $(wildcard src/*.c)
OBJS ::= $(SRCS:.c=.o)
DEPS ::= $(SRCS:.c=.d)

# ... Define .c.o here so that FILE.o's dependencies end up in FILE.d ...
# E.G., see http://make.paulandlesley.org/autodep.html

-include $(DEPS)

prog: $(OBJS)
        $(CC) $(CFLAGS) -o $@ $(OBJS)

Desired ActionReplace lines 95667-95688 in make's definition ("Include Lines") with:

Include Lines
If the word include appears at the beginning of a line and is followed by one or more <blank> characters, the string formed by the remainder of the line shall be processed as follows to produce one or more pathnames:
• The trailing <newline> and any comment shall be discarded. If the resulting string contains any double-quote characters (’"’) the behavior is unspecified.
• The resulting string shall be processed for macro expansion (see Macros (on page 2914).
• Any <blank> and <tab> characters that appear after the first non-<blank> shall be used as separators to divide the macro-expanded string into fields. It is unspecified whether pathname expansion (see Section 2.13, on page 2332) is also performed.
• If the processing of separators and optional pathname expansion results in zero fields, the behavior is unspecified. If it results in at least one non-empty field, these fields are taken as the pathnames.

For each pathname so identified, in the order specified:
* Each pathname that does not begin with a ’/’ shall be treated as relative to the current working directory of the process, not relative to the directory containing the makefile. If the file does not exist in this location, it is unspecified whether additional directories are searched.
* The contents of the file specified by the pathname shall be read and processed as if they appeared in the makefile in place of the include line. If the file ends with an escaped <newline> the behavior is unspecified.
* The file may itself contain further include lines. Implementations shall support nesting of include files up to a depth of at least 16.

Tagsissue8

Relationships

related to 0000333 Closedajosey Add support for silent includes using "-include" 

Activities

geoffclare

2012-04-05 16:02

manager   bugnote:0001190

(This is the desired action minus the "and <tab>" addition, which is not needed
because <blank> includes <space> and <tab> characters.)

Replace lines 95667-95688 in make's definition ("Include Lines") with:

Include Lines
If the word include appears at the beginning of a line and is followed by one or more <blank> characters, the string formed by the remainder of the line shall be processed as follows to produce one or more pathnames:
* The trailing <newline> and any comment shall be discarded. If the resulting string contains any double-quote characters (’"’) the behavior is unspecified.
* The resulting string shall be processed for macro expansion (see Macros (on page 2914).
* Any <blank> characters that appear after the first non-<blank> shall be used as separators to divide the macro-expanded string into fields. It is unspecified whether pathname expansion (see Section 2.13, on page 2332) is also performed.
* If the processing of separators and optional pathname expansion results in zero fields, the behavior is unspecified. If it results in at least one non-empty field, these fields are taken as the pathnames.

For each pathname so identified, in the order specified:
* Each pathname that does not begin with a ’/’ shall be treated as relative to the current working directory of the process, not relative to the directory containing the makefile. If the file does not exist in this location, it is unspecified whether additional directories are searched.
* The contents of the file specified by the pathname shall be read and processed as if they appeared in the makefile in place of the include line. If the file ends with an escaped <newline> the behavior is unspecified.
* The file may itself contain further include lines. Implementations shall support nesting of include files up to a depth of at least 16.

geoffclare

2020-03-18 15:21

manager   bugnote:0004798

Note that when applying the changes from this bug, I noted that other changes had been made to the Include Lines subsection since the 2008 edition, and therefore I did not follow the instruction to replace that section with the new text, but instead identified the changes between the 2008 edition text and the text given here and then applied equivalent changes to the current text.

Some of the intervening changes were from bug 0000333 adding -include ("silent includes"), but there were also some TC changes.

Issue History

Date Modified Username Field Change
2011-11-27 21:35 dwheeler New Issue
2011-11-27 21:35 dwheeler Status New => Under Review
2011-11-27 21:35 dwheeler Assigned To => ajosey
2011-11-27 21:35 dwheeler Name => David A. Wheeler
2011-11-27 21:35 dwheeler Section => make
2011-11-27 21:35 dwheeler Page Number => 2912
2011-11-27 21:35 dwheeler Line Number => 95667-95688
2012-04-05 16:02 geoffclare Note Added: 0001190
2012-04-05 16:03 geoffclare Interp Status => ---
2012-04-05 16:03 geoffclare Final Accepted Text => 0000518:0001190
2012-04-05 16:03 geoffclare Status Under Review => Resolved
2012-04-05 16:03 geoffclare Resolution Open => Accepted As Marked
2012-04-05 16:04 geoffclare Tag Attached: issue8
2020-03-18 15:21 geoffclare Note Added: 0004798
2020-03-18 15:21 geoffclare Status Resolved => Applied
2020-03-18 15:21 geoffclare Relationship added related to 0000333
2024-06-11 08:53 agadmin Status Applied => Closed