Reputation: 3716
I have a makefile with a rule to build several targets and create a single package from it.
TARGETS=t1 t2 t3 t4
pack_it:
-for t in $(TARGETS); do \
$(MAKE) -C $$t install DESTDIR='temp' ); \
done
tar czvf package.tar.gz -C tmp *
Now I'd like to be able to pass, from command line, which targets I want to pack, like this:
make pack_it t1 t4
How must I test the arguments to know if I should run make install
on a target?
Thanks!
Upvotes: 1
Views: 97
Reputation: 212929
You can just override TARGETS
from the command line:
$ make pack_it TARGETS="t1 t4"
No need to change anything in the makefile.
Upvotes: 3