Reputation: 1181
I have the following rules in my Makefile:
appfile appfile.symbols:
build-the-app
distribute: appfile appfile.symbols
push -flag1 appfile -flag2 appfile.symbols
I would like to exchange push -flag1 appfile -flag2 appfile.symbols
to instead use the dependencies retrieved from $^
like push -flag1 $^1 -flag2 $^2
Is there any way of splitting $^ in order to achieve this?
Thanks.
Upvotes: 1
Views: 39
Reputation: 6994
When dependencies have a certain pattern, you can use filter
and filter-out
; e.g.
distribute: ...
push -flag1 $(filter-out %.symbols,$^) -flag2 $(filter %.symbols,$^)
Upvotes: 2
Reputation: 100956
The first prerequisite is in $<
. You can use the word
function in GNU make to get others (or for all of them if you prefer):
distribute: appfile appfile.symbols
push -flag1 $< -flag2 $(word 2,$^)
Upvotes: 4