bugmake - Bugs: bug #66381, Stem splitting and directory...

 
 

bug #66381: Stem splitting and directory prefix reconstruction for static pattern rules.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sat 26 Oct 2024 08:38:30 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  SCM Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 27 Oct 2024 06:05:06 AM UTC, comment #2: 

The proposed patch will not work well on MS-Windows: it assumes that '/' is the only possible directory separator character, and it ignores the possibility of a drive letter in file names.

I hope these non-portable aspects will be fixed before this enhancement is accepted.

Eli Zaretskii <eliz>
Group Member
Sat 26 Oct 2024 08:43:21 PM UTC, comment #1: 

This commit introduces two user visible changes.

1. Split the stem for static pattern rules to dirname and basename.
With this feature static pattern rules do the same stem splitting and directory
prefix reconstruction as implicit search does for pattern rules.
This feature allows the same static pattern rule be used for targets in
different directories and with different prefixes.


$ ls
makefile
$ cat makefile
.SPLIT_STEM_FOR_STATIC_PATTERN_RULES:
obj:=drivers/hello.x pilots/video/world.x
all:$(obj)
$(obj): %.x: pre-%.q .%.d; $(info $@ from $^)
drivers/pre-hello.q drivers/.hello.d pilots/video/pre-world.q pilots/video/.world.d:;
$ make
drivers/hello.x from drivers/pre-hello.q drivers/.hello.d
pilots/video/world.x from pilots/video/pre-world.q pilots/video/.world.d
make: Nothing to be done for 'all'.


Suggested by Masahiro Yamada <masahiroy@kernel.org>.
https://lists.gnu.org/archive/html/help-make/2024-06/msg00018.html.


2. Allow a backslash to escape % in a prerequisite pattern of a static pattern
rule when second expansion is enabled. This allows static pattern rules to have
the same behavior whether second expansion is enabled or not.



$ ls
makefile
$ cat makefile

.SECONDEXPANSION:
all: hello.x
hello.x: %.x: $$(strip \%-%.q); $(info $@ from $<)
%-hello.q:;
$ make
hello.x from %-hello.q
make: Nothing to be done for 'all'.



Dmitry Goncharov <dgoncharov>
Sat 26 Oct 2024 08:38:30 PM UTC, original submission:  

.

Dmitry Goncharov <dgoncharov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #56575:  sv66381_split_stem.diff added by dgoncharov (50KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eliz (Posted a comment)
  • -email is unavailable- added by dgoncharov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-10-26 dgoncharov Attached File- Added sv66381_split_stem.diff, #56575

    Back to the top

    Powered by Savane 3.14-04e1.
    Corresponding source code