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!
You can just override
TARGETSfrom the command line:No need to change anything in the makefile.