fix(make): exclude .NOTINTERMEDIATE from target completion - #1715
fix(make): exclude .NOTINTERMEDIATE from target completion#171515daksh-2003 wants to merge 1 commit into
Conversation
|
@akinomyoga here for engagement on this |
akinomyoga
left a comment
There was a problem hiding this comment.
.WAITis a parse-consumed prerequisite marker
The GNU make manual says
You can create an actual target
.WAITin your makefile for portability but this is not required to use this feature. If a .WAIT target is created it should not have prerequisites or commands.
It seems to imply that .WAIT may be listed by older versions of GNU make when the user adds the prerequisite .WAIT to work around the "unknown target" error in the older versions of GNU make. I also confirmed that, even in the newer versions of GNU make, when the .WAIT prerequisite is present in Makefile/GNUmakefile, .WAIT is listed in make -npq. I believe those workaround prerequisites .WAIT should be excluded anyway.
955ca98 to
ed837fd
Compare
makes sense. included it |
|
For the existing |
even before that I found something interesting: the manual's --print-targets section says it excludes "special targets (target names consisting of . followed by all upper-case letters)."...makes me think why do we need to define the special targets all explicitly. why not pattern based approach here? This needs a bit of thinking I think for nuances. |
|
as for the BSD make special targets...I was checking if there is any rationale behind why and how .MAKE and so got introduced in the project for special targets. This seems to have been added in 2012...not sure if while adding this there was a GNU specific rationale... |
|
but yeah...print targets or so itself would land in 4.5.... |
from the code, it seems the awk runs in the user locale. for something like a pattern, awk [A-Z] is a collation range (can match lowercase in case-interleaving locales → silently drop a real target). one good analogue could be [[:upper:]] also from what make's defined approach for print_targets is....it does not seem to take into account specials with underscores like .DELETE_ON_ERROR, .LOW_RESOLUTION_TIME, .EXPORT_ALL_VARIABLES.... something that ^.[A-Z]+$ won't match |
also, while checking on this further....NOEXPORT also seems obsolete and redundant sort of... from I think 4.9 section of manual. further BSD -p seems to have a different shape altogether, whereas our parser seems to be catering to GNU only. Extending...might be a rabbit hole ..... |
I got the code snippet as this: |
|
@akinomyoga for thoughts on these thingy. mostly because of underscore specials...I think staying on list only is good for now |
akinomyoga
left a comment
There was a problem hiding this comment.
In general, Makefile can be designed to be compatible with both GNU and BSD variants of make. Such a Makefile may contain the targets that have meanings in a make implementation and are ignored in the other make implementions. In principle, those targets should be excluded regardless of whether GNU make interprets it as a special target. However, although I'm not sure why only .MAKE from BSD make was excluded in the present script, I think we don't have to care about BSD special targets too much.
The character range of A-Z is not a relevant issue because we can set LC_COLLATE=C to take care of it.
The target .NOEXPORT seems to have been supported by very old versions of GNU make, and autotools (which is known to be excessively backward compatible) seems to still generate such a target. Then, it is reasonable to continue supporting exclusion of it.
makes sense
since we r going with list, i think this only comes into picture for pattern based approach..we can drop thinking on this
makes sense |
|
@akinomyoga should we merge this? |
|
I would like input from another maintainer. |
ed837fd to
774e5d6
Compare
`.NOTINTERMEDIATE' (GNU make 4.4) and `.WAIT' are special targets that were missing from the extractor's skip list, so they leaked into completion on a dotted prefix (`make .NOT<TAB>' / `make .WA<TAB>'). `.WAIT' surfaces as a real target block via its documented empty-target portability form. Add both, with regression tests. Follow-up from the scop#1693 review.
774e5d6 to
a7e8cf9
Compare
In "test/t/{test_make.py,unit/test_compgen_filedir_xspec.py}", the
plain "completion = assert_complete(...)" can be replaced with
"@pytest.mark.complete" markers.
For "test/t/unit/test_unit_compgen_{commands,filedir}.py", the
"class"-scope fixture "functions" are ensured to be initialized before
the "function"-scope fixture "completion", so we can use "completion"
even when the test relies on "functions".
[1] scop#1715 (comment)
In "test/t/{test_make.py,unit/test_compgen_filedir_xspec.py}", the
plain "completion = assert_complete(...)" can be replaced with
"@pytest.mark.complete" markers.
For "test/t/unit/test_unit_compgen_{commands,filedir}.py", the
"class"-scope fixture "functions" are ensured to be initialized before
the "function"-scope fixture "completion", so we can use "completion"
even when the test relies on "functions".
[1] #1715 (comment)
.NOTINTERMEDIATE(a GNU make 4.4 special target) was missing from theextractor's special-target skip list, so it leaked into completion on a
dotted prefix like
make .NOT<TAB>— a make directive, not a runnabletarget. The hidden-target guard only suppresses dotted names on an empty
or trailing-
/prefix, so the explicit list is the sole filter forspecials under a dotted partial prefix.
Fix: add
.NOTINTERMEDIATEto the list — a one-line, additive change,with a regression test/fixture.
.WAITand.EXTRA_PREREQSaredeliberately not added:
.WAITis a parse-consumed prerequisite markerand
.EXTRA_PREREQSis a variable, so neither surfaces as a target block.Follow-up from the #1693 review.