Anonymous | Login | 2023-05-28 19:44 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0000875 | [1003.1(2013)/Issue7+TC1] Shell and Utilities | Comment | Omission | 2014-09-05 11:31 | 2020-04-03 14:52 | ||
Reporter | jammule | View Status | public | ||||
Assigned To | |||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Applied | ||||||
Name | Jarmo Jaakkola | ||||||
Organization | |||||||
User Reference | |||||||
Section | make | ||||||
Page Number | 2943 | ||||||
Line Number | 97362-97366 | ||||||
Interp Status | Approved | ||||||
Final Accepted Text | Note: 0002423 | ||||||
Summary | 0000875: Effects and validity of dependencies on inferred targets in makefiles | ||||||
Description |
This report concerns selection of inference rules, additional dependencies of inferred targets and situations when inference rules may be applied. The NetBSD implementation allowed for an extra dependency to a target that is made by inference to override the regular inference rules. Here is an example makefile: .SUFFIXES: .a .b .c .a.c: ; echo .a.c .b.c: ; echo .b.c test.c: test.b test.a: test.b: NetBSD's implementation used to use the .b.c rule instead of .a.c as implied by .SUFFIXES. My reading of the standard would not allow for this, as the inference rule selection only talks about files with appropriate suffixes, there is no mention of the dependencies having any effect. On the other hand, it is not explicitly forbidden either. I'd like to have an explicit statement on what a POSIX compliant implementation should do in that case. (note: GNU make uses the .a.c rule) In my opinion such behavior should be explicitly forbidden. If it is left to the implementation, the following makefile becomes ambiguous: .SUFFIXES: .c .S .o .c.o: ; cc ... .S.o: ; as ... foo.o: foo.S # foo.c includes foo.S The previous issue might not actually warrant an explicit statement, but there is also an actual problem. As the standard currently reads, a target made by inference can never depend on anything else than its implied source and a target with explicit dependencies can never be made by inference. This is because inference rules can only be checked if there is no target rule for a target. The definition of a target rule on the other hand makes the line "foo.o: foo.h" a target rule, therefore forbidding the use of inference rules. This must clearly be an unintended consequence as how else would you add e.g. header dependencies on an object file compiled from a C file. Let's look at the relevant definitions. The definition of a target rule:
Note that the commands are optional. And here is when inference rules are applicable: When no target rule is found to update a target, the inference rules shall be checked. These are the only kinds of rules available as per DESCRIPTION. Of course, there is this line: A target that has prerequisites, but does not have any commands, can be used to add to the prerequisite list for that target. This does not say that such a line would not be a target rule. Nor does it say if such a line should affect the selection of applicable rule in any other way (i.e. choose a different inference rule). |
||||||
Desired Action |
Change the chapter on lines 97362-97366 to (changes in bold): When no target rule with commands is found to update a target, the inference rules shall be checked. The suffix of the target (.s1) to be built is compared to the list of suffixes specified by the .SUFFIXES special targets. If the .s1 suffix is found in .SUFFIXES, the inference rules shall be searched in the order defined for the first .s2.s1 rule whose prerequisite file ($*.s2) exists. If the target is out-of-date with respect to this prerequisite, the commands for that inference rule shall be executed. Dependencies added by target rules without commands do not affect the selection of the applicable inference rule. |
||||||
Tags | issue8 | ||||||
Attached Files | |||||||
|
![]() |
|||
Date Modified | Username | Field | Change |
2014-09-05 11:31 | jammule | New Issue | |
2014-09-05 11:31 | jammule | Name | => Jarmo Jaakkola |
2014-09-05 11:31 | jammule | Section | => make |
2014-09-05 11:31 | jammule | Page Number | => 2943 |
2014-09-05 11:31 | jammule | Line Number | => 97362-97366 |
2014-10-16 15:46 | geoffclare | Note Added: 0002423 | |
2014-10-16 15:47 | geoffclare | Interp Status | => Pending |
2014-10-16 15:47 | geoffclare | Final Accepted Text | => Note: 0002423 |
2014-10-16 15:47 | geoffclare | Status | New => Interpretation Required |
2014-10-16 15:47 | geoffclare | Resolution | Open => Accepted As Marked |
2014-10-16 15:47 | geoffclare | Description Updated | |
2014-10-16 15:47 | geoffclare | Tag Attached: issue8 | |
2014-11-27 10:33 | ajosey | Interp Status | Pending => Proposed |
2014-11-27 10:33 | ajosey | Note Added: 0002449 | |
2015-01-05 14:13 | ajosey | Interp Status | Proposed => Approved |
2015-01-05 14:13 | ajosey | Note Added: 0002516 | |
2020-04-03 14:52 | geoffclare | Status | Interpretation Required => Applied |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |