My question concerns GNU's make.
If you have a sequence of commands that are useful as a recipe for several targets, a canned recipe comes in handy. I might look like this:
define run-foo
# Here comes a
# sequence of commands that are
# executed line by line
endef
Now you can use the canned recipe like this:
file1: input1:
$(run-foo)
$(pattern) : sub/% : %.inp
$(run-foo)
and so on. I wonder if it is possible to define canned recipes (or something similar) that take parameters, so that I could execute them like this:
file2: input2
$(run-foo) specific-parameter2 "additional"
file3: input3
$(run-foo) another-parameter3 "text"
Is this possible? Any hints welcome :)
You do this by:
$1
,$2
... etc in your define
-ed macro$(call ...)
e.g:
define recipe
echo $1
endef
all: t1 t2
t1:
$(call recipe,"One")
t2:
$(call recipe,"Two")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With