summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2007-06-01 19:06:59 +0000
committerIan Lynagh <igloo@earth.li>2007-06-01 19:06:59 +0000
commit79b5a2cb4b9ed5fe41a05fa2ec98bd1f83971daf (patch)
tree0c416a30476cbc2ebeaa8b3ada902587f123f0e5
parent430453c5131592b6147a80202dc5f7fbe3f3d5fd (diff)
downloadhaskell-79b5a2cb4b9ed5fe41a05fa2ec98bd1f83971daf.tar.gz
Fix bindist creation
Bindists should now work again, when doing "make install" at least. "make in-place" is probably still broken.
-rw-r--r--Makefile65
-rw-r--r--aclocal.m467
-rw-r--r--configure.ac65
-rw-r--r--distrib/Makefile116
-rw-r--r--distrib/Makefile-bin-vars.in40
-rw-r--r--distrib/configure-bin.ac2
-rw-r--r--driver/Makefile6
-rw-r--r--driver/ghc/Makefile4
-rw-r--r--driver/ghci/Makefile4
-rw-r--r--driver/mangler/Makefile5
-rw-r--r--driver/split/Makefile5
-rw-r--r--libraries/Makefile50
-rw-r--r--libraries/mk/boilerplate.mk23
-rw-r--r--libraries/mk/target.mk17
-rw-r--r--mk/target.mk369
-rw-r--r--utils/Makefile18
-rw-r--r--utils/ghc-pkg/Makefile5
-rw-r--r--utils/hasktags/Makefile5
-rw-r--r--utils/hp2ps/Makefile5
-rw-r--r--utils/hsc2hs/Makefile7
-rw-r--r--utils/mkdirhier/Makefile5
-rw-r--r--utils/parallel/Makefile18
-rw-r--r--utils/prof/Makefile6
-rw-r--r--utils/prof/cgprof/Makefile5
-rw-r--r--utils/prof/icons/Makefile5
-rw-r--r--utils/runghc/Makefile5
-rw-r--r--utils/touchy/Makefile5
-rw-r--r--utils/unlit/Makefile5
28 files changed, 257 insertions, 675 deletions
diff --git a/Makefile b/Makefile
index 4491369699..af432d31ec 100644
--- a/Makefile
+++ b/Makefile
@@ -211,18 +211,7 @@ install-docs ::
# binary-dist is a GHC addition for binary distributions
#
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-BinDistShScripts = ghc-$(ProjectVersion) ghci-$(ProjectVersion) ghc-pkg-$(ProjectVersion) hsc2hs-ghc
-else
-BinDistShScripts =
-endif
-
-BinDistPrlScripts = ghcprof
-BinDistLibPrlScripts = ghc-asm ghc-split
-BinDistBins = hp2ps runghc
-BinDistLinks = ghc ghci ghc-pkg
-BinDistLibSplicedFiles = package.conf
-BinDistDirs = includes compiler docs driver rts utils
+BinDistDirs = includes compiler docs rts
BIN_DIST_TARBALL=ghc-$(ProjectVersion)-$(TARGETPLATFORM).tar.bz2
@@ -232,7 +221,6 @@ BIN_DIST_TOP= distrib/Makefile \
distrib/README \
ANNOUNCE \
LICENSE \
- utils/mkdirhier/mkdirhier \
install-sh \
config.guess \
config.sub \
@@ -251,7 +239,13 @@ binary-dist:: binary-dist-pre $(BINARY_DIST_PRE_RULES)
binary-dist-pre::
-rm -rf $(BIN_DIST_DIR)
-$(RM) $(BIN_DIST_DIR).tar.gz
- $(MKDIRHIER) $(BIN_DIST_DIR)/bin/$(TARGETPLATFORM)
+ $(MKDIRHIER) $(BIN_DIST_DIR)/mk
+ echo 'include $$(TOP)/Makefile-vars' > $(BIN_DIST_DIR)/mk/boilerplate.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/install.mk $(BIN_DIST_DIR)/mk/
+ cp mk/recurse.mk $(BIN_DIST_DIR)/mk/
$(MKDIRHIER) $(BIN_DIST_DIR)/lib/$(TARGETPLATFORM)
$(MKDIRHIER) $(BIN_DIST_DIR)/share
@@ -264,6 +258,10 @@ $(BINARY_DIST_PRE_RULES): binary-dist-pre-%:
libexecdir=$(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) \
datadir=$(BIN_DIST_DIR)/share
+binary-dist::
+ $(MAKE) -C driver binary-dist DOING_BIN_DIST=YES
+ $(MAKE) -C utils binary-dist DOING_BIN_DIST=YES
+
VARFILE=$(BIN_DIST_DIR)/Makefile-vars.in
binary-dist::
@@ -277,17 +275,11 @@ binary-dist::
echo > $(VARFILE)
echo "package = ghc" >> $(VARFILE)
echo "version = $(ProjectVersion)" >> $(VARFILE)
- echo "PACKAGE_SH_SCRIPTS = $(BinDistShScripts)" >> $(VARFILE)
- echo "PACKAGE_PRL_SCRIPTS = $(BinDistPrlScripts)" >> $(VARFILE)
- echo "PACKAGE_LIB_PRL_SCRIPTS = $(BinDistLibPrlScripts)" >> $(VARFILE)
- echo "PACKAGE_LIB_SPLICED_FILES = $(BinDistLibSplicedFiles)" >> $(VARFILE)
- echo "PACKAGE_BINS = $(BinDistBins)" >> $(VARFILE)
- echo "PACKAGE_OPT_BINS = $(BinDistOptBins)" >> $(VARFILE)
- echo "PACKAGE_LINKS = $(BinDistLinks)" >> $(VARFILE)
+ echo "ProjectVersion = $(ProjectVersion)" >> $(VARFILE)
cat distrib/Makefile-bin-vars.in >> $(VARFILE)
@echo "Generating a shippable configure script.."
$(MV) $(BIN_DIST_DIR)/configure-bin.ac $(BIN_DIST_DIR)/configure.ac
- ( cd $(BIN_DIST_DIR); autoconf )
+ ( cd $(BIN_DIST_DIR); autoreconf )
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
binary-dist::
@@ -348,35 +340,6 @@ $(BINARY_DIST_DOC_RULES): binary-dist-doc-%:
datadir=$(BIN_DIST_DIR)/share
endif
-# Rename scripts to $i.prl and $i.sh where necessary.
-# ToDo: do this in a cleaner way...
-
-ifneq "$(BinDistPrlScripts)" ""
-binary-dist::
- @for i in $(BinDistPrlScripts); do \
- echo "Renaming $$i to $$i.prl"; \
- $(MV) $(BIN_DIST_DIR)/bin/$(TARGETPLATFORM)/$$i $(BIN_DIST_DIR)/bin/$(TARGETPLATFORM)/$$i.prl; \
- done
-endif
-
-ifneq "$(BinDistLibPrlScripts)" ""
-binary-dist::
- @for i in $(BinDistLibPrlScripts); do \
- echo "Renaming $$i to $$i.prl"; \
- $(MV) $(BIN_DIST_DIR)/lib/$(TARGETPLATFORM)/$$i $(BIN_DIST_DIR)/lib/$(TARGETPLATFORM)/$$i.prl; \
- done
-endif
-
-ifneq "$(BinDistShScripts)" ""
-binary-dist::
- @for i in $(BinDistShScripts); do \
- if test -x $(BIN_DIST_DIR)/bin/$(TARGETPLATFORM)/$$i ; then \
- echo "Renaming $$i to $$i.sh"; \
- $(MV) $(BIN_DIST_DIR)/bin/$(TARGETPLATFORM)/$$i $(BIN_DIST_DIR)/bin/$(TARGETPLATFORM)/$$i.sh; \
- fi \
- done
-endif
-
.PHONY: binary-dist-doc-%
binary-dist::
diff --git a/aclocal.m4 b/aclocal.m4
index 0a6d27b104..f2762b30b8 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1094,4 +1094,71 @@ AC_DEFUN([CHECK_GMP],
AC_REQUIRE([AC_PROG_CC])
])
+# --------------------------------------------------------------
+# Calculate absolute path to build tree
+# --------------------------------------------------------------
+
+AC_DEFUN([FP_FIND_ROOT],[
+AC_MSG_CHECKING(for path to top of build tree)
+
+hardtop=`pwd`
+
+dnl Remove common automounter nonsense
+dnl
+hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
+
+dnl Find 'hardtop_plat', the native format for 'hardtop'
+dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes
+dnl being escaped).
+dnl
+dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert
+dnl /cygdrive/c/foo to c:/foo but we must not do that if we
+dnl aren't building using Cygwin (notably msys), because
+dnl cygpath doesn't exist. It seems that 'bash' sets
+dnl OSTYPE to 'cygwin' or 'msys' respectively, but cygwin's
+dnl 'sh' does not. So we hackily assume that if the shell
+dnl hasn't set it to 'msys' then we must be in Cygwin.
+dnl Sigh.
+dnl
+dnl The Right Thing is probably to test $BuildPlatform
+dnl instead, but we are sloppy about setting that correctly
+dnl at the moment, so we just work around for now.
+dnl
+dnl The quotes round "$(OSTYPE)" are essential, for the
+dnl Cygwin-sh case where OSTYPE is not set.
+case $HostPlatform in
+ i386-unknown-mingw32 | i386-unknown-cygwin32)
+ if test "${OSTYPE}" != "msys"
+ then
+ # convert $hardtop to a path that mingw will understand too
+ cyghardtop=${hardtop}
+ hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
+ hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
+ else
+dnl OK, so we're in the MSYS case. hardtop looks like /c/....
+dnl We want to make hardtop_plat into c:/...
+dnl Stop using [] for quotes temporarily, so we can use [] in the sed regexp
+changequote(, )dnl
+ hardtop_plat=`echo ${hardtop} | sed -e 's@^/\\([a-zA-Z]\\)/@\\1:/@g'`
+changequote([, ])dnl
+ fi
+ ;;
+ *)
+ hardtop_plat=${hardtop}
+ ;;
+esac
+AC_SUBST(hardtop)
+AC_SUBST(hardtop_plat)
+
+AC_MSG_RESULT(${hardtop})
+
+# We don't support building in directories with spaces.
+case "$hardtop" in
+ *' '*) AC_MSG_ERROR([
+ The build system does not support building in a directory containing
+ space characters. Suggestion: move the build tree somewhere else.])
+ ;;
+esac
+])
+
# LocalWords: fi
diff --git a/configure.ac b/configure.ac
index ce9e04b34e..8f7b0ab17f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -609,70 +609,7 @@ AC_SUBST(TargetVendor_CPP)
AC_SUBST(exeext)
-dnl --------------------------------------------------------------
-dnl * Calculate absolute path to build tree
-dnl --------------------------------------------------------------
-
-AC_MSG_CHECKING(for path to top of build tree)
-
-hardtop=`pwd`
-
-dnl Remove common automounter nonsense
-dnl
-hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^//\(.\)/|\1:/|' `
-
-dnl Find 'hardtop_plat', the native format for 'hardtop'
-dnl (i.e., right kind of \dnl slashes on a Win32 box, but with b-slashes
-dnl being escaped).
-dnl
-dnl Note OSTYPE: On Cygwin we need to use 'cygpath' to convert
-dnl /cygdrive/c/foo to c:/foo but we must not do that if we
-dnl aren't building using Cygwin (notably msys), because
-dnl cygpath doesn't exist. It seems that 'bash' sets
-dnl OSTYPE to 'cygwin' or 'msys' respectively, but cygwin's
-dnl 'sh' does not. So we hackily assume that if the shell
-dnl hasn't set it to 'msys' then we must be in Cygwin.
-dnl Sigh.
-dnl
-dnl The Right Thing is probably to test $BuildPlatform
-dnl instead, but we are sloppy about setting that correctly
-dnl at the moment, so we just work around for now.
-dnl
-dnl The quotes round "$(OSTYPE)" are essential, for the
-dnl Cygwin-sh case where OSTYPE is not set.
-case $HostPlatform in
- i386-unknown-mingw32 | i386-unknown-cygwin32)
- if test "${OSTYPE}" != "msys"
- then
- # convert $hardtop to a path that mingw will understand too
- cyghardtop=${hardtop}
- hardtop=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@/@g'`
- hardtop_plat=`cygpath -w ${cyghardtop} | sed -e 's@\\\\@\\\\\\\\@g'`
- else
-dnl OK, so we're in the MSYS case. hardtop looks like /c/....
-dnl We want to make hardtop_plat into c:/...
-dnl Stop using [] for quotes temporarily, so we can use [] in the sed regexp
-changequote(, )dnl
- hardtop_plat=`echo ${hardtop} | sed -e 's@^/\\([a-zA-Z]\\)/@\\1:/@g'`
-changequote([, ])dnl
- fi
- ;;
- *)
- hardtop_plat=${hardtop}
- ;;
-esac
-AC_SUBST(hardtop)
-AC_SUBST(hardtop_plat)
-
-AC_MSG_RESULT(${hardtop})
-
-# We don't support building in directories with spaces.
-case "$hardtop" in
- *' '*) AC_MSG_ERROR([
- The build system does not support building in a directory containing
- space characters. Suggestion: move the build tree somewhere else.])
- ;;
-esac
+FP_FIND_ROOT
dnl --------------------------------------------------------------
dnl * Project specific configuration options
diff --git a/distrib/Makefile b/distrib/Makefile
index 77b63e5adc..2b6cdca0c1 100644
--- a/distrib/Makefile
+++ b/distrib/Makefile
@@ -1,77 +1,9 @@
include Makefile-vars
-.PHONY: in-place config-pkgs mk-version-symlinks install-dirs install
-
-config-pkgs ::
- @echo "Configuring $(package), version $(version), on $(platform) ..."
- @for i in $(PACKAGE_PRL_SCRIPTS) ""; do \
- if test "$$i"; then \
- echo "Creating a configured version of $$i .."; \
- $(RM) bin/$(platform)/$$i.bak; \
- if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
- echo "#! $(PERL)" > bin/$(platform)/$$i ; \
- echo '$$'"bindir='$(bindir)';" >> bin/$(platform)/$$i ; \
- echo '$$'"libdir='$(libdir)';" >> bin/$(platform)/$$i ; \
- echo '$$'"libexecdir='$(libdir)';" >> bin/$(platform)/$$i ; \
- echo '$$'"datadir='$(datadir)';" >> bin/$(platform)/$$i ; \
- echo '$$'"SED='$(SED)';" >> bin/$(platform)/$$i ; \
- echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> bin/$(platform)/$$i ; \
- cat bin/$(platform)/$$i.prl >> bin/$(platform)/$$i ; \
- $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
- echo "Done."; \
- fi; \
- done
- @for i in $(PACKAGE_LIB_PRL_SCRIPTS) ""; do \
- if test "$$i"; then \
- echo "Creating a configured version of $$i .."; \
- $(RM) lib/$(platform)/$$i.bak; \
- if [ -f lib/$(platform)/$$i ]; then $(MV) lib/$(platform)/$$i lib/$(platform)/$$i.bak; fi; \
- echo "#! $(PERL)" > lib/$(platform)/$$i ; \
- echo '$$'"bindir='$(bindir)';" >> lib/$(platform)/$$i ; \
- echo '$$'"libdir='$(libdir)';" >> lib/$(platform)/$$i ; \
- echo '$$'"libexecdir='$(libdir)';" >> lib/$(platform)/$$i ; \
- echo '$$'"datadir='$(datadir)';" >> lib/$(platform)/$$i ; \
- echo '$$'"SED='$(SED)';" >> lib/$(platform)/$$i ; \
- echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> lib/$(platform)/$$i ; \
- cat lib/$(platform)/$$i.prl >> lib/$(platform)/$$i; \
- $(CHMOD) $(BIN_PERMS) lib/$(platform)/$$i; \
- echo "Done."; \
- fi; \
- done
- @for i in $(PACKAGE_SH_SCRIPTS) ""; do \
- if test "$$i"; then \
- echo "Creating a configured version of $$i .."; \
- $(RM) bin/$(platform)/$$i.bak; \
- if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
- echo "#! $(SH)" > bin/$(platform)/$$i ; \
- echo "bindir='$(bindir)'" >> bin/$(platform)/$$i ; \
- echo "libdir='$(libdir)'" >> bin/$(platform)/$$i ; \
- echo "libexecdir='$(libdir)'" >> bin/$(platform)/$$i ; \
- echo "datadir='$(datadir)'" >> bin/$(platform)/$$i ; \
- echo "SED='$(SED)'" >> bin/$(platform)/$$i ; \
- echo "DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)'" >> bin/$(platform)/$$i ; \
- cat bin/$(platform)/$$i.sh >> bin/$(platform)/$$i; \
- $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
- echo "Done."; \
- fi; \
- done
- @for i in $(PACKAGE_LIB_SPLICED_FILES) ""; do \
- if test "$$i"; then \
- echo "Creating a configured version of $$i .."; \
- $(PERL) -i.bak -lpe 's|\$$libdir|$(libdir)|g;s|\$$datadir|$(datadir)|g' lib/$(platform)/$$i; \
- fi; \
- done
- @if test "$(platform)" = "powerpc-apple-darwin"; then \
- echo "Configuring install names..."; \
- for i in lib/$(platform)/*; do \
- sh fix_install_names.sh "$(libdir)" "$$i"; \
- done; \
- echo "Done."; \
- fi
+.PHONY: in-place mk-version-symlinks install-dirs install
in-place ::
- $(MAKE) $(MFLAGS) config-pkgs bindir=`pwd`/bin/$(platform) libdir=`pwd`/lib/$(platform) datadir=`pwd`/share
@if test -x "./post-inplace-script" ; then \
echo "Running project-specific post-inplace script ..." ; \
./post-inplace-script $(platform) `pwd` \
@@ -82,12 +14,12 @@ in-place ::
install-dirs ::
$(INSTALL_DIR) $(bindir)
- (cd lib/$(platform); find . -type d -exec sh -c '../../$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; )
- (cd share; find . -type d -exec sh -c '../$(INSTALL_DIR) $(datadir)/$$0' {} \; )
+ (cd lib/$(platform); find . -type d -exec sh -c '$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; )
+ (cd share; find . -type d -exec sh -c '$(INSTALL_DIR) $(datadir)/$$0' {} \; )
-install :: config-pkgs install-dirs install-bin install-libs install-datas install-docs postinstall denounce
+install :: install-dirs install-driver install-utils install-libs install-datas install-docs postinstall denounce
-.PHONY: install-bin install-libs install-datas postinstall denounce
+.PHONY: install-libs install-utils install-datas postinstall denounce
denounce:
@echo
@@ -112,38 +44,18 @@ postinstall:
echo "Done" ; \
fi
-install-bin:
- for i in $(PACKAGE_BIN_INSTALL) ""; do \
- if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i $(bindir); fi; \
- done;
- for i in $(PACKAGE_BINS) ""; do \
- if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
- done;
- for i in $(PACKAGE_OPT_BINS) ""; do \
- if test -n "$$i" -a ! -f "$(bindir)/$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
- done;
- @for i in $(VERSION_SYMLINKS_FOR) ""; do \
- if [ "x$$i" != "x" ]; then \
- ( cd $(bindir); \
- if ( $(PERL) -e '$$fn="'$$i'"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
- echo "Creating a symbolic link from $$i-$(version) to $$i"; \
- $(RM) $$i; \
- $(LN_S) $$i-$(version) $$i; \
- else \
- echo "Creating a symbolic link from $$i-$(version) to $$i failed: \`$$i' already exists"; \
- echo "Perhaps remove \`$$i' manually?"; \
- exit 1; \
- fi;\
- ); \
- fi; \
- done
-
install-libs:
(cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; )
- $(MAKE) -C libraries install IN_BIN_DIST=1
+ $(MAKE) -C libraries install DOING_BIN_DIST=YES
+
+install-driver:
+ $(MAKE) -C driver install DOING_BIN_DIST=YES
+
+install-utils:
+ $(MAKE) -C utils install DOING_BIN_DIST=YES
install-datas:
- for i in `(cd share; find . -type f )`; do \
+ set -e; for i in `(cd share; find . -type f )`; do \
$(INSTALL_DATA) share/$$i $(datadir)/$$i; \
done
@@ -161,7 +73,7 @@ show-install-setup:
install-docs : install-dirs-docs
if test -d share/html ; then $(CP) -r share/html/* $(htmldir) ; fi
- for i in share/*.ps; do \
+ set -e; for i in share/*.ps; do \
if test -f "$$i"; then \
$(CP) $$i $(psdir) ; \
fi \
diff --git a/distrib/Makefile-bin-vars.in b/distrib/Makefile-bin-vars.in
index 53c4163606..0a4fdb98d1 100644
--- a/distrib/Makefile-bin-vars.in
+++ b/distrib/Makefile-bin-vars.in
@@ -1,7 +1,11 @@
+# Where we are
+bindist_abs_root = @hardtop@
+
# Where the different pieces of the bundle should go:
bindir = @bindir@
libdir = @libdir@/$(package)-$(version)
+libexecdir = $(libdir)
datadir = @datadir@/$(package)-$(version)
platform = @TargetPlatform@
@@ -26,28 +30,17 @@ exeext = @exeext@
SED = @SedCmd@
DEFAULT_TMPDIR = /tmp
-# sigh
-INSTALL_DIR = ./mkdirhier
-
-#
-# Set of package scripts for which you'd like a name-<version> symlink
-# to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to
-# avoid version vertigo.
-#
-VERSION_SYMLINKS_FOR=$(PACKAGE_LINKS)
-
-# Binaries to install
-PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS)
-
#----------end of user-serviceable parts------------
#
#
# How to install the different pieces
#
-INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS)
-INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS)
-INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS)
-INSTALL_SCRIPT = $(INSTALL) $(INSTALL_SCRIPT_OPTS)
+INSTALL_DIR = $(bindist_abs_root)/utils/mkdirhier/mkdirhier
+INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS)
+INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS)
+INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS)
+INSTALL_SCRIPT = $(INSTALL) $(INSTALL_SCRIPT_OPTS)
+INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_OPTS)
# What's common to all installs
INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)
@@ -55,8 +48,13 @@ INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)
BIN_PERMS = 755
LIB_PERMS = 644
-INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS)
-INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS)
-INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)
-INSTALL_SCRIPT_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_SCRIPT_OPTS)
+INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS)
+INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS)
+INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)
+INSTALL_SCRIPT_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_SCRIPT_OPTS)
+INSTALL_PROGRAM_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_PROGRAM_OPTS)
+
+EXECUTABLE_FILE = chmod $(BIN_PERMS)
+
+GHC_COMPAT_DIR=$(TOP)/mk
diff --git a/distrib/configure-bin.ac b/distrib/configure-bin.ac
index e50a50e3fb..fd8c2f15d9 100644
--- a/distrib/configure-bin.ac
+++ b/distrib/configure-bin.ac
@@ -108,6 +108,8 @@ echo "Which we'll further canonicalise into: $TargetPlatform"
AC_SUBST(TargetPlatform)
AC_SUBST(exeext)
+FP_FIND_ROOT
+
#
dnl ** Check Perl installation **
#
diff --git a/driver/Makefile b/driver/Makefile
index 3a87ab43c5..a8352090c1 100644
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -25,4 +25,10 @@ INSTALL_DATAS += package.conf ghc-usage.txt ghci-usage.txt
# re-installing packages.
CLEAN_FILES += package.conf* stamp-pkg-conf*
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/driver
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/driver
+ $(INSTALL_DATA) $(INSTALL_DATAS) $(BIN_DIST_DIR)/driver
+ set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist; done
+
include $(TOP)/mk/target.mk
diff --git a/driver/ghc/Makefile b/driver/ghc/Makefile
index 69abe6cb8a..3b481ec44a 100644
--- a/driver/ghc/Makefile
+++ b/driver/ghc/Makefile
@@ -23,4 +23,8 @@ endif
# -----------------------------------------------------------------------------
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/driver/ghc
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/driver/ghc/
+
include $(TOP)/mk/target.mk
diff --git a/driver/ghci/Makefile b/driver/ghci/Makefile
index 14e0c33775..2b15d94ed5 100644
--- a/driver/ghci/Makefile
+++ b/driver/ghci/Makefile
@@ -61,4 +61,8 @@ ghci.res : ghci.rc ghci.ico
windres -o ghci.res -i ghci.rc -O coff
endif
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/driver/ghci
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/driver/ghci/
+
include $(TOP)/mk/target.mk
diff --git a/driver/mangler/Makefile b/driver/mangler/Makefile
index 7c4d276b0c..aaec710d53 100644
--- a/driver/mangler/Makefile
+++ b/driver/mangler/Makefile
@@ -20,4 +20,9 @@ ifeq "$(BootingFromHc)" "YES"
boot :: all
endif
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/driver/mangler
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/driver/mangler/
+ $(INSTALL_PROGRAM) $(PROG) $(BIN_DIST_DIR)/driver/mangler/
+
include $(TOP)/mk/target.mk
diff --git a/driver/split/Makefile b/driver/split/Makefile
index 382388fe77..cc789203c9 100644
--- a/driver/split/Makefile
+++ b/driver/split/Makefile
@@ -15,4 +15,9 @@ all:: $(PROG).prl
INSTALL_LIBEXEC_SCRIPTS += $(PROG)
CLEAN_FILES += $(PROG) $(PROG).prl
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/driver/split
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/driver/split/
+ $(INSTALL_PROGRAM) $(PROG) $(BIN_DIST_DIR)/driver/split/
+
include $(TOP)/mk/target.mk
diff --git a/libraries/Makefile b/libraries/Makefile
index 7ac12431ed..b04c83b755 100644
--- a/libraries/Makefile
+++ b/libraries/Makefile
@@ -24,14 +24,10 @@
default_target: build
-ifeq "$(IN_BIN_DIST)" "1"
-include ../Makefile-vars
-else
# Ideally we'd just include something to give us variables
# for paths and arguments to tools etc, and those set in mk/build.mk.
-TOP=.
+TOP=..
include $(TOP)/mk/boilerplate.mk
-endif
SUBDIRS = base old-locale old-time directory process filepath pretty \
template-haskell readline Cabal random haskell98
@@ -89,6 +85,10 @@ else
dot_bat=
endif
+# -----------------------------------------------------------------------------
+
+ifneq "$(DOING_BIN_DIST)" "YES"
+
CONFIGURE_OPTS =
CONFIGURE_STAMP_EXTRAS :=
@@ -226,6 +226,25 @@ doc.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
%/setup/Setup ifBuildable/ifBuildable
ifBuildable/ifBuildable $* setup/Setup haddock
+.PHONY: distclean clean clean.library.%
+
+distclean: clean
+
+clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR))
+ $(RM) -f stamp/bootstrapping.*
+ $(RM) -rf bootstrapping.*
+ $(RM) -rf ifBuildable
+ $(RM) -f libraries.txt index.html doc-index.html
+
+$(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR)): \
+clean.library.%:
+ $(RM) -f stamp/configure.library.*.$* $*/unbuildable
+ -cd $* && setup/Setup clean
+ $(RM) -rf $*/setup
+endif
+
+# -----------------------------------------------------------------------------
+
.PHONY: install install-docs install.library.%
ROOT=$(prefix)/share/ghc/doc/html/
@@ -259,6 +278,8 @@ BIN_DIST_LIBDIR=$(BIN_DIST_DIR)/libraries
binary-dist: $(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR))
mkdir $(BIN_DIST_LIBDIR)/installPackage
cp installPackage/installPackage $(BIN_DIST_LIBDIR)/installPackage
+ mkdir $(BIN_DIST_LIBDIR)/ifBuildable
+ cp ifBuildable/ifBuildable $(BIN_DIST_LIBDIR)/ifBuildable
cp Makefile $(BIN_DIST_LIBDIR)
cp gen_contents_index $(BIN_DIST_LIBDIR)
cp index.html $(BIN_DIST_LIBDIR)
@@ -269,26 +290,13 @@ $(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR)): \
binary-dist.library.%:
$(MKDIRHIER) $(BIN_DIST_LIBDIR)/$*
ifBuildable/ifBuildable $* cp $*.cabal $(BIN_DIST_LIBDIR)/$*
+ ifBuildable/ifBuildable $* cp .setup-config $(BIN_DIST_LIBDIR)/$*
ifBuildable/ifBuildable $* cp -a dist $(BIN_DIST_LIBDIR)/$*
+ # Euch
+ ifBuildable/ifBuildable $* cp -aL include $(BIN_DIST_LIBDIR)/$* || :
ifBuildable/ifBuildable $* $(FIND) $(BIN_DIST_LIBDIR)/$*/dist \
\( -name "*_split" -o -name "autogen" \) | xargs rm -rf
ifBuildable/ifBuildable $* $(FIND) $(BIN_DIST_LIBDIR)/$*/dist \
\( \( -name "*.o" -o -name "*.p_o" \) -a ! -name "HS*" \) \
-exec rm {} \;
-.PHONY: distclean clean clean.library.%
-
-distclean: clean
-
-clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR))
- $(RM) -f stamp/bootstrapping.*
- $(RM) -rf bootstrapping.*
- $(RM) -rf ifBuildable
- $(RM) -f libraries.txt index.html doc-index.html
-
-$(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR)): \
-clean.library.%:
- $(RM) -f stamp/configure.library.*.$* $*/unbuildable
- -cd $* && setup/Setup clean
- $(RM) -rf $*/setup
-
diff --git a/libraries/mk/boilerplate.mk b/libraries/mk/boilerplate.mk
deleted file mode 100644
index 3f15f8d297..0000000000
--- a/libraries/mk/boilerplate.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# Begin by slurping in the boilerplate from one level up.
-# Remember, TOP is the top level of the innermost level
-# (FPTOOLS_TOP is the fptools top)
-
-# We need to set TOP to be the TOP that the next level up expects!
-# The TOP variable is reset after the inclusion of the fptools
-# boilerplate, so we stash TOP away first:
-LIBRARIES_TOP := $(TOP)
-TOP:=$(TOP)/..
-
-# Pull in the fptools boilerplate
-include $(TOP)/mk/boilerplate.mk
-
-# Reset TOP
-TOP:=$(LIBRARIES_TOP)
-
-# -----------------------------------------------------------------
-# Everything after this point
-# augments or overrides previously set variables.
-
--include $(TOP)/mk/paths.mk
--include $(TOP)/mk/opts.mk
--include $(TOP)/mk/suffix.mk
diff --git a/libraries/mk/target.mk b/libraries/mk/target.mk
deleted file mode 100644
index 8bb0edf7e8..0000000000
--- a/libraries/mk/target.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# $Id: target.mk,v 1.12 2002/07/02 13:49:27 simonmar Exp $
-
-TOP:=$(TOP)/..
-
-# All the libs in here are "hierarchical", this flag tell the
-# installation machinery to make sure that when installing interface
-# files we maintain the directory structure.
-HIERARCHICAL_LIB = YES
-
-# NOT YET: Haddock needs to understand about .raw-hs files
-#
-# Set our source links to point to the CVS repository on the web.
-# SRC_HADDOCK_OPTS += -s http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libaries/$(PACKAGE)
-
-include $(TOP)/mk/target.mk
-
-TOP:=$(LIBRARIES_TOP)/..
diff --git a/mk/target.mk b/mk/target.mk
index 6e2f0d6940..513b0dc02e 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -482,265 +482,7 @@ DllVersionInfo.$(way_)rc ExeVersionInfo.$(way_)rc:
echo " END" >> $@
echo "END" >> $@
-# ---------------------------------------------------------------------------
-# Symbolic links
-
-# links to programs: we sometimes install a program as
-# <name>-<version> with a link from <name> to the real program.
-
-ifneq "$(LINK)" ""
-
-ifeq "$(LINK_TARGET)" ""
-ifneq "$(HS_PROG)" ""
-LINK_TARGET = $(HS_PROG)
-else
-ifneq "$(C_PROG)" ""
-LINK_TARGET = $(C_PROG)
-else
-$(error Cannot deduce LINK_TARGET)
-endif
-endif
-endif
-
-#
-# install links to script drivers.
-#
-install ::
- @$(INSTALL_DIR) $(bindir)
- @if ( $(PERL) -e '$$fn="$(bindir)/$(LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
- echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(bindir)"; \
- $(RM) $(bindir)/$(LINK); \
- $(LN_S) $(LINK_TARGET) $(bindir)/$(LINK); \
- else \
- echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(bindir) failed: \`$(bindir)/$(LINK)' already exists"; \
- echo "Perhaps remove \`$(bindir)/$(LINK)' manually?"; \
- exit 1; \
- fi;
-
-endif # LINK
-
-
-###########################################
-#
-# Targets: install install-strip
-#
-###########################################
-
-# For each of these variables that is defined, you
-# get one install rule
-#
-# INSTALL_PROGS executable programs in $(bindir)
-# INSTALL_SCRIPTS executable scripts in $(bindir)
-# INSTALL_LIBS platform-dependent libraries in $(libdir) (ranlib'ed)
-# INSTALL_LIB_SCRIPTS platform-dependent scripts in $(libdir)
-# INSTALL_LIBEXECS platform-dependent execs in $(libdir)
-# INSTALL_DATAS platform-independent files in $(datadir)
-# INSTALL_IFACES platform-dependent interface files in $(ifacedir)
-#
-# If the installation directory variable is undefined, the install rule simply
-# emits a suitable error message.
-#
-# Remember, too, that the installation directory variables ($(bindir) and
-# friends can be overridden from their original settings in mk/config.mk.in
-# || mk/build.mk
-#
-.PHONY: install install-docs installdirs install-strip install-dirs install-docs show-install
-
-show-install :
- @echo "bindir = $(bindir)"
- @echo "libdir = $(libdir)"
- @echo "libexecdir = $(libexecdir) # by default, same as libdir"
- @echo "datadir = $(datadir) # unused for ghc project"
-
-#
-# Sometimes useful to separate out the creation of install directories
-# from the installation itself.
-#
-install-dirs ::
- @$(INSTALL_DIR) $(bindir)
- @$(INSTALL_DIR) $(libdir)
- @$(INSTALL_DIR) $(libexecdir)
- @$(INSTALL_DIR) $(datadir)
-
-# Better do this first...
-# but we won't for the moment, do it on-demand from
-# within the various install targets instead.
-#install:: install-dirs
-
-#
-# Setting user/group ownership for the installed entities
-#
-ifneq "$(INSTALL_OWNER)" ""
-SRC_INSTALL_OPTS += -o $(INSTALL_OWNER)
-endif
-ifneq "$(INSTALL_GROUP)" ""
-SRC_INSTALL_OPTS += -g $(INSTALL_GROUP)
-endif
-
-
-ifneq "$(strip $(INSTALL_PROGS))" ""
-
-#
-# Here's an interesting one - when using the win32 version
-# of install (provided via the cygwin toolkit), we have to
-# supply the .exe suffix, *if* there's no other suffix.
-#
-# The rule below does this by ferreting out the suffix of each
-# entry in the INSTALL_PROGS list. If there's no suffix, use
-# $(exeext).
-#
-INSTALL_PROGS := $(foreach p, $(INSTALL_PROGS), $(addsuffix $(if $(suffix $(p)),,$(exeext)), $(basename $(p))))
-
-install:: $(INSTALL_PROGS)
- @$(INSTALL_DIR) $(bindir)
- @for i in $(INSTALL_PROGS); do \
- echo $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(bindir); \
- $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(bindir) ; \
- if test "$(darwin_TARGET_OS)" = "1"; then \
- sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(bindir)/$$i ; \
- fi ; \
- done
-endif
-
-#
-# Just like INSTALL_PROGS, but prefix with install sites bin/lib/data and
-# install without stripping.
-#
-ifneq "$(strip $(INSTALL_SCRIPTS))" ""
-install:: $(INSTALL_SCRIPTS)
- @$(INSTALL_DIR) $(bindir)
- for i in $(INSTALL_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(bindir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_LIB_SCRIPTS))" ""
-install:: $(INSTALL_LIB_SCRIPTS)
- @$(INSTALL_DIR) $(libdir)
- for i in $(INSTALL_LIB_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(libdir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_LIBEXEC_SCRIPTS))" ""
-install:: $(INSTALL_LIBEXEC_SCRIPTS)
- @$(INSTALL_DIR) $(libexecdir)
- for i in $(INSTALL_LIBEXEC_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(libexecdir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_LIBS))" ""
-install:: $(INSTALL_LIBS)
- @$(INSTALL_DIR) $(libdir)
- for i in $(INSTALL_LIBS); do \
- case $$i in \
- *.a) \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(libdir); \
- $(RANLIB) $(libdir)/`basename $$i` ;; \
- *.dll) \
- $(INSTALL_DATA) -s $(INSTALL_OPTS) $$i $(libdir) ;; \
- *.so) \
- $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(libdir) ;; \
- *.dylib) \
- $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(libdir); \
- install_name_tool -id $(libdir)/`basename $$i` $(libdir)/`basename $$i` ;; \
- *) \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(libdir); \
- esac; \
- done
-endif
-
-ifneq "$(strip $(INSTALL_LIBEXECS))" ""
-#
-# See above comment next to defn of INSTALL_PROGS for what
-# the purpose of this one-liner is.
-#
-INSTALL_LIBEXECS := $(foreach p, $(INSTALL_LIBEXECS), $(addsuffix $(subst _,,$(subst __,$(exeext),_$(suffix $(p))_)), $(basename $(p))))
-
-install:: $(INSTALL_LIBEXECS)
- @$(INSTALL_DIR) $(libexecdir)
- -for i in $(INSTALL_LIBEXECS); do \
- $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(libexecdir); \
- if test "$(darwin_TARGET_OS)" = "1"; then \
- sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(libexecdir)/`basename $$i` ; \
- fi ; \
- done
-endif
-
-ifneq "$(strip $(INSTALL_DATAS))" ""
-install:: $(INSTALL_DATAS)
- @$(INSTALL_DIR) $(datadir)
- for i in $(INSTALL_DATAS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_IFACES))" ""
-install:: $(INSTALL_IFACES)
- @$(INSTALL_DIR) $(ifacedir)
- for i in $(INSTALL_IFACES); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(ifacedir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_IFACES_WITH_DIRS))" ""
-install:: $(INSTALL_IFACES_WITH_DIRS)
- @$(INSTALL_DIR) $(ifacedir)
- for i in $(INSTALL_IFACES_WITH_DIRS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(ifacedir)/`dirname $$i`; \
- done
-endif
-
-ifneq "$(strip $(INSTALL_INCLUDES))" ""
-install:: $(INSTALL_INCLUDES)
- @$(INSTALL_DIR) $(includedir)
- for i in $(INSTALL_INCLUDES); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(includedir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_DOCS))" ""
-ifneq "$(XMLDocWays)" ""
-install-docs:: $(INSTALL_DOCS)
- @$(INSTALL_DIR) $(datadir)
- for i in $(INSTALL_DOCS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir); \
- done
-endif
-endif
-
-# TODO: The following could be an entry for an Obfuscated Makefile Contest...
-ifneq "$(strip $(INSTALL_XML_DOC))" ""
-ifneq "$(XMLDocWays)" ""
-install-docs:: $(foreach i,$(XMLDocWays),$(INSTALL_XML_DOC)$(patsubst %.html-no-chunks,%.html,$(patsubst %.html,%/index.html,.$(i))))
- @$(INSTALL_DIR) $(datadir)
- @for i in $(XMLDocWays); do \
- if [ $$i = "html" ]; then \
- $(INSTALL_DIR) $(datadir)/html; \
- $(INSTALL_DIR) $(datadir)/html/$(INSTALL_XML_DOC); \
- echo "( cd $(INSTALL_XML_DOC) && $(CP) * $(datadir)/html/$(INSTALL_XML_DOC) )" ; \
- ( cd $(INSTALL_XML_DOC) && $(CP) * $(datadir)/html/$(INSTALL_XML_DOC) ) ; \
- else \
- $(INSTALL_DIR) $(datadir)/doc; \
- echo $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
- $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
- fi; \
- if [ $$i = "html-no-chunks" ]; then \
- echo $(CP) $(FPTOOLS_CSS_ABS) $(datadir)/doc; \
- $(CP) $(FPTOOLS_CSS_ABS) $(datadir)/doc; \
- fi \
- done
-endif
-endif
-
-#
-# install-strip is from the GNU Makefile standard.
-#
-ifneq "$(way)" ""
-install-strip::
- @$(MAKE) EXTRA_INSTALL_OPTS='-s' install
-endif
+include $(TOP)/mk/install.mk
##############################################################################
#
@@ -966,114 +708,7 @@ all docs TAGS clean distclean mostlyclean maintainer-clean install ::
endif
endif
-
-##################################################################
-#
-# Recursive stuff
-#
-# This was once at the top of the file, allegedly because it was
-# needed for some targets, e.g. when building DLLs in libraries. But
-# since this reason is a little short on information, and I'm having
-# trouble with subdirectory builds happening before the current
-# directory when building hslibs (bad interaction with including
-# _hsc.o files in the cbits lib) so I'm moving the recursive makes to
-# the end --SDM 12/12/2001
-#
-##################################################################
-
-# Here are the diabolically clever rules that
-#
-# (a) for each "recursive target" <t>
-# propagates "make <t>" to directories in SUBDIRS
-#
-# (b) when SUBDIRS is empty,
-# for each "multi-way-target" <t>
-# calls "make way=w <t>" for each w in $(WAYS)
-#
-# This has the effect of making the standard target
-# in each of the specified ways (as well as in the normal way
-
-# Controlling variables
-# WAYS = extra (beyond the normal way) ways to build things in
-# SUBDIRS = subdirectories to recurse into
-
-# No ways, so iterate over the SUBDIRS
-
-# note about recursively invoking make: we'd like make to drop all the
-# way back to the top level if it fails in any of the
-# sub(sub-...)directories. This is done by setting the -e flag to the
-# shell during the loop, which causes an immediate failure if any of
-# the shell commands fail.
-
-# One exception: if the user gave the -i or -k flag to make in the
-# first place, we'd like to reverse this behaviour. So we check for
-# these flags, and set the -e flag appropriately. NOTE: watch out for
-# the --no-print-directory flag which is passed to recursive
-# invocations of make.
-#
-ifeq "$(way)" ""
-ifneq "$(SUBDIRS)" ""
-
-# we override the 'boot', 'all' and 'install' targets in the top
-# level Makefile. Some of the sub-projects also set 'boot' to empty.
-
-ifeq "$(NO_ALL_TARGET)" "YES"
-ALL_TARGET =
-else
-ALL_TARGET = all
-endif
-
-ifeq "$(NO_BOOT_TARGET)" "YES"
-BOOT_TARGET =
-else
-BOOT_TARGET = boot
-endif
-
-ifeq "$(NO_INSTALL_TARGET)" "YES"
-INSTALL_TARGET =
-INSTALL_DOCS_TARGET =
-else
-INSTALL_TARGET = install
-INSTALL_DOCS_TARGET = install-docs
-endif
-
-$(ALL_TARGET) docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt::
- @echo "------------------------------------------------------------------------"
- @echo "== Recursively making \`$@' in $(SUBDIRS) ..."
- @echo "PWD = $(shell pwd)"
- @echo "------------------------------------------------------------------------"
-# Don't rely on -e working, instead we check exit return codes from sub-makes.
- @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
- if [ $$x_on_err -eq 0 ]; \
- then echo "Won't exit on error due to MFLAGS: ${MFLAGS}"; \
- fi; \
- for i in $(SUBDIRS); do \
- echo "------------------------------------------------------------------------"; \
- echo "== $(MAKE) $@ $(MFLAGS);"; \
- echo " in $(shell pwd)/$$i"; \
- echo "------------------------------------------------------------------------"; \
- $(MAKE) --no-print-directory -C $$i $(MFLAGS) $@; \
- if [ $$? -eq 0 -o $$x_on_err -eq 0 ]; \
- then echo "Finished making $@ in $$i": $$?; \
- else echo "Failed making $@ in $$i": $$?; exit 1; \
- fi; \
- done
- @echo "------------------------------------------------------------------------"
- @echo "== Finished making \`$@' in $(SUBDIRS) ..."
- @echo "PWD = $(shell pwd)"
- @echo "------------------------------------------------------------------------"
-
-endif
-endif
-
-#
-# Selectively building subdirectories.
-#
-#
-ifneq "$(SUBDIRS)" ""
-$(SUBDIRS) ::
- $(MAKE) -C $@ $(MFLAGS)
-endif
+include $(TOP)/mk/recurse.mk
# -----------------------------------------------------------------------------
# Further cleaning
diff --git a/utils/Makefile b/utils/Makefile
index a6f5f9af2e..276a736990 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -1,9 +1,9 @@
TOP=..
include $(TOP)/mk/boilerplate.mk
-ifeq "$(MAKING_BIN_DIST)" "1"
+ifeq "$(DOING_BIN_DIST)" "YES"
# We're doing a binary-dist, descend into a subset of the dirs.
-SUBDIRS = hp2ps unlit
+SUBDIRS = mkdirhier ghc-pkg hasktags hp2ps hsc2hs parallel prof unlit runghc
else
ifeq "$(BootingFromHc)" "YES"
SUBDIRS = mkdependC mkdirhier runstdtest genapply genprimopcode ghc-pkg unlit
@@ -11,17 +11,16 @@ else
SUBDIRS = mkdependC mkdirhier runstdtest ghc-pkg hasktags hp2ps hsc2hs \
parallel prof unlit genprimopcode genapply runghc
endif
+ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
+# lndir doesn't build on Windows
+SUBDIRS += lndir
+endif
endif
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
SUBDIRS += touchy
endif
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-# lndir doesn't build on Windows
-SUBDIRS += lndir
-endif
-
# Utils that we don't build by default:
# nofib-analyse
@@ -41,6 +40,11 @@ endif
# unlikely to want it desperately. It is easy to build once you have
# a Haskell compiler and if you want it.
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/
+ set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist; done
+
include $(TOP)/mk/target.mk
# genprimopcode is needed to boot in ghc/compiler...
diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile
index e4c8b74948..f3ebafcbba 100644
--- a/utils/ghc-pkg/Makefile
+++ b/utils/ghc-pkg/Makefile
@@ -90,4 +90,9 @@ boot :: depend
$(MAKE) all
endif
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/ghc-pkg
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/ghc-pkg/
+ $(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/ghc-pkg/
+
include $(TOP)/mk/target.mk
diff --git a/utils/hasktags/Makefile b/utils/hasktags/Makefile
index 99afec685d..c3178aca47 100644
--- a/utils/hasktags/Makefile
+++ b/utils/hasktags/Makefile
@@ -7,4 +7,9 @@ CLEAN_FILES += Main.hi
INSTALL_PROGS += $(HS_PROG)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/hasktags
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/hasktags/
+ $(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/hasktags/
+
include $(TOP)/mk/target.mk
diff --git a/utils/hp2ps/Makefile b/utils/hp2ps/Makefile
index 18cb05b1bd..7952bbb961 100644
--- a/utils/hp2ps/Makefile
+++ b/utils/hp2ps/Makefile
@@ -11,4 +11,9 @@ LIBS = $(LIBM)
CLEAN_FILES += $(C_OBJS) $(C_PROG)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/hp2ps
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/hp2ps/
+ $(INSTALL_PROGRAM) $(C_PROG) $(BIN_DIST_DIR)/utils/hp2ps/
+
include $(TOP)/mk/target.mk
diff --git a/utils/hsc2hs/Makefile b/utils/hsc2hs/Makefile
index 38be1f4d71..dedabb3c9c 100644
--- a/utils/hsc2hs/Makefile
+++ b/utils/hsc2hs/Makefile
@@ -79,4 +79,11 @@ endif
override datadir=$(libdir)
INSTALL_DATAS += template-hsc.h
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/hsc2hs
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/hsc2hs/
+ $(INSTALL_DATA) hsc2hs.sh $(BIN_DIST_DIR)/utils/hsc2hs/
+ $(INSTALL_DATA) $(INSTALL_DATAS) $(BIN_DIST_DIR)/utils/hsc2hs/
+ $(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/hsc2hs/
+
include $(TOP)/mk/target.mk
diff --git a/utils/mkdirhier/Makefile b/utils/mkdirhier/Makefile
index 1190557655..1e044e49b0 100644
--- a/utils/mkdirhier/Makefile
+++ b/utils/mkdirhier/Makefile
@@ -11,4 +11,9 @@ all::
cat $(PROG).sh >> $(PROG)
$(EXECUTABLE_FILE) $(PROG)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/mkdirhier
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/mkdirhier/
+ $(INSTALL_PROGRAM) $(PROG) $(BIN_DIST_DIR)/utils/mkdirhier/
+
include $(TOP)/mk/target.mk
diff --git a/utils/parallel/Makefile b/utils/parallel/Makefile
index b297de04c5..78bf6f0637 100644
--- a/utils/parallel/Makefile
+++ b/utils/parallel/Makefile
@@ -21,8 +21,15 @@ PERL_PROGS = \
BASH_PROGS = gr2ps gr2jv gr2ap gr2gran
-$(PERL_INSTALLERS) = $(addprefix install.perl.,$(PERL_PROGS))
-$(BASH_INSTALLERS) = $(addprefix install.bash.,$(BASH_PROGS))
+else
+
+PERL_PROGS =
+BASH_PROGS =
+
+endif
+
+PERL_INSTALLERS = $(addprefix install.perl.,$(PERL_PROGS))
+BASH_INSTALLERS = $(addprefix install.bash.,$(BASH_PROGS))
.PHONY: install.perl.%
.PHONY: install.bash.%
@@ -40,6 +47,13 @@ $(BASH_INSTALLERS): install.bash.%:
echo "#!$(BASH)" >> $(bindir)/$*
cat $*.bash >> $(bindir)/$*
$(EXECUTABLE_FILE) $(bindir)/$*
+
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/parallel
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/parallel/
+ifeq "$(INSTALL_PARALLEL_SCRIPTS)" "YES"
+ $(INSTALL_DATA) $(addsuffix .pl,$(PERL_PROGS)) $(BIN_DIST_DIR)/utils/parallel/
+ $(INSTALL_DATA) $(addsuffix .bash,$(BASH_PROGS)) $(BIN_DIST_DIR)/utils/parallel/
endif
include $(TOP)/mk/target.mk
diff --git a/utils/prof/Makefile b/utils/prof/Makefile
index 28e6f50bd6..4401c630a3 100644
--- a/utils/prof/Makefile
+++ b/utils/prof/Makefile
@@ -27,4 +27,10 @@ install::
cat ghcprof.prl >> $(INSTALLED_SCRIPT)
$(EXECUTABLE_FILE) $(INSTALLED_SCRIPT)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/prof
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/prof/
+ $(INSTALL_DATA) ghcprof.prl $(BIN_DIST_DIR)/utils/prof/
+ set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist; done
+
include $(TOP)/mk/target.mk
diff --git a/utils/prof/cgprof/Makefile b/utils/prof/cgprof/Makefile
index 17c567537a..bac0ab7d21 100644
--- a/utils/prof/cgprof/Makefile
+++ b/utils/prof/cgprof/Makefile
@@ -6,4 +6,9 @@ INSTALL_LIBEXECS=$(C_PROG)
SRC_CC_OPTS += -Wall -I$(GHC_INCLUDE_DIR)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/prof/cgprof
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/prof/cgprof/
+ $(INSTALL_DATA) $(C_PROG) $(BIN_DIST_DIR)/utils/prof/cgprof/
+
include $(TOP)/mk/target.mk
diff --git a/utils/prof/icons/Makefile b/utils/prof/icons/Makefile
index fde1b16d3a..bc125ac75c 100644
--- a/utils/prof/icons/Makefile
+++ b/utils/prof/icons/Makefile
@@ -4,4 +4,9 @@ include $(TOP)/mk/boilerplate.mk
override datadir=$(libdir)/icons
INSTALL_DATAS=$(wildcard *.xbm)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/prof/icons
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/prof/icons/
+ $(INSTALL_DATA) $(INSTALL_DATAS) $(BIN_DIST_DIR)/utils/prof/icons/
+
include $(TOP)/mk/target.mk
diff --git a/utils/runghc/Makefile b/utils/runghc/Makefile
index f210b004f3..1a176a084a 100644
--- a/utils/runghc/Makefile
+++ b/utils/runghc/Makefile
@@ -15,4 +15,9 @@ include $(GHC_COMPAT_DIR)/compat.mk
# we must also build with $(GhcHcOpts) here:
SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/runghc
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/runghc/
+ $(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/runghc/
+
include $(TOP)/mk/target.mk
diff --git a/utils/touchy/Makefile b/utils/touchy/Makefile
index d2430df162..0c580cfd43 100644
--- a/utils/touchy/Makefile
+++ b/utils/touchy/Makefile
@@ -18,3 +18,8 @@ include $(TOP)/mk/target.mk
# Get it over with!
boot :: all
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/touchy
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/touchy/
+ $(INSTALL_PROGRAM) $(C_PROG) $(BIN_DIST_DIR)/utils/touchy/
+
diff --git a/utils/unlit/Makefile b/utils/unlit/Makefile
index 15e7fc4252..dfa1b8db60 100644
--- a/utils/unlit/Makefile
+++ b/utils/unlit/Makefile
@@ -13,4 +13,9 @@ boot :: all
#
INSTALL_LIBEXECS += $(C_PROG)
+binary-dist:
+ $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/unlit
+ $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/unlit/
+ $(INSTALL_PROGRAM) $(C_PROG) $(BIN_DIST_DIR)/utils/unlit/
+
include $(TOP)/mk/target.mk