[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiple Types of Pattern Matching in Make
From: |
Rahul Rameshbabu |
Subject: |
Multiple Types of Pattern Matching in Make |
Date: |
Thu, 26 Sep 2019 07:50:24 -0700 |
Hello,
My understanding is that % is a stem pattern matching operation, meaning it
requires at least one character for the pattern match (which makes sense if
there is no suffix). However, I wanted to know if there is a way to pattern
match with empty string given that there is a suffix.
An example is the following situation.
In my filesystem, I have the following files at let's say the same level in
my filesystem for now.
dependencies.config
linux_dependencies.config
windows_dependencies.config
where dependencies.config is a common configuration.
Let's say I write the following Makefile target as an example.
%dependencies.out: %dependencies.config
# Recipe would be here to create the target from the config...
I believe the above would capture 'linux_dependencies.config' and
'windows_dependencies.config' but not 'dependencies.config' since that
would lead to an empty stem. I believe to capture both, a separate rule can
be written for 'dependencies.config'. Not sure if there is a better way to
handle this situation from the Makefile perspective.
It would be interesting if there was some pattern match operator like %%
that can do empty string captures for pattern matching given there is a
non-empty suffix.
Thanks
-- Rahul Rameshbabu
- Multiple Types of Pattern Matching in Make,
Rahul Rameshbabu <=