+# sort removes duplicates - we don't actually care about the order
+WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE1))
+
+binary-dist: $(foreach P,$(WITH_STAGE1),binary-dist.$P)
+ echo $(WHERE_AM_I)/Makefile >> $(BIN_DIST_LIST)
+ set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist WHERE_AM_I=$(WHERE_AM_I)/$$d; done
+
+clean:: $(foreach P,$(WITH_EITHER),clean.$P)
+
+distclean:: $(foreach P,$(WITH_EITHER),distclean.$P)
+
+with-bootstrapping-compiler: \
+ $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
+
+with-stage-1: $(foreach P,$(WITH_STAGE1),with-stage-1.$P)
+
+install:: $(foreach P,$(WITH_STAGE1),install.$P)
+
+$(foreach P,$(WITH_EITHER),clean.$P): \
+clean.%:
+ $(MAKE) -C $* clean
+
+$(foreach P,$(WITH_EITHER),distclean.$P): \
+distclean.%:
+ $(MAKE) -C $* distclean
+
+$(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P): \
+with-bootstrapping-compiler.%:
+ $(MAKE) -C $* with-bootstrapping-compiler
+
+$(foreach P,$(WITH_STAGE1),with-stage-1.$P): \
+with-stage-1.%:
+ $(MAKE) -C $* with-stage-1
+
+$(foreach P,$(WITH_STAGE1),install.$P): \
+install.%:
+ $(MAKE) -C $* install
+
+$(foreach P,$(WITH_STAGE1),binary-dist.$P): \
+binary-dist.%:
+ $(MAKE) -C $* binary-dist WHERE_AM_I=$(WHERE_AM_I)/$*
+