chiark / gitweb /
Makefile: Add a new thing for running arbitrary commands.
[distorted-chroot] / Makefile
index 7479ae6693769af3727daf90a584d1ad4091bd67..c9befaf25749639ef8e1028ac8bbefcb08f2b5a6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -639,7 +639,7 @@ JOBS                         = chroot cross-tools pkg-build
 
 MAINTQ_                         = -q
 MAINTQ_0                = -q
-MAINT                   = +$(call v_tag,RUN)\
+MAINT                   = +$(call v_tag,MAINT)\
        PYTHONPATH=$(STATE)/lib/python $(STATE)/bin/chroot-maint \
                $(MAINTQ_$V) $(OPTS)
 
@@ -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.