-###########################################
-#
-# 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 -name "\#*" -prune -o -name ".\#*" -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) )
-
-# Automatic generation of a MANIFEST file for a source distribution
-# tree that is ready to go.
-dist-manifest ::
- cd $(SRC_DIST_DIR); find . \( -type l -o -type f \) -exec ls -lLG {} \; | sed -e 's/\.\///' > /tmp/MANIFEST ; mv /tmp/MANIFEST MANIFEST
-
-dist-package::
- cd $(SRC_DIST_DIR); cd ..; $(TAR) chzf $(SRC_DIST_NAME).tar.gz $(SRC_DIST_NAME)
-
-#
-# 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)/$(ProjectNameShort)-$(ProjectVersion); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion); \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion); \
- echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(ProjectVersion); \
- $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(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)/$(ProjectNameShort)-$(ProjectVersion) \
- libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \
- libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \
- datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(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)/$(ProjectNameShort)-$(ProjectVersion) \
- libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \
- libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \
- datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(ProjectVersion) ; \
- fi; \
- done
-