[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #55533] .SECONDARY with % pattern
From: |
anonymous |
Subject: |
[bug #55533] .SECONDARY with % pattern |
Date: |
Sun, 20 Jan 2019 20:39:00 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/71.0.3578.98 Chrome/71.0.3578.98 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?55533>
Summary: .SECONDARY with % pattern
Project: make
Submitted by: None
Submitted on: Mon 21 Jan 2019 01:38:58 AM UTC
Severity: 3 - Normal
Item Group: Enhancement
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: None
Operating System: Any
Fixed Release: None
Triage Status: None
_______________________________________________________
Details:
GNU Make automatically deletes intermediate files that are updated in a chain
of pattern rules.
People tend to abuse .PRECIOUS to suppress the deletion of
the intermediate patterns.
In the following test code, %.yyy is an intermediate pattern.
Test code 1
-----------
%.xxx: %.yyy
[ TAB ] cp $< $@
%.yyy: %.zzz
[ TAB ] cp $< $@
.PRECIOUS: %.yyy
Result 1
--------
$ touch a.zzz
$ make a.xxx
cp a.zzz a.yyy
cp a.yyy a.xxx
It is true that it can suppress the automatic deletion of %.yyy,
but it is not the correct usage of .PRECIOUS.
The use of .PRECIOUS is quite rare because it may leave partially constructed
(i.e. corrupted but its timestamp says
it is up-to-date) files when GNU Make is interrupted.
I know why people tend to abuse .PRECIOUS;
it is because .SECONDARY does not work against % pattern.
Test code 2
-----------
%.xxx: %.yyy
[ TAB ] cp $< $@
%.yyy: %.zzz
[ TAB ] cp $< $@
.SECONDARY: %.yyy
Result 2
--------
$ rm -f a.*
$ touch a.zzz
cp a.zzz a.yyy
cp a.yyy a.xxx
rm a.yyy
The prerequisites of the .SECONDARY target must be explicit
file paths or nothing.
(.SECONDARY with no prerequisites causes all targets to be treated as
secondary.)
But, considering the motivation of .SECONDARY, I believe it would be a good
improvement to make .SECONDARY work with % pattern.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55533>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #55533] .SECONDARY with % pattern,
anonymous <=