bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #66381] Stem splitting and directory prefix reconstruction for stat


From: Dmitry Goncharov
Subject: [bug #66381] Stem splitting and directory prefix reconstruction for static pattern rules.
Date: Sat, 26 Oct 2024 16:43:25 -0400 (EDT)

Follow-up Comment #1, bug #66381 (group make):

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'.





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66381>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]