Reputation: 4445
I have the following make
script (excerpt):
debug/abc-%.txt:
python buildtxt.py --firstFlag <second flag>
where <second flag>
should be --debug
if %
is debug
and empty (i.e. no flag) otherwise. This behaviour could simply be implemented in buildtxt.py
but I think doing it this way is more modular.
How can I easily implement this?
Upvotes: 0
Views: 369
Reputation: 96012
You want $(if $(filter debug,$*),--debug)
.
$*
expands to the string that matched %
. There's no built-in function to compare strings for equality, so we use filter
for that.
Upvotes: 1