chiark / gitweb /
Makefile: Add a new thing for running arbitrary commands.
[distorted-chroot] / Makefile
index a3a1eccb29e42e7ae2f0c82cac84680bc6ef0b5f..c9befaf25749639ef8e1028ac8bbefcb08f2b5a6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -647,6 +647,19 @@ maint: all check
        $(MAINT) -f$(FRESH) $(JOBS)
 .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.