GNU make

Automatic variables

$ cat Makefile
all: foo_one foo_two

foo_%: bar_a bar_b
    @echo $*: this is $@ and it requires $^

bar_%: baz
    @echo $*: this is $@ and it requires $^

baz:
    @echo this is baz

$ make
this is baz
a: this is bar_a and it requires baz
b: this is bar_b and it requires baz
one: this is foo_one and it requires bar_a bar_b
two: this is foo_two and it requires bar_a bar_b

Links