chiark / gitweb /
Makefile: Add a new thing for running arbitrary commands.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 5 May 2020 19:48:32 +0000 (20:48 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 5 May 2020 19:50:02 +0000 (20:50 +0100)
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.