URL: <https://savannah.gnu.org/bugs/?62162>
Summary: patsubst not working in prerequisites under .SECONDEXPANSION Project: make Submitted by: None Submitted on: Thu 10 Mar 2022 10:06:34 AM UTC Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 4.3 Operating System: POSIX-Based Fixed Release: None Triage Status: None _______________________________________________________ Details: For some reason `patsubst` function doesn't do its work in the following snippet. ``` prereq_files = 1-prereq 2-prereq all: prefix.stem.r1.ext files = $(foreach file,$(prereq_files),prefix.stem.r$(patsubst %-prereq,%,$(file)).ext) # Files is prefix.stem.r1.ext prefix.stem.r2.ext $(files) : %.ext : $$(patsubst r%,%,$$(lastword $$(subst .stem., ,$$*)))-prereq cat $< > $@ ``` I get `make: *** No rule to make target 'r1-prereq'` error, when trying to make `prefix.stem.r1.ext` which by design should depend on `1-prereq`. patsubst doesn't do its job and makes it depend on r1-prereq which is non-existent. Weirdly if I just use $(subst r,,<...>) everything is fine. Any ideas? -Mikhail _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Thu 10 Mar 2022 10:06:34 AM UTC Name: Makefile Size: 253B By: None <http://savannah.gnu.org/bugs/download.php?file_id=52975> _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62162> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/