Makefile: Add a new thing for running arbitrary commands.
[distorted-chroot] / Makefile
index a3a1ecc..c9befaf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -648,6 +648,19 @@ maint: all check
 .PHONY: maint
 
 ###--------------------------------------------------------------------------
+### Running random commands.
+
+CMD                     = echo %d %a
+subst-command           = $(subst %d,$(call chroot-dist,$1), \
+                               $(subst %a,$(call chroot-arch,$1), \
+                                       $(subst %r,$1, $(CMD))))
+
+run: $(foreach c,$(ALL_CHROOTS),run/$c)
+$(foreach c,$(ALL_CHROOTS),run/$c): run/%:
+       $(V_AT)$(call v_print,RUN,$(call subst-command,$*))\
+               $(call subst-command,$*)
+
+###--------------------------------------------------------------------------
 ### Other maintenance targets.
 
 show:; : $x