-###########################################
-#
-# Targets: dist binary-dist
-#
-###########################################
-
-
-#
-# dist-pre is a canned rule the toplevel of your source tree
-# would use as follows,
-#
-# dist :: dist-pre
-#
-# it performs two tasks, first creating the distribution directory
-# tree and it then decorates the new tree with symbolic links pointing
-# to the symbolic links in the build tree.
-#
-# The dist-pre relies on (at least) the `find' in GNU findutils
-# (only tested with version 4.1). All non-GNU `find's I have
-# laid on my hands locally, has a restrictive treatment of {} in
-# -exec commands, i.e.,
-#
-# find . -print echo a{} \;
-#
-# does not expand the {}, it has to be a separate argument (i.e. `a {}').
-# GNU find is (IMHO) more sensible here, expanding any {} it comes across
-# inside an -exec, whether it is a separate arg or part of a word:
-#
-# $ touch yes
-# $ find --version
-# GNU find version 4.1
-# $ find yes -exec echo oh,{}! \;
-# oh,yes!
-#
-# Of course, the above is not impossible to achieve with other finds,
-# just that GNU find does the Patently Right Thing here :)
-#
-# ====> if you're using these dist rules, get hold of GNU findutils.
-#
-# --SOF 2/97
-#
-.PHONY: dist dist-pre dist-post
-
-#
-# The dist rules leaves out CVS, SRC (from mkshadowdir) and tests
-# directories when creating shadow source distrib tree
-#
-dist-pre::
- -rm -rf $(SRC_DIST_DIR)
- -rm -f $(SRC_DIST_NAME).tar.gz
- (cd $(FPTOOLS_TOP_ABS); find $(SRC_DIST_DIRS) -type d \( -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -exec $(MKDIRHIER) $(SRC_DIST_DIR)/{} \; \) ; )
- (cd $(FPTOOLS_TOP_ABS); find $(SRC_DIST_DIRS) -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -name "*~" -prune -o -name ".cvsignore" -prune -o -type l -exec $(LN_S) $(FPTOOLS_TOP_ABS)/{} $(SRC_DIST_DIR)/{} \; )
-
-#
-# After having created a shadow distribution tree and copied/linked
-# all the necessary files to it, `dist-post' makes sure the permissions
-# are set right and then package up the tree. Empty directories are also removed.
-#
-# For now, we make the packaging a separate rule, so as to allow
-# the inspection of the dist tree before eventually packaging it up.
-#
-dist-post::
- @echo Deleting the following empty directories..
- ( cd $(SRC_DIST_DIR) ; cd .. ; find $(SRC_DIST_NAME) -type d -exec sh -c 'test x`ls $$0 | wc -l | sed -e "s/ //g"` = x0' {} \; -print -exec rm -rf {} \; -prune )
- ( cd $(SRC_DIST_DIR) ; cd .. ; chmod -R a+rw $(SRC_DIST_NAME) )
-
-dist-package::
- cd $(SRC_DIST_DIR); cd ..; $(TAR) chzf $(SRC_DIST_NAME).tar.gz $(SRC_DIST_NAME)
-
-#
-
-
-# The default dist rule:
-#
-# copy/link the contents of $(SRC_DIST_FILES) into the
-# shadow distribution tree. SRC_DIST_FILES contain the
-# build-generated files that you want to include in
-# a source distribution.
-#
-#
-ifneq "$(SRC_DIST_FILES)" ""
-dist::
- @for i in $(SRC_DIST_FILES); do \
- if (test -f "$$i"); then \
- echo $(LN_S) `pwd`/$$i $(SRC_DIST_DIR)/$$i ; \
- $(LN_S) `pwd`/$$i $(SRC_DIST_DIR)/$$i ; \
- fi; \
- done;
-endif
-
-#
-# binary-dist creates a binary bundle, set BIN_DIST_NAME
-# to package name and do `make binary-dist' (normally this
-# just a thing you would do from the toplevel of fptools or)
-# from the top of a project.
-#
-.PHONY: binary-dist-pre binary-dist binary-pack
-
-binary-dist-pre::
- -rm -rf $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)
- -rm -f $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME).tar.gz
- @for i in $(BIN_DIST_DIRS); do \
- if (test -d "$$i"); then \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion); \
- echo $(MAKE) -C $$i $(MFLAGS) install BIN_DIST=1 BIN_DIST_NAME=$(BIN_DIST_NAME) \
- prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \
- libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \
- libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \
- datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion) ; \
- $(MAKE) -C $$i $(MFLAGS) install BIN_DIST=1 BIN_DIST_NAME=$(BIN_DIST_NAME) \
- prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \
- bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \
- libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \
- libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \
- datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion) ; \
- fi; \
- done
-
-#
-# Do this separately for now
-#
-binary-pack::
- ( cd $(BIN_DIST_TMPDIR); $(TAR) chzf $(BIN_DIST_NAME).tar.gz $(BIN_DIST_NAME); rm -rf $(BIN_DIST_NAME) )
-
-ifneq "$(way)" ""
-package-way-dist::
- ( cd $(BIN_DIST_TMPDIR); find $(BIN_DIST_NAME)/ \( -name "*$(_way).a" -o -name "*.$(way_)hi" \) -print | xargs tar cvf $(BIN_DIST_TMPDIR)/ghc-$(ProjectVersion)-$(way)-$(TARGETPLATFORM).tar )
- gzip $(BIN_DIST_TMPDIR)/ghc-$(ProjectVersion)-$(way)-$(TARGETPLATFORM).tar
-endif
-
-ifneq "$(way)" ""
-remove-way-dist::
- ( cd $(BIN_DIST_TMPDIR); find $(BIN_DIST_NAME)/ \( -name "*$(_way).a" -o -name "*.$(way_)hi" \) -print -exec rm -f {} \; )
-endif
-
-###########################################