-ifeq "$(BIN_DIST)" ""
- @echo "WARNING: To run the binary-dist target, you need to set BIN_DIST=1 in your build.mk" && exit 1
-endif
- -rm -rf $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)
- -$(RM) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME).tar.gz
- -echo "BIN_DIST_DIRS = $(BIN_DIST_DIRS)"
- @for i in $(BIN_DIST_DIRS); do \
- if test -d "$$i"; then \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM); \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM); \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
- echo $(MAKE) -C $$i $(MFLAGS) $(INSTALL_STAGE) install \
- prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM) \
- libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
- libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
- datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
- $(MAKE) -C $$i $(MFLAGS) $(INSTALL_STAGE) install \
- prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM) \
- libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
- libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM) \
- datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share; \
- fi; \
- done
+ $(MKDIRHIER) $(BIN_DIST_DIR)/mk
+ echo 'include $$(TOP)/Makefile-vars' > $(BIN_DIST_DIR)/mk/boilerplate.mk
+ echo 'include $$(TOP)/mk/package.mk' > $(BIN_DIST_DIR)/mk/target.mk
+ echo 'include $$(TOP)/mk/install.mk' >> $(BIN_DIST_DIR)/mk/target.mk
+ echo 'include $$(TOP)/mk/recurse.mk' >> $(BIN_DIST_DIR)/mk/target.mk
+ echo '' > $(BIN_DIST_DIR)/mk/compat.mk
+ cp mk/package.mk $(BIN_DIST_DIR)/mk/
+ cp mk/install.mk $(BIN_DIST_DIR)/mk/
+ cp mk/recurse.mk $(BIN_DIST_DIR)/mk/
+ cp mk/fptools.css $(BIN_DIST_DIR)/mk/
+ $(MKDIRHIER) $(BIN_DIST_DIR)/lib/$(TARGETPLATFORM)
+ $(MKDIRHIER) $(BIN_DIST_DIR)/share
+
+binary-dist::
+ $(MAKE) -C gmp binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C includes binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C compiler binary-dist DOING_BIN_DIST=YES $(INSTALL_STAGE)
+ $(MAKE) -C rts binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C driver binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C utils binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C docs binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C libraries binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C libraries/Cabal/doc binary-dist DOING_BIN_DIST=YES
+
+VARFILE=$(BIN_DIST_DIR)/Makefile-vars.in