-############################################################################
-#
-# This is the top-level Makefile for GHC
-#
-# Targets:
-#
-# bootstrap (DEFAULT)
-# Builds GHC, then builds the libraries,
-# then uses this GHC ("stage 1") to build itself
-# ("stage 2").
-#
-# bootstrap2
-# Same as bootstrap
-#
-# bootstrap3
-# bootstrap2 + we build GHC one more time ("stage 3")
-#
-# stage1
-# Just build up to stage 1
-#
-# stage2
-# Just build stage 2 (stage 1 must be built)
-#
-# stage3
-# Just build stage 3 (stage 2 must be built)
-#
-# all
-# Same as bootstrap
-#
-# install
-# Install everything, including stage 2 compiler by default
-# (override with stage=3, for example).
-#
-# dist
-# Make a source dist (WARNING: runs 'make distclean' first)
-#
-# binary-dist
-# Builds a binary distribution
-#
-# framework-pkg [MacOS only]
-# Builds /Library/Frameworks/GHC.framework wrapped into a Mac
-# installer package
-#
-# framework-binary-dist [MacOS only]
-# Builds GHC.framework encapsulating a binary distribution
-# (to give a relocatable framework)
-#
-# hc-file-bundle
-# Builds an HC-file bundle, for bootstrapping
-#
-# clean, distclean, maintainer-clean
-# Increasing levels of cleanliness
-#
-############################################################################
-TOP=.
-include $(TOP)/mk/boilerplate.mk
+ifeq "$(wildcard distrib/)" ""
-#
-# Order is important! It's e.g. necessary to descend into include/
-# before the rest to have a config.h, etc.
-#
-# If we're booting from .hc files, swap the order
-# we descend into subdirs - to boot utils must be before driver.
-#
-.PHONY: stage1 stage2 stage3 bootstrap bootstrap2 bootstrap3
+# We're in a bindist
-# We can't 'make boot' in libraries until stage1 is built
-ifeq "$(BootingFromHc)" "YES"
-SUBDIRS_BUILD = includes compiler docs utils driver
-else
-SUBDIRS_BUILD = includes utils driver docs compiler libraries/Cabal/doc
-endif
+.PHONY: default
+default:
+ @echo 'Run "make install" to install'
+ @false
-SUBDIRS = gmp libffi includes utils docs rts compiler ghc driver libraries libraries/Cabal/doc
+.PHONY: install
+install:
+ $(MAKE) -r --no-print-directory -f ghc.mk install BINDIST=YES NO_INCLUDE_DEPS=YES
-check-all: check-packages check-tools
-
-# Sanity check that all the boot libraries are in the tree, to catch
-# failure to run darcs-all.
-check-packages :
- @ds=`grep "^[^# ][^ ]* *[^ ][^ ]* *[^ ][^ ]*$$" packages | sed "s/ .*//"`;\
- for d in $$ds; do \
- if test ! -d $$d; then \
- echo "Looks like you're missing $$d,"; \
- echo "maybe you haven't done './darcs-all get'?"; \
- exit 1; \
- fi \
- done
- @if test ! -f libraries/base/configure; then \
- echo "Looks like you're missing base's configure script."; \
- echo "Did you run 'sh boot' at the top level?"; \
- exit 1; \
- fi
-
-HAVE_EVAL := NO
-$(eval HAVE_EVAL := YES)
-
-check-tools:
-ifeq "$(HSCOLOUR_SRCS) $(HSCOLOUR)" "YES "
- @echo "HsColour needed but wasn't found."
- @echo "Set HSCOLOUR_SRCS=NO if you don't want to use it"
- exit 1
-endif
-ifeq "$(HAVE_EVAL)" "NO"
- @echo "Your make doesn't support eval. You need GNU make >= 3.80"
- exit 1
-endif
- @:
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-ifneq "$(WhatGccIsCalled)" ""
-GCC_LIB_DEP = stamp.inplace-gcc-lib
-endif
-endif
-
-stage1 : $(GCC_LIB_DEP) check-all
- $(MAKE) -C libraries boot
- $(MAKE) -C gmp all
- $(MAKE) -C utils/mkdependC boot
- $(MAKE) -C utils with-bootstrapping-compiler
- @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
- for i in $(SUBDIRS_BUILD); do \
- echo "------------------------------------------------------------------------"; \
- echo "== $(MAKE) boot $(MFLAGS);"; \
- echo " in $(shell pwd)/$$i"; \
- echo "------------------------------------------------------------------------"; \
- $(MAKE) --no-print-directory -C $$i $(MFLAGS) boot; \
- if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
- done; \
- for i in $(SUBDIRS_BUILD); do \
- echo "------------------------------------------------------------------------"; \
- echo "== $(MAKE) all $(MFLAGS);"; \
- echo " in $(shell pwd)/$$i"; \
- echo "------------------------------------------------------------------------"; \
- $(MAKE) --no-print-directory -C $$i $(MFLAGS) all; \
- if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
- done
- $(MAKE) -C libffi all
- $(MAKE) -C rts boot
- $(MAKE) -C rts
- $(MAKE) -C libraries all
-
-# When making distributions (i.e., whether with binary-dist or using the
-# vanilla install target to create an installer package), we can have problems
-# if some things (e.g. ghc-pkg) are compiled with the bootstrapping compiler
-# and some (e.g. the stage 2 compiler) with the stage1 compiler. See #1860 for
-# an example. Thus, we explicitly build a second version with the stage 1
-# compiler of all utils that get installed and of all extra support binaries
-# includes in binary dists.
-stage2 : check-all
- $(MAKE) -C compiler stage=2 boot
- $(MAKE) -C compiler stage=2
- $(MAKE) -C utils with-stage-2
- $(MAKE) -C libraries stage=2 all
-ifeq "$(HADDOCK_DOCS)" "YES"
- $(MAKE) -C libraries doc
- $(MAKE) -C compiler doc stage=2
-endif
+.PHONY: show
+show:
+ $(MAKE) -r --no-print-directory -f ghc.mk $@
-stage3 : check-all
- $(MAKE) -C compiler stage=3 boot
- $(MAKE) -C compiler stage=3
-
-bootstrap : bootstrap2
-
-bootstrap2 : stage1
- $(MAKE) stage2
-
-bootstrap3 : bootstrap2
- $(MAKE) stage3
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-ifneq "$(WhatGccIsCalled)" ""
-all :: stamp.inplace-gcc-lib
-
-.PHONY: stamp.inplace-gcc-lib
-
-# This is a hack to make Cabal able to find ld when we run tests with
-# the inplace ghc. We should probably install all the gcc stuff in our
-# tree somewhere, and then have install copy it from there rather than
-# from the filesystem.
-stamp.inplace-gcc-lib:
- $(RM) -r ghc/gcc-lib
- mkdir ghc/gcc-lib
- cp $(LD) ghc/gcc-lib
- touch $@
-
-clean ::
- $(RM) -r ghc/gcc-lib
- $(RM) -f inplace-gcc-lib
-endif
-endif
-
-all :: bootstrap
-
-# -----------------------------------------------------------------------------
-# Installing
-
-# We want to install the stage 2 bootstrapped compiler by default, but we let
-# the user override this by saying 'make install stage=1', for example.
-ifeq "$(stage)" ""
-INSTALL_STAGE = stage=2
else
-INSTALL_STAGE =
-endif
-
-install-strip:
- $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
-
-# Same as default rule, but we pass $(INSTALL_STAGE) to $(MAKE) too
-install :: check-packages
- $(MKDIRHIER) $(DESTDIR)$(datadir)
- echo "[]" > $(DESTDIR)$(datadir)/package.conf
- @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
- for i in $(SUBDIRS); do \
- echo "------------------------------------------------------------------------"; \
- echo "== $(MAKE) $@ $(MFLAGS);"; \
- echo " in $(shell pwd)/$$i"; \
- echo "------------------------------------------------------------------------"; \
- $(MAKE) --no-print-directory -C $$i $(INSTALL_STAGE) $(MFLAGS) $@; \
- if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
- done
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-# These files need to be in the InstallShield
-# INSTALL_DATAS rather than INSTALL_DOCS is used so these files go
-# in the top-level directory of the distribution
-INSTALL_DATAS += ANNOUNCE LICENSE README
-endif
-# If installing on Windows with MinGW32, copy the gcc compiler, headers and libs
-# and the perl interpreter and dll into the GHC prefix directory.
-# Gcc and Perl source locations derived from configuration data.
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-ifneq "$(WhatGccIsCalled)" ""
-install ::
- -mkdir $(prefix)/gcc-lib
- -mkdir $(prefix)/include
- -mkdir $(prefix)/include/mingw
- -cp -rp $(GccDir)../include/* $(prefix)/include/mingw
- -cp -rp $(GccDir)../lib/gcc-lib/mingw32/$(GccVersion)/* $(prefix)/gcc-lib
- -cp -rp $(GccDir)../lib/gcc/mingw32/$(GccVersion)/* $(prefix)/gcc-lib
- -cp -rp $(GccDir)../libexec/gcc/mingw32/$(GccVersion)/* $(prefix)/gcc-lib
- -cp $(GccDir)../lib/*.* $(prefix)/gcc-lib
- -cp $(GccDir)gcc.exe $(prefix)
- -cp $(GccDir)as.exe $(prefix)/gcc-lib
- -cp $(GccDir)ld.exe $(prefix)/gcc-lib
- -cp $(GccDir)dllwrap.exe $(prefix)/gcc-lib
- -cp $(GccDir)dlltool.exe $(prefix)/gcc-lib
- -cp $(GhcDir)../perl.exe $(prefix)
- -cp $(GhcDir)../perl56.dll $(prefix)
-endif
-endif
-
-# Install gcc-extra-opts
-install ::
- $(INSTALL_DIR) $(DESTDIR)$(libdir)
- $(INSTALL_DATA) $(INSTALL_OPTS) extra-gcc-opts $(DESTDIR)$(libdir)
+# The problem we need to solve is as follows.
+#
+# GNU make supports included Makefiles, and it is clever enough to try
+# to update those Makefiles when they are out-of-date or missing. It
+# first reads all the Makefiles, and then tries to build each one if
+# it is out-of-date, using the rules in the Makefiles themselves.
+# When it has brought all the Makefiles up-to-date, it restarts itself
+# to read the newly-generated Makefiles.
+#
+# This works fine, unless there are dependencies *between* the
+# Makefiles. For example in the GHC build, for each package we have a
+# package-data.mk file which is generated by the ghc-cabal program,
+# and we have a .depend file. The .depend file cannot be generated
+# until package-data.mk has been generated and make has been restarted
+# to read in its contents, because it is the package-data.mk file that
+# tells us which modules are in the package. But make always makes
+# all the Makefiles before restarting - it doesn't take into account a
+# dependency between Makefiles and restart itself earlier.
-install-docs ::
- @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
- for i in $(SUBDIRS); do \
- echo "------------------------------------------------------------------------"; \
- echo "== $(MAKE) $@ $(MFLAGS);"; \
- echo " in $(shell pwd)/$$i"; \
- echo "------------------------------------------------------------------------"; \
- $(MAKE) --no-print-directory -C $$i $(INSTALL_STAGE) $(MFLAGS) $@; \
- if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
- done
+# Consider the following makefile:
-# -----------------------------------------------------------------------------
-# Making a binary distribution
-#
-# `dist' `binary-dist'
-# Create a distribution tar file for this program. The tar file
-# should be set up so that the file names in the tar file start with
-# a subdirectory name which is the name of the package it is a
-# distribution for. This name can include the version number.
+# --------------------
+# all :
#
-# For example, the distribution tar file of GCC version 1.40 unpacks
-# into a subdirectory named `gcc-1.40'.
+# include inc1.mk
#
-# The easiest way to do this is to create a subdirectory
-# appropriately named, use ln or cp to install the proper files in
-# it, and then tar that subdirectory.
+# inc1.mk : Makefile
+# echo "X = C" >$@
#
-# The dist target should explicitly depend on all non-source files
-# that are in the distribution, to make sure they are up to date in
-# the distribution. See Making Releases.
-#
-# binary-dist is a GHC addition for binary distributions
+# include inc2.mk
#
+# inc2.mk : inc1.mk
+# echo "Y = $(X)" >$@
+# --------------------
-binary-dist::
- -rm -rf $(BIN_DIST_DIR)
- -$(RM) $(BIN_DIST_TAR_BZ2)
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-
-binary-dist::
- $(MAKE) prefix=$(BIN_DIST_DIR) install
- $(MAKE) prefix=$(BIN_DIST_DIR) install-docs
-
-binary-dist::
- cd $(BIN_DIST_DIR) && $(SHELL) ../distrib/prep-bin-dist-mingw
-
-binary-dist::
- $(MKDIRHIER) $(BIN_DIST_DIR)/icons
- cp distrib/hsicon.ico $(BIN_DIST_DIR)/icons
-
-# Tar up the distribution and build a manifest
-binary-dist :: tar-binary-dist
-
-.PHONY: tar-binary-dist
-tar-binary-dist:
- ( cd $(BIN_DIST_TOPDIR_ABS); $(TAR) cf - $(BIN_DIST_NAME) | bzip2 > $(FPTOOLS_TOP_ABS)/$(BIN_DIST_TAR_BZ2) )
- ( cd $(BIN_DIST_TOPDIR_ABS); bunzip2 -c $(FPTOOLS_TOP_ABS)/$(BIN_DIST_TAR_BZ2) | $(TAR) tf - | sed "s/^ghc-$(ProjectVersion)/fptools/" | sort >$(FPTOOLS_TOP_ABS)/bin-manifest-$(ProjectVersion) )
-
-else
-
-.PHONY: binary-dist
-
-BIN_DIST_VARFILE=$(BIN_DIST_PREP)/Makefile-vars.in
-
-WHERE_AM_I = $(BIN_DIST_NAME)
-
-binary-dist::
-# For the most part we will be putting filenames in $(BIN_DIST_LIST),
-# and telling tar to tar all of those files up. So to start with we
-# remove $(BIN_DIST_LIST) so that we can start with an empty slate
- $(RM) -f $(BIN_DIST_LIST)
-# Now we add a few files from mk/ to $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/mk/package.mk >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/mk/install.mk >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/mk/recurse.mk >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/mk/cabal.mk >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/mk/cabal-flags.mk >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/mk/fptools.css >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/ANNOUNCE >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/LICENSE >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/install-sh >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/extra-gcc-opts.in >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/config.guess >> $(BIN_DIST_LIST)
- echo $(WHERE_AM_I)/config.sub >> $(BIN_DIST_LIST)
-# Now we recurse into various subdirectories and tell them to add and
-# files that they want into $(BIN_DIST_LIST)
-# XXX Ug, this duplication of "-C foo WHERE_AM_I=.../foo" isn't nice.
- $(MAKE) -C gmp binary-dist WHERE_AM_I=$(WHERE_AM_I)/gmp
- $(MAKE) -C includes binary-dist WHERE_AM_I=$(WHERE_AM_I)/includes
- $(MAKE) -C compiler binary-dist WHERE_AM_I=$(WHERE_AM_I)/compiler $(INSTALL_STAGE)
- $(MAKE) -C ghc binary-dist WHERE_AM_I=$(WHERE_AM_I)/ghc $(INSTALL_STAGE)
- $(MAKE) -C rts binary-dist WHERE_AM_I=$(WHERE_AM_I)/rts
- $(MAKE) -C driver binary-dist WHERE_AM_I=$(WHERE_AM_I)/driver
- $(MAKE) -C utils binary-dist WHERE_AM_I=$(WHERE_AM_I)/utils
- $(MAKE) -C docs binary-dist WHERE_AM_I=$(WHERE_AM_I)/docs
- $(MAKE) -C libffi binary-dist WHERE_AM_I=$(WHERE_AM_I)/libffi
- $(MAKE) -C libraries binary-dist WHERE_AM_I=$(WHERE_AM_I)/libraries
- $(MAKE) -C libraries/Cabal/doc binary-dist WHERE_AM_I=$(WHERE_AM_I)/libraries/Cabal/doc
-# Now thinks get messier. Some files we need to move around, rename or
-# generate. We do this under $(BIN_DIST_PREP).
- $(RM) -rf $(BIN_DIST_PREP_DIR)
- $(MKDIRHIER) $(BIN_DIST_PREP)/mk
- echo 'include $$(TOP)/Makefile-vars' > $(BIN_DIST_PREP)/mk/boilerplate.mk
- echo 'include $$(TOP)/mk/package.mk' > $(BIN_DIST_PREP)/mk/target.mk
- echo 'include $$(TOP)/mk/install.mk' >> $(BIN_DIST_PREP)/mk/target.mk
- echo 'include $$(TOP)/mk/recurse.mk' >> $(BIN_DIST_PREP)/mk/target.mk
- touch $(BIN_DIST_PREP)/mk/bindist.mk
-ifeq "$(darwin_TARGET_OS)" "1"
- cp mk/fix_install_names.sh $(BIN_DIST_PREP)/mk
-endif
-
- cp distrib/Makefile $(BIN_DIST_PREP)
- cp distrib/INSTALL $(BIN_DIST_PREP)
- cp distrib/README $(BIN_DIST_PREP)
- cp distrib/configure-bin.ac $(BIN_DIST_PREP)/configure.ac
-# We can't just list aclocal.m4 in $(BIN_DIST_LIST), as it needs to be
-# next to configure.ac when we run autoreconf
- cp aclocal.m4 $(BIN_DIST_PREP)
- cd $(BIN_DIST_PREP) && autoreconf
-# We need to copy the pwd program that was built with stage1 to where
-# the build system expects to find it, i.e. the location the pwd built
-# with the bootstrapping compiler normally occupies
- $(MKDIRHIER) $(BIN_DIST_PREP)/utils/pwd
- cp utils/pwd/dist-install/build/pwd/pwd $(BIN_DIST_PREP)/utils/pwd
-# And likewise the installPackage program
- $(MKDIRHIER) $(BIN_DIST_PREP)/utils/installPackage/install-inplace/bin
- cp utils/installPackage/dist-install/build/installPackage/installPackage \
- $(BIN_DIST_PREP)/utils/installPackage/install-inplace/bin
-
- echo "package = ghc" >> $(BIN_DIST_VARFILE)
- echo "version = $(ProjectVersion)" >> $(BIN_DIST_VARFILE)
- echo "ProjectVersion = $(ProjectVersion)" >> $(BIN_DIST_VARFILE)
- echo "HaveLibGmp = $(HaveLibGmp)" >> $(BIN_DIST_VARFILE)
- echo "GhcLibsWithUnix = $(GhcLibsWithUnix)" >> $(BIN_DIST_VARFILE)
- echo "GhcWithInterpreter = $(GhcWithInterpreter)" >> $(BIN_DIST_VARFILE)
- echo "GhcHasEditline = $(GhcHasEditline)" >> $(BIN_DIST_VARFILE)
- echo "BootingFromHc = $(BootingFromHc)" >> $(BIN_DIST_VARFILE)
- echo "XMLDocWays = $(XMLDocWays)" >> $(BIN_DIST_VARFILE)
-# We won't actually use xsltproc, but we need to know if it's "" or not
- echo "XSLTPROC = $(XSLTPROC)" >> $(BIN_DIST_VARFILE)
- echo "TARGETPLATFORM = $(TARGETPLATFORM)" >> $(BIN_DIST_VARFILE)
- echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_VARFILE)
- echo "LATEX_DOCS = $(LATEX_DOCS)" >> $(BIN_DIST_VARFILE)
- echo "INTEGER_LIBRARY = $(INTEGER_LIBRARY)" >> $(BIN_DIST_VARFILE)
- cat distrib/Makefile-bin-vars.in >> $(BIN_DIST_VARFILE)
-
-# With that done, we can now build the actual tarball
-
- $(RM) -f $(BIN_DIST_NAME)
- ln -s . $(BIN_DIST_NAME)
-# h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
-# tree then we want to include the real file, not a symlink to it
- $(TAR) hcf $(BIN_DIST_TAR) -T $(BIN_DIST_LIST)
- cd $(BIN_DIST_PREP_DIR) && $(TAR) rf ../$(BIN_DIST_TAR) $(BIN_DIST_NAME)
- bzip2 < $(BIN_DIST_TAR) > $(BIN_DIST_TAR_BZ2)
- $(TAR) tf $(BIN_DIST_TAR) | sort > bin-manifest-$(ProjectVersion)
-endif
-
-PUBLISH_FILES = $(BIN_DIST_TAR_BZ2)
-
-# Upload the distribution and documentation
-ifneq "$(ISCC)" ""
-WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-$(TARGETPLATFORM)
-WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
-
-PUBLISH_FILES += $(WINDOWS_INSTALLER)
-
-binary-dist :: generate-windows-installer
-
-.PHONY: generate-windows-installer
-generate-windows-installer ::
- $(SED) "s/@VERSION@/$(ProjectVersion)/" distrib/ghc.iss | $(ISCC) /O. /F$(WINDOWS_INSTALLER_BASE) -
-endif
-
-# Upload the distribution and documentation
-ifneq "$(PublishLocation)" ""
-publish ::
- make publish-binary-dist 'prefix=$(BIN_DIST_INST_DIR)'
-endif
-
-nTimes = set -e; for i in `seq 1 $(1)`; do echo Try "$$i: $(2)"; if $(2); then break; fi; done
-
-.PHONY: publish-binary-dist
-publish-binary-dist ::
- @for f in $(PUBLISH_FILES); \
- do $(call nTimes,10,$(PublishCp) $$f $(PublishLocation)/dist); \
- done
-
-# You need to "make binddisttest" before publishing the docs, as it
-# works by publish setting $(prefix) to inside the binddisttest
-# directory so $(docdir) points to the right place.
-
-# We assume that Windows means Cygwin, as we can't just use docdir
-# unchanged or rsync (really SSH?) thinks that c:/foo means /foo on
-# the machine c.
-
-ifeq "$(Windows)" "YES"
-PUBLISH_DOCDIR = $(shell cygpath --unix $(docdir))
-else
-PUBLISH_DOCDIR = $(docdir)
-endif
-
-publish-binary-dist ::
- $(call nTimes,10,$(PublishCp) -r "$(PUBLISH_DOCDIR)"/* $(PublishLocation)/docs)
-
-binary-dist::
- @echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!"
-
-# -----------------------------------------------------------------------------
-# Building MacOS installer packages
-#
-# 'framework-pkg'
-# Create an installer package for /Library/Frameworks/GHC.framework
-#
-# 'framework-binary-dist'
-# Create an installer package for GHC.framework encapsulating a
-# binary-dist to make it relocatable
-# FIXME: This is only partially implemented so far
-
-ifeq "$(darwin_TARGET_OS)" "1"
-
-.PHONY: framework-pkg framework-binary-dist
-
-framework-pkg:
- $(MAKE) -C distrib/MacOS framework-pkg
-
-framework-binary-dist:
- $(MAKE) -C distrib/MacOS framework-binary-dist
-
-endif
-
-# -----------------------------------------------------------------------------
-# Building source distributions
-#
-# Do it like this:
-#
-# $ make
-# $ make dist
-#
-# WARNING: `make dist' calls `make distclean' before tarring up the tree.
-#
-
-.PHONY: dist
-
-#
-# Directory in which we're going to build the src dist
-#
-SRC_DIST_NAME=ghc-$(ProjectVersion)
-SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME)
+# Now try it:
+#
+# $ make -f fail.mk
+# fail.mk:3: inc1.mk: No such file or directory
+# fail.mk:8: inc2.mk: No such file or directory
+# echo "X = C" >inc1.mk
+# echo "Y = " >inc2.mk
+# make: Nothing to be done for `all'.
+# make built both inc1.mk and inc2.mk without restarting itself
+# between the two (even though we added a dependency on inc1.mk from
+# inc2.mk).
#
-# Files to include in source distributions
-#
-SRC_DIST_DIRS += mk docs distrib bindisttest $(filter-out docs distrib libraries/Cabal/doc,$(SUBDIRS))
-SRC_DIST_FILES += \
- configure.ac config.guess config.sub configure \
- aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \
- ghc.spec.in ghc.spec extra-gcc-opts.in VERSION boot
+# The solution we adopt in the GHC build system is essentially this:
-# -----------------------------------------------------------------------------
-# Source distributions
-
-# A source dist is built from a complete build tree, because we
-# require some extra files not contained in a darcs checkout: the
-# output from Happy and Alex, for example.
+# --------------------
+# PHASE = 0
#
-# The steps performed by 'make dist' are as follows:
-# - create a complete link-tree of the current build tree in /tmp
-# - run 'make distclean' on that tree
-# - remove a bunch of other files that we know shouldn't be in the dist
-# - tar up first the extralibs package, then the main source package
-
-EXTRA_LIBS=$(patsubst %, $(SRC_DIST_NAME)/%, $(shell grep -E "extralibs|dph" packages | grep -v "^\#" | sed "s/ .*//"))
-
-SRC_DIST_TARBALL = ghc-$(ProjectVersion)-src.tar.bz2
-SRC_DIST_EXTRALIBS_TARBALL = ghc-$(ProjectVersion)-src-extralibs.tar.bz2
-
-VERSION :
- echo $(ProjectVersion) >VERSION
-
-dist :: VERSION
-
-# Use:
-# $(call copy_generated_compiler_file,cmm,CmmLex,x)
-# to copy the generated file that replaces compiler/cmm/CmmLex.x
-# XXX Should this be unconditional? Do we want to support making a src dist
-# from an unbuilt tree?
-copy_generated_compiler_file = \
- if test -f $(FPTOOLS_TOP_ABS)/compiler/dist-stage2/build/$2.hs; \
- then \
- $(CP) $(FPTOOLS_TOP_ABS)/compiler/dist-stage2/build/$2.hs compiler/$1/ ; \
- mv compiler/$1/$2.$3 compiler/$1/$2.$3.source ; \
- fi
-copy_generated_util_file = \
- if test -f $(FPTOOLS_TOP_ABS)/utils/$1/dist-install/build/$1/$1-tmp/$2.hs; \
- then \
- $(CP) $(FPTOOLS_TOP_ABS)/utils/$1/dist-install/build/$1/$1-tmp/$2.hs utils/$1/ ; \
- mv utils/$1/$2.$3 utils/$1/$2.$3.source ; \
- fi
-
-dist ::
- $(RM) -rf $(SRC_DIST_DIR)
- $(RM) $(SRC_DIST_NAME).tar.gz
- mkdir $(SRC_DIST_DIR)
- ( cd $(SRC_DIST_DIR) \
- && for i in $(SRC_DIST_DIRS); do mkdir $$i; (cd $$i && lndir $(FPTOOLS_TOP_ABS)/$$i ); done \
- && for i in $(SRC_DIST_FILES); do $(LN_S) $(FPTOOLS_TOP_ABS)/$$i .; done \
- && $(MAKE) distclean \
- && if test -f $(FPTOOLS_TOP_ABS)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs; then $(CP) $(FPTOOLS_TOP_ABS)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs libraries/haskell-src/Language/Haskell/ ; mv libraries/haskell-src/Language/Haskell/Parser.ly libraries/haskell-src/Language/Haskell/Parser.ly.source ; fi \
- && $(call copy_generated_compiler_file,cmm,CmmLex,x) \
- && $(call copy_generated_compiler_file,cmm,CmmParse,y) \
- && $(call copy_generated_compiler_file,main,ParsePkgConf,y) \
- && $(call copy_generated_compiler_file,parser,HaddockLex,x) \
- && $(call copy_generated_compiler_file,parser,HaddockParse,y) \
- && $(call copy_generated_compiler_file,parser,Lexer,x) \
- && $(call copy_generated_compiler_file,parser,Parser,y.pp) \
- && $(call copy_generated_compiler_file,parser,ParserCore,y) \
- && $(call copy_generated_util_file,hpc,HpcParser,y) \
- && $(RM) -rf compiler/stage[123] mk/build.mk \
- && $(FIND) $(SRC_DIST_DIRS) \( -name _darcs -o -name SRC -o -name "autom4te*" -o -name "*~" -o -name ".cvsignore" -o -name "\#*" -o -name ".\#*" -o -name "log" -o -name "*-SAVE" -o -name "*.orig" -o -name "*.rej" \) -print | xargs $(RM) -rf \
- )
- $(TAR) chf - $(EXTRA_LIBS) | bzip2 >$(FPTOOLS_TOP_ABS)/$(SRC_DIST_EXTRALIBS_TARBALL)
- $(RM) -rf $(EXTRA_LIBS)
- $(TAR) chf - $(SRC_DIST_NAME) 2>$src_log | bzip2 >$(FPTOOLS_TOP_ABS)/$(SRC_DIST_TARBALL)
-
-# Upload the distribution(s)
-# Retrying is to work around buggy firewalls that corrupt large file transfers
-# over SSH.
-ifneq "$(PublishLocation)" ""
-dist ::
- @for i in 0 1 2 3 4 5 6 7 8 9; do \
- echo "Try $$i: $(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist"; \
- if $(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist; then break; fi; \
- done
- @for i in 0 1 2 3 4 5 6 7 8 9; do \
- echo "Try $$i: $(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist"; \
- if $(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist; then break; fi; \
- done
-endif
-
-# -----------------------------------------------------------------------------
-# HC file bundles
-
-hc-file-bundle :
- $(RM) -r ghc-$(ProjectVersion)
- $(LN_S) . ghc-$(ProjectVersion)
- $(FIND) ghc-$(ProjectVersion)/compiler \
- ghc-$(ProjectVersion)/utils \
- ghc-$(ProjectVersion)/libraries -follow \
- \( -name "*.hc" -o -name "*_hsc.[ch]" -o -name "*_stub.[ch]" \) -print > hc-files-to-go
- for f in `$(FIND) ghc-$(ProjectVersion)/compiler ghc-$(ProjectVersion)/utils ghc-$(ProjectVersion)/libraries -name "*.hsc" -follow -print` ""; do \
- if test "x$$f" != "x" && test -f `echo "$$f" | sed 's/hsc$$/hs/g'`; then \
- echo `echo "$$f" | sed 's/hsc$$/hs/g' ` >> hc-files-to-go ; \
- fi; \
- done;
- for f in `$(FIND) ghc-$(ProjectVersion)/compiler ghc-$(ProjectVersion)/rts -name "*.cmm" -follow -print` ""; do \
- if test "x$$f" != "x"; then \
- echo `echo "$$f" | sed 's/cmm$$/hc/g' ` >> hc-files-to-go ; \
- fi; \
- done;
- echo ghc-$(ProjectVersion)/libraries/base/GHC/PrimopWrappers.hs >> hc-files-to-go
- echo ghc-$(ProjectVersion)/compiler/parser/Parser.hs >> hc-files-to-go
- echo ghc-$(ProjectVersion)/compiler/parser/ParserCore.hs >> hc-files-to-go
- echo ghc-$(ProjectVersion)/compiler/main/ParsePkgConf.hs >> hc-files-to-go
- echo ghc-$(ProjectVersion)/libraries/haskell-src/Language/Haskell/Parser.hs >> hc-files-to-go
- $(TAR) czf ghc-$(ProjectVersion)-$(TARGETPLATFORM)-hc.tar.gz `cat hc-files-to-go`
-
-# -----------------------------------------------------------------------------
-# Cleaning
-
-CLEAN_FILES += hc-files-to-go *-hc.tar.gz
+# ifeq "$(PHASE)" "0"
+# all :
+# $(MAKE) PHASE=1
+# else
+# all :
+# endif
+#
+# -include inc1.mk
+#
+# inc1.mk : Makefile
+# echo "X = C" >$@
+#
+# ifneq "$(PHASE)" "0"
+# include inc2.mk
+#
+# inc2.mk : inc1.mk
+# echo "Y = $(X)" >$@
+# endif
+#
+# clean :
+# rm -f inc1.mk inc2.mk
+# --------------------
-DIST_CLEAN_FILES += config.cache config.status mk/config.h mk/stamp-h \
- docs/users_guide/ug-book.xml extra-gcc-opts
+# That is, every time make is invoked, we force it to update inc1.mk
+# and then restart. In the GHC build system we need to divide the
+# build into 4 phases in fact, with a restart between each phase. See
+# ghc.mk for the details on what happens in each phase and why.
-# don't clean config.mk: it's needed when cleaning stuff later on
-LATE_DIST_CLEAN_FILES += mk/config.mk mk/are-validating.mk
+default : all
+ @:
-# VERSION is shipped in a source dist
-MAINTAINER_CLEAN_FILES += VERSION
+# No need to update makefiles for these targets:
+REALGOALS=$(filter-out clean clean_% distclean maintainer-clean show,$(MAKECMDGOALS))
-extraclean::
- $(RM) -rf autom4te.cache
+# NB. not the same as saying '%: ...', which doesn't do the right thing:
+# it does nothing if we specify a target that already exists.
+.PHONY: $(REALGOALS)
+$(REALGOALS) all:
+ @echo "===--- updating makefiles phase 0"
+ $(MAKE) -r --no-print-directory -f ghc.mk phase=0 just-makefiles
+ @echo "===--- updating makefiles phase 1"
+ $(MAKE) -r --no-print-directory -f ghc.mk phase=1 just-makefiles
+ @echo "===--- updating makefiles phase 2"
+ $(MAKE) -r --no-print-directory -f ghc.mk phase=2 just-makefiles
+ @echo "===--- updating makefiles phase 3"
+ $(MAKE) -r --no-print-directory -f ghc.mk phase=3 just-makefiles
+ @echo "===--- finished updating makefiles"
+ $(MAKE) -r --no-print-directory -f ghc.mk $@
-clean distclean ::
- $(RM) -rf inplace-datadir
+binary-dist:
+ rm -f bindist-list
+ $(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
+ $(MAKE) -r --no-print-directory -f ghc.mk binary-dist
-clean distclean ::
- $(MAKE) -C bindisttest $@
- if test -d testsuite; then $(MAKE) -C testsuite $@; fi
+clean distclean maintainer-clean:
+ $(MAKE) -r --no-print-directory -f ghc.mk $@
+ test ! -d testsuite || $(MAKE) -C testsuite $@
-# -----------------------------------------------------------------------------
+$(filter clean_%, $(MAKECMDGOALS)) : clean_% :
+ $(MAKE) -r --no-print-directory -f ghc.mk $@
-# Turn off target.mk's rules for 'all', 'boot' and 'install'.
-NO_BOOT_TARGET=YES
-NO_ALL_TARGET=YES
-NO_INSTALL_TARGET=YES
+show:
+ $(MAKE) -r --no-print-directory -f ghc.mk $@
-include $(TOP)/mk/target.mk
+# If the user says 'make A B', then we don't want to invoke two
+# instances of the rule above in parallel:
+.NOTPARALLEL:
-# -----------------------------------------------------------------------------
+endif
# 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=..
-include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/config.mk
all:
$(RM) -rf $(BIN_DIST_INST_SUBDIR)
$(RM) -rf ghc*
$(RM) HelloWorld HelloWorld.o HelloWorld.hi output
# --force-local makes tar not think that c:/foo refers to a remote file
- $(TAR) --force-local -jxf $(FPTOOLS_TOP_ABS)/$(BIN_DIST_TAR_BZ2)
+ $(TAR) --force-local -jxf $(BIN_DIST_TAR_BZ2)
ifeq "$(Windows)" "YES"
mv $(BIN_DIST_NAME) $(BIN_DIST_INST_DIR)
else
# Check that we have all boot packages.
for dir in `grep "^[^# ][^ ]* *[^ ][^ ]* *[^ ][^ ]*$" packages | sed "s/ .*//"`
do
- if test ! -d $dir
+ if test ! -f $dir/LICENSE
then
- echo "Looks like you're missing $dir." >&2
+ echo "Error: $dir/LICENSE doesn't exist." >&2
echo "Maybe you haven't done './darcs-all get'?" >&2
exit 1
fi
fi
done
+for f in libraries/*; do
+ dir=`basename $f`
+ cabals=`echo $f/*.cabal`
+ if test -f $cabals; then
+ echo "Creating $f/ghc.mk"
+ rm -f $f/ghc.mk
+ pkg=`basename ${cabals%.cabal}`
+ echo "${f}_PACKAGE = ${pkg}" >> $f/ghc.mk
+ echo "\$(eval \$(call build-package,${f},dist-install,1))" >> $f/ghc.mk
+ rm -f $f/GNUmakefile
+ echo "Creating $f/GNUmakefile"
+ echo "dir = ${f}" >> $f/GNUmakefile
+ echo "TOP = ../.." >> $f/GNUmakefile
+ echo "include \$(TOP)/mk/sub-makefile.mk" >> $f/GNUmakefile
+ fi
+done
--- /dev/null
+The Glasgow Haskell Compiler License
+
+Copyright 2002, The University Court of the University of Glasgow.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+- Neither name of the University nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
+GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
-# -----------------------------------------------------------------------------
-# Main compiler Makefile
-
-# Targets:
-#
-# all builds stage1 compiler
-#
-# boot stage=N generate build dirs and dependencies for stage N.
-# NB. Must be done before 'make stageN'.
-# NB. Cannot 'make boot stage=2' until stage1 has
-# been built (similarly for stage3).
-#
-# stage1 (or stage=1) builds stage1 compiler
-# stage2 (or stage=2) builds stage2 compiler
-# stage3 (or stage=3) builds stage3 compiler
-#
-
+dir = compiler
TOP = ..
+SPEC_TARGETS = 1 2 3
+include $(TOP)/mk/sub-makefile.mk
-ifeq "$(stage)" ""
-stage=1
-endif
-
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/cabal-flags.mk
-
-ifeq "$(GhcThreaded) $(GhcProfiled)" "YES YES"
-$(error Cannot make GHC both threaded and profiled)
-endif
-
-CONFIG_HS = main/Config.hs
-PRIMOP_BITS = primop-data-decl.hs-incl \
- primop-tag.hs-incl \
- primop-list.hs-incl \
- primop-has-side-effects.hs-incl \
- primop-out-of-line.hs-incl \
- primop-commutable.hs-incl \
- primop-needs-wrapper.hs-incl \
- primop-can-fail.hs-incl \
- primop-strictness.hs-incl \
- primop-primop-info.hs-incl
-
-boot:: boot.stage.$(stage)
-
-all:: build.stage.$(stage)
-
-doc:: doc.stage.$(stage)
-
-stage1 ::
- $(MAKE) stage=1
-
-stage2 ::
- $(MAKE) stage=2
-
-stage3 ::
- $(MAKE) stage=3
-
-ifeq "$(CLEAN_ALL_STAGES)" "YES"
-clean distclean maintainer-clean::
- $(RM) -f prelude/primops.txt
- $(RM) -f $(PRIMOP_BITS)
- $(RM) -f $(CONFIG_HS)
- $(RM) -f parser/Parser.y
- $(RM) -rf stage1 stage2plus
- $(RM) -f $(STAGE3_PACKAGE_CONF)
-endif
-
-ifeq "$(CLEAN_ALL_STAGES)" "YES"
-clean distclean maintainer-clean:: clean.stage.1 clean.stage.2 clean.stage.3
-else
-clean distclean maintainer-clean:: clean.stage.$(stage)
-endif
-
-ifeq "$(CLEAN_ALL_STAGES)" "YES"
-distclean maintainer-clean::
- $(RM) -f ghc.cabal
-endif
-
-clean.stage.%:
- $(RM) -f Makefile-stage$*
-# This is a bit naughty. We ought to use:
-# -$(CABAL) clean --distpref dist-stage$*
-# but that won't work if the Cabal file (a generated file) doesn't
-# exist. So we do this instead:
- $(RM) -rf dist-stage$*
-
-CONFIGURE_FLAGS_STAGE1 += --flags=stage1
-CONFIGURE_FLAGS_STAGE2 += --flags=-stage1
-
-ifeq "$(GhcWithNativeCodeGen)" "YES"
-CONFIGURE_FLAGS_STAGE1 += --flags=ncg
-CONFIGURE_FLAGS_STAGE2 += --flags=ncg
-endif
-
-ifeq "$(GhcWithInterpreter)" "YES"
-CONFIGURE_FLAGS_STAGE2 += --flags=ghci
-
-ifeq "$(BuildSharedLibs)" "YES"
-CONFIGURE_FLAGS_STAGE2 += --enable-shared
-# If we are going to use dynamic libraries instead of .o files for ghci,
-# we will need to always retain CAFs in the compiler.
-# ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
-# function which sets the keepCAFs flag for the RTS before any Haskell
-# code is run.
-CONFIGURE_FLAGS_STAGE2 += --flags=dynlibs
-endif
-
-ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
-# Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
-# or not?
-# XXX This should logically be a CPP option, but there doesn't seem to
-# be a flag for that
-CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DGHCI_TABLES_NEXT_TO_CODE
-endif
-
-# Should the debugger commands be enabled?
-ifeq "$(GhciWithDebugger)" "YES"
-CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DDEBUGGER
-endif
-
-# Enable editline if:
-# - we're building stage 2/3, and we have built the editline package
-#
-# But we don't enable editline on Windows, as Windows terminals have
-# editline-like support builtin.
-#
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/editline/unbuildable)" ""
-CONFIGURE_FLAGS_STAGE2 += --flags=editline
-endif
-endif
-endif
-
-ifeq "$(GhcWithNativeCodeGen)" "NO"
-# XXX This should logically be a CPP option, but there doesn't seem to
-# be a flag for that
-COMMON_CONFIGURE_FLAGS += --ghc-option=-DOMIT_NATIVE_CODEGEN
-endif
-
-ifeq "$(TargetOS_CPP)" "openbsd"
-COMMON_CONFIGURE_FLAGS += --ld-options=-E
-endif
-
-ifeq "$(GhcUnregisterised)" "NO"
-ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
-# needed for generating proper relocation in large binaries: trac #856
-COMMON_CONFIGURE_FLAGS += --ld-option=-Wl,--relax
-endif
-endif
-
-# We need to turn on profiling either if we have been asked to
-# (GhcLibProfiled = YES) or if we want GHC itself to be compiled with
-# profiling enabled (GhcProfiled = YES).
-ifneq "$(GhcLibProfiled) $(GhcProfiled)" "NO NO"
-CONFIGURE_FLAGS_STAGE2 += --enable-library-profiling
-# And if we're profiling GHC then we want lots of SCCs.
-# We also don't want to waste time building the non-profiling library,
-# either normally or for ghci. Unfortunately this means that we have to
-# tell ghc-pkg --force as it gets upset when libHSghc-6.9.a doesn't
-# exist.
-ifeq "$(GhcProfiled)" "YES"
-CONFIGURE_FLAGS_STAGE2 += --ghc-option=-auto-all
-CONFIGURE_FLAGS_STAGE2 += --disable-library-vanilla
-CONFIGURE_FLAGS_STAGE2 += --disable-library-for-ghci
-CONFIGURE_FLAGS_STAGE2 += --ghc-pkg-option=--force
-endif
-endif
-
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-# The #include is vital for the via-C route with older compilers, else the C
-# compiler doesn't realise that the stcall foreign imports are indeed
-# stdcall, and doesn't generate the Foo@8 name for them
-# As it's only important for older compilers we don't need to do anything
-# for stage2+.
-CONFIGURE_FLAGS_STAGE1 += --ghc-option='-\#include' \
- --ghc-option='"<windows.h>"' \
- --ghc-option='-\#include' \
- --ghc-option='"<process.h>"'
-endif
-
-# ghc_strlen percolates through so many modules that it is easier to get its
-# prototype via a global option instead of a myriad of per-file OPTIONS.
-# Again, this is only important for older compilers, so we don't do it in
-# stage 2+.
-CONFIGURE_FLAGS_STAGE1 += --ghc-options='-\#include "cutils.h"'
-
-CONFIGURE_FLAGS_STAGE3 = $(CONFIGURE_FLAGS_STAGE2)
-CONFIGURE_FLAGS_STAGE1 += $(USE_BOOT_CONFIGURE_FLAGS)
-CONFIGURE_FLAGS_STAGE2 += $(USE_STAGE1_CONFIGURE_FLAGS)
-CONFIGURE_FLAGS_STAGE3 += $(USE_STAGE2_CONFIGURE_FLAGS)
-CONFIGURE_FLAGS_STAGE3 += --package-db $(STAGE3_PACKAGE_CONF)
-
-# In a source dist we don't need to worry about Parser.y(.pp) as we have
-# the .hs file pre-generated
-ifneq "$(wildcard parser/Parser.y.pp)" ""
-PARSER_Y = parser/Parser.y
-endif
-
-boot.stage.%: $(PRIMOP_BITS) $(CONFIG_HS) $(PARSER_Y)
- test -f $(STAGE3_PACKAGE_CONF) || echo "[]" > $(STAGE3_PACKAGE_CONF)
- $(CABAL) configure --distpref dist-stage$* \
- $(CONFIGURE_FLAGS_STAGE$*) \
- $(INSTALL_DIRS_CONFIGURE_FLAGS) \
- $(COMMON_CONFIGURE_FLAGS) \
- --ghc-option=-DSTAGE=$*
- $(RM) -f Makefile-stage$*
- $(CABAL) makefile --distpref dist-stage$* -f Makefile-stage$*
-
-build.stage.%:
- $(MAKE) -f Makefile-stage$* stage=$*
- $(CABAL) register --distpref dist-stage$* --inplace
- $(MAKE) -C ../ghc stage=$*
-
-doc.stage.%:
- $(CABAL) haddock --distpref dist-stage$* \
- --html-location='../$$pkg' \
- --haddock-option=--optghc=-DSTAGE=$* \
- --haddock-option=+RTS --haddock-option=-s --haddock-option=-c --haddock-option=-RTS \
- --with-haddock=$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace/bin/haddock
-
-install:
- $(INSTALL_PACKAGE) install '$(GHC_PKG_INSTALL_PROG)' '$(DESTDIR)$(datadir)/package.conf' '$(DESTDIR)' '$(prefix)' '$(iprefix)' '$(ibindir)' '$(ilibdir)' '$(ilibexecdir)' '$(idynlibdir)' '$(idatadir)' '$(idocdir)' '$(ihtmldir)' '$(ihaddockdir)' --distpref dist-stage2
-
-# -----------------------------------------------------------------------------
-# Create compiler configuration
-#
-# The 'echo' commands simply spit the values of various make variables
-# into Config.hs, whence they can be compiled and used by GHC itself
-
-$(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
- @$(RM) -f $(CONFIG_HS)
- @echo "Creating $(CONFIG_HS) ... "
- @echo "module Config where" >>$(CONFIG_HS)
- @echo "cProjectName :: String" >> $(CONFIG_HS)
- @echo "cProjectName = \"$(ProjectName)\"" >> $(CONFIG_HS)
- @echo "cProjectVersion :: String" >> $(CONFIG_HS)
- @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
- @echo "cProjectVersionInt :: String" >> $(CONFIG_HS)
- @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
- @echo "cProjectPatchLevel :: String" >> $(CONFIG_HS)
- @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
- @echo "cBooterVersion :: String" >> $(CONFIG_HS)
- @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
- @echo "cStage :: String" >> $(CONFIG_HS)
- @echo "cStage = show (STAGE :: Int)" >> $(CONFIG_HS)
- @echo "cHscIfaceFileVersion :: String" >> $(CONFIG_HS)
- @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
- @echo "cSplitObjs :: String" >> $(CONFIG_HS)
- @echo "cSplitObjs = \"$(SupportsSplitObjs)\"" >> $(CONFIG_HS)
- @echo "cGhcWithInterpreter :: String" >> $(CONFIG_HS)
- @echo "cGhcWithInterpreter = \"$(GhcWithInterpreter)\"" >> $(CONFIG_HS)
- @echo "cGhcWithNativeCodeGen :: String" >> $(CONFIG_HS)
- @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
- @echo "cGhcWithSMP :: String" >> $(CONFIG_HS)
- @echo "cGhcWithSMP = \"$(GhcWithSMP)\"" >> $(CONFIG_HS)
- @echo "cGhcRTSWays :: String" >> $(CONFIG_HS)
- @echo "cGhcRTSWays = \"$(GhcRTSWays)\"" >> $(CONFIG_HS)
- @echo "cGhcUnregisterised :: String" >> $(CONFIG_HS)
- @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
- @echo "cGhcEnableTablesNextToCode :: String" >> $(CONFIG_HS)
- @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
- @echo "cLeadingUnderscore :: String" >> $(CONFIG_HS)
- @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
- @echo "cRAWCPP_FLAGS :: String" >> $(CONFIG_HS)
- @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
- @echo "cGCC :: String" >> $(CONFIG_HS)
- @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
- @echo "cMKDLL :: String" >> $(CONFIG_HS)
- @echo "cMKDLL = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
- @echo "cLdIsGNULd :: String" >> $(CONFIG_HS)
- @echo "cLdIsGNULd = \"$(LdIsGNULd)\"" >> $(CONFIG_HS)
- @echo "cLD_X :: String" >> $(CONFIG_HS)
- @echo "cLD_X = \"$(LD_X)\"" >> $(CONFIG_HS)
- @echo "cGHC_DRIVER_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_DRIVER_DIR_REL = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_TOUCHY_DIR_REL = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_UNLIT_DIR_REL = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_MANGLER_DIR_REL = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_SPLIT_DIR_REL = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_PGM :: String" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_DIR_REL :: String" >> $(CONFIG_HS)
- @echo "cGHC_SYSMAN_DIR_REL = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
- @echo "cGHC_CP :: String" >> $(CONFIG_HS)
- @echo "cGHC_CP = \"$(GHC_CP)\"" >> $(CONFIG_HS)
- @echo "cGHC_PERL :: String" >> $(CONFIG_HS)
- @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
- @echo "cEnableWin32DLLs :: String" >> $(CONFIG_HS)
- @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
- @echo "cCONTEXT_DIFF :: String" >> $(CONFIG_HS)
- @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
- @echo "cUSER_WAY_NAMES :: String" >> $(CONFIG_HS)
- @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
- @echo "cUSER_WAY_OPTS :: String" >> $(CONFIG_HS)
- @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
- @echo "cDEFAULT_TMPDIR :: String" >> $(CONFIG_HS)
- @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
- @echo "cRelocatableBuild :: Bool" >> $(CONFIG_HS)
-ifeq "$(RelocatableBuild)" "YES"
- @echo "cRelocatableBuild = True" >> $(CONFIG_HS)
-else
- @echo "cRelocatableBuild = False" >> $(CONFIG_HS)
-endif
- @echo "cLibFFI :: Bool" >> $(CONFIG_HS)
-ifeq "$(UseLibFFIForAdjustors)" "YES"
- @echo "cLibFFI = True" >> $(CONFIG_HS)
-else
- @echo "cLibFFI = False" >> $(CONFIG_HS)
-endif
- @echo done.
-
-# -----------------------------------------------------------------------------
-# Create platform includes
-
-# Here we generate a little header file containing CPP symbols that GHC
-# uses to determine which platform it is building on/for. The platforms
-# can differ between stage1 and stage2 if we're cross-compiling, so we
-# need one of these header files per stage.
-
-PLATFORM_H = ghc_boot_platform.h
-
-stage1/$(PLATFORM_H) : $(FPTOOLS_TOP)/mk/config.mk
- $(MKDIRHIER) stage1
- @echo "Creating $@..."
- @$(RM) $@
- @echo "#ifndef __PLATFORM_H__" >$@
- @echo "#define __PLATFORM_H__" >>$@
- @echo >> $@
- @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
- @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
- @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo >> $@
- @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
- @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
- @echo >> $@
- @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
- @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
- @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
- @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
- @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo >> $@
- @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
- @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
- @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
- @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
- @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
- @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
- @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
- @echo "#endif " >> $@
-endif
- @echo >> $@
- @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
- @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
- @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
- @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
- @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo >> $@
- @echo "#endif /* __PLATFORM_H__ */" >> $@
- @echo "Done."
-
-# For stage2 and above, the BUILD platform is the HOST of stage1, and
-# the HOST platform is the TARGET of stage1. The TARGET remains the same
-# (stage1 is the cross-compiler, not stage2).
-stage2plus/$(PLATFORM_H) : $(FPTOOLS_TOP)/mk/config.mk
- $(MKDIRHIER) stage2plus
- @echo "Creating $@..."
- @$(RM) $@
- @echo "#ifndef __PLATFORM_H__" >$@
- @echo "#define __PLATFORM_H__" >>$@
- @echo >> $@
- @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
- @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
- @echo >> $@
- @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
- @echo >> $@
- @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
- @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
- @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo >> $@
- @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
- @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
- @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
- @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
- @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
- @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
- @echo "#endif " >> $@
-endif
- @echo >> $@
- @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
- @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
- @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo >> $@
- @echo "#endif /* __PLATFORM_H__ */" >> $@
- @echo "Done."
-
-ifeq "$(stage)" "1"
-STAGE_PLATFORM_H = stage1/$(PLATFORM_H)
-else
-STAGE_PLATFORM_H = stage2plus/$(PLATFORM_H)
-endif
-
-boot :: $(STAGE_PLATFORM_H)
-
-# ----------------------------------------------------------------------------
-# Generate supporting stuff for prelude/PrimOp.lhs
-# from prelude/primops.txt
-
-SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
-SRC_CPP_OPTS += ${GhcCppOpts}
-
-prelude/primops.txt parser/Parser.y: %: %.pp stage1/$(PLATFORM_H)
- $(CPP) $(RAWCPP_FLAGS) -P $(CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
-
-primop-data-decl.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --data-decl < $< > $@
-primop-tag.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --primop-tag < $< > $@
-primop-list.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --primop-list < $< > $@
-primop-has-side-effects.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --has-side-effects < $< > $@
-primop-out-of-line.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --out-of-line < $< > $@
-primop-commutable.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --commutable < $< > $@
-primop-needs-wrapper.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --needs-wrapper < $< > $@
-primop-can-fail.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --can-fail < $< > $@
-primop-strictness.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --strictness < $< > $@
-primop-primop-info.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --primop-primop-info < $< > $@
-
-# Usages aren't used any more; but the generator
-# can still generate them if we want them back
-primop-usage.hs-incl: prelude/primops.txt
- $(GENPRIMOP) --usage < $< > $@
-
-html:
- $(MAKE) doc stage=2
-
-install-docs:
- @:
-
-#-----------------------------------------------------------------------------
-# binary-dist
-#
+.PHONY: 1 2 3
-# Ideally we'd get these from the Cabal file's Install-Includes:
-BINDIST_EXTRAS += HsVersions.h
-ifeq "$(stage)" "1"
-BINDIST_EXTRAS += stage1/ghc_boot_platform.h
-else
-BINDIST_EXTRAS += stage2plus/ghc_boot_platform.h
-endif
+1:
+ +$(TOPMAKE) stage=1 all_ghc_stage1 compiler_stage1_NO_BUILD_DEPS=YES
-include $(TOP)/mk/bindist.mk
-LIB_DIST_DIR = dist-stage2
+2:
+ +$(TOPMAKE) stage=2 all_ghc_stage2 compiler_stage2_NO_BUILD_DEPS=YES
-#-----------------------------------------------------------------------------
-# etags generation
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-GHCTAGS = $(TOP)/utils/ghctags/ghctags.exe
-else
-GHCTAGS = $(TOP)/utils/ghctags/ghctags-inplace
-endif
-GHCTAGS_ROOT = main/GHC.hs ghci/InteractiveUI.hs main/PprTyThing.hs
+3:
+ +$(TOPMAKE) stage=3 all_ghc_stage3 compiler_stage3_NO_BUILD_DEPS=YES
-# etags for stage2 is actually broken since it requires building
-# ghctags against an older ghc api
-etags: etags.stage.2
-etags.stage.%:
- $(GHCTAGS) --topdir $(FPTOOLS_TOP_ABS) --etags --use-cabal-config=./dist-stage$* -- -DSTAGE=$* -- $(GHCTAGS_ROOT)
+-- WARNING: ghc.cabal is automatically generated from ghc.cabal.in by
+-- ./configure. Make sure you are editing ghc.cabal.in, not ghc.cabal.
+
Name: ghc
Version: @ProjectVersion@
License: BSD3
Flag stage1
Description: Is this stage 1?
+ Default: False
+
+Flag stage2
+ Description: Is this stage 2?
+ Default: False
+
+Flag stage3
+ Description: Is this stage 3?
+ Default: False
Library
Exposed: False
Build-Depends: extensible-exceptions
Extensions: PatternSignatures
else
- Include-Dirs: stage2plus
+ if flag(stage2)
+ Include-Dirs: stage2
+ else
+ if flag(stage3)
+ Include-Dirs: stage2
+
Install-Includes: HsVersions.h, ghc_boot_platform.h
c-sources:
--- /dev/null
+# -----------------------------------------------------------------------------
+# For expressing extra dependencies on source files
+
+define compiler-hs-dependency # args: $1 = module, $2 = dependency
+
+$$(foreach stage,1 2 3,\
+ $$(foreach way,$$(compiler_stage$$(stage)_WAYS),\
+ compiler/stage$$(stage)/build/$1.$($(way)_osuf))) : $2
+
+endef
+
+# -----------------------------------------------------------------------------
+# Create compiler configuration
+#
+# The 'echo' commands simply spit the values of various make variables
+# into Config.hs, whence they can be compiled and used by GHC itself
+
+compiler_CONFIG_HS = compiler/main/Config.hs
+
+ifneq "$(BINDIST)" "YES"
+compiler/stage1/package-data.mk : $(compiler_CONFIG_HS)
+compiler/stage2/package-data.mk : $(compiler_CONFIG_HS)
+compiler/stage3/package-data.mk : $(compiler_CONFIG_HS)
+endif
+
+$(compiler_CONFIG_HS) : mk/config.mk
+ $(RM) -f $@
+ @echo "Creating $@ ... "
+ @echo "module Config where" >>$@
+ @echo "cProjectName :: String" >> $@
+ @echo "cProjectName = \"$(ProjectName)\"" >> $@
+ @echo "cProjectVersion :: String" >> $@
+ @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $@
+ @echo "cProjectVersionInt :: String" >> $@
+ @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $@
+ @echo "cProjectPatchLevel :: String" >> $@
+ @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $@
+ @echo "cBooterVersion :: String" >> $@
+ @echo "cBooterVersion = \"$(GhcVersion)\"" >> $@
+ @echo "cStage :: String" >> $@
+ @echo "cStage = show (STAGE :: Int)" >> $@
+ @echo "cHscIfaceFileVersion :: String" >> $@
+ @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $@
+ @echo "cSplitObjs :: String" >> $@
+ @echo "cSplitObjs = \"$(SupportsSplitObjs)\"" >> $@
+ @echo "cGhcWithInterpreter :: String" >> $@
+ @echo "cGhcWithInterpreter = \"$(GhcWithInterpreter)\"" >> $@
+ @echo "cGhcWithNativeCodeGen :: String" >> $@
+ @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $@
+ @echo "cGhcWithSMP :: String" >> $@
+ @echo "cGhcWithSMP = \"$(GhcWithSMP)\"" >> $@
+ @echo "cGhcRTSWays :: String" >> $@
+ @echo "cGhcRTSWays = \"$(GhcRTSWays)\"" >> $@
+ @echo "cGhcUnregisterised :: String" >> $@
+ @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $@
+ @echo "cGhcEnableTablesNextToCode :: String" >> $@
+ @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $@
+ @echo "cLeadingUnderscore :: String" >> $@
+ @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $@
+ @echo "cRAWCPP_FLAGS :: String" >> $@
+ @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $@
+ @echo "cGCC :: String" >> $@
+ @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $@
+ @echo "cMKDLL :: String" >> $@
+ @echo "cMKDLL = \"$(BLD_DLL)\"" >> $@
+ @echo "cLdIsGNULd :: String" >> $@
+ @echo "cLdIsGNULd = \"$(LdIsGNULd)\"" >> $@
+ @echo "cLD_X :: String" >> $@
+ @echo "cLD_X = \"$(LD_X)\"" >> $@
+ @echo "cGHC_DRIVER_DIR :: String" >> $@
+ @echo "cGHC_DRIVER_DIR = \"$(GHC_DRIVER_DIR)\"" >> $@
+ @echo "cGHC_TOUCHY_PGM :: String" >> $@
+ @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $@
+ @echo "cGHC_TOUCHY_DIR :: String" >> $@
+ @echo "cGHC_TOUCHY_DIR = \"$(GHC_TOUCHY_DIR)\"" >> $@
+ @echo "cGHC_UNLIT_PGM :: String" >> $@
+ @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $@
+ @echo "cGHC_UNLIT_DIR :: String" >> $@
+ @echo "cGHC_UNLIT_DIR = \"$(GHC_UNLIT_DIR)\"" >> $@
+ @echo "cGHC_MANGLER_PGM :: String" >> $@
+ @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $@
+ @echo "cGHC_MANGLER_DIR :: String" >> $@
+ @echo "cGHC_MANGLER_DIR = \"$(GHC_MANGLER_DIR)\"" >> $@
+ @echo "cGHC_SPLIT_PGM :: String" >> $@
+ @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $@
+ @echo "cGHC_SPLIT_DIR :: String" >> $@
+ @echo "cGHC_SPLIT_DIR = \"$(GHC_SPLIT_DIR)\"" >> $@
+ @echo "cGHC_SYSMAN_PGM :: String" >> $@
+ @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $@
+ @echo "cGHC_SYSMAN_DIR :: String" >> $@
+ @echo "cGHC_SYSMAN_DIR = \"$(GHC_SYSMAN_DIR)\"" >> $@
+ @echo "cGHC_CP :: String" >> $@
+ @echo "cGHC_CP = \"$(GHC_CP)\"" >> $@
+ @echo "cGHC_PERL :: String" >> $@
+ @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $@
+ @echo "cEnableWin32DLLs :: String" >> $@
+ @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $@
+ @echo "cCONTEXT_DIFF :: String" >> $@
+ @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $@
+ @echo "cUSER_WAY_NAMES :: String" >> $@
+ @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $@
+ @echo "cUSER_WAY_OPTS :: String" >> $@
+ @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $@
+ @echo "cDEFAULT_TMPDIR :: String" >> $@
+ @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $@
+ @echo "cRelocatableBuild :: Bool" >> $@
+ifeq "$(RelocatableBuild)" "YES"
+ @echo "cRelocatableBuild = True" >> $@
+else
+ @echo "cRelocatableBuild = False" >> $@
+endif
+ @echo "cLibFFI :: Bool" >> $@
+ifeq "$(UseLibFFIForAdjustors)" "YES"
+ @echo "cLibFFI = True" >> $@
+else
+ @echo "cLibFFI = False" >> $@
+endif
+ @echo done.
+
+$(eval $(call clean-target,compiler,config_hs,$(compiler_CONFIG_HS)))
+
+# -----------------------------------------------------------------------------
+# Create platform includes
+
+# Here we generate a little header file containing CPP symbols that GHC
+# uses to determine which platform it is building on/for. The platforms
+# can differ between stage1 and stage2 if we're cross-compiling, so we
+# need one of these header files per stage.
+
+PLATFORM_H = ghc_boot_platform.h
+
+compiler/stage1/$(PLATFORM_H) : mk/config.mk
+ $(MKDIRHIER) $(dir $@)
+ $(RM) $@
+ @echo "Creating $@..."
+ @echo "#ifndef __PLATFORM_H__" >$@
+ @echo "#define __PLATFORM_H__" >>$@
+ @echo >> $@
+ @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
+ @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
+ @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
+ @echo >> $@
+ @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
+ @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
+ @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
+ @echo >> $@
+ @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
+ @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
+ @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
+ @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
+ @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
+ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
+ @echo >> $@
+ @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
+ @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
+ @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
+ @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
+ @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
+ @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
+ifeq "$(HostOS_CPP)" "irix"
+ @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
+ @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
+ @echo "#endif " >> $@
+endif
+ @echo >> $@
+ @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
+ @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
+ @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
+ @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
+ @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
+ @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
+ @echo >> $@
+ @echo "#endif /* __PLATFORM_H__ */" >> $@
+ @echo "Done."
+
+# For stage2 and above, the BUILD platform is the HOST of stage1, and
+# the HOST platform is the TARGET of stage1. The TARGET remains the same
+# (stage1 is the cross-compiler, not stage2).
+compiler/stage2/$(PLATFORM_H) : mk/config.mk
+ $(MKDIRHIER) $(dir $@)
+ $(RM) $@
+ @echo "Creating $@..."
+ @echo "#ifndef __PLATFORM_H__" >$@
+ @echo "#define __PLATFORM_H__" >>$@
+ @echo >> $@
+ @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
+ @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
+ @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
+ @echo >> $@
+ @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
+ @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
+ @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
+ @echo >> $@
+ @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
+ @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
+ @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
+ @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
+ @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
+ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
+ @echo >> $@
+ @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
+ @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
+ @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
+ @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
+ @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
+ @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
+ifeq "$(HostOS_CPP)" "irix"
+ @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
+ @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
+ @echo "#endif " >> $@
+endif
+ @echo >> $@
+ @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
+ @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
+ @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
+ @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
+ @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
+ @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
+ @echo >> $@
+ @echo "#endif /* __PLATFORM_H__ */" >> $@
+ @echo "Done."
+
+compiler/stage3/$(PLATFORM_H) : compiler/stage2/$(PLATFORM_H)
+ $(CP) $< $@
+
+# Every Constants.o object file depends on includes/GHCConstants.h:
+$(eval $(call compiler-hs-dependency,Constants,$(includes_GHCCONSTANTS)))
+
+# ----------------------------------------------------------------------------
+# Generate supporting stuff for prelude/PrimOp.lhs
+# from prelude/primops.txt
+
+# XXX: these should go in stage1/stage2/stage3
+PRIMOP_BITS = compiler/primop-data-decl.hs-incl \
+ compiler/primop-tag.hs-incl \
+ compiler/primop-list.hs-incl \
+ compiler/primop-has-side-effects.hs-incl \
+ compiler/primop-out-of-line.hs-incl \
+ compiler/primop-commutable.hs-incl \
+ compiler/primop-needs-wrapper.hs-incl \
+ compiler/primop-can-fail.hs-incl \
+ compiler/primop-strictness.hs-incl \
+ compiler/primop-primop-info.hs-incl
+
+compiler_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
+compiler_CPP_OPTS += ${GhcCppOpts}
+
+$(PRIMOPS_TXT) compiler/parser/Parser.y: %: %.pp compiler/stage1/$(PLATFORM_H)
+ $(CPP) $(RAWCPP_FLAGS) -P $(compiler_CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
+
+$(eval $(call clean-target,compiler,primop, $(PRIMOPS_TXT) compiler/parser/Parser.y $(PRIMOP_BITS)))
+
+compiler/primop-data-decl.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --data-decl < $< > $@
+compiler/primop-tag.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --primop-tag < $< > $@
+compiler/primop-list.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --primop-list < $< > $@
+compiler/primop-has-side-effects.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --has-side-effects < $< > $@
+compiler/primop-out-of-line.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --out-of-line < $< > $@
+compiler/primop-commutable.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --commutable < $< > $@
+compiler/primop-needs-wrapper.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --needs-wrapper < $< > $@
+compiler/primop-can-fail.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --can-fail < $< > $@
+compiler/primop-strictness.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --strictness < $< > $@
+compiler/primop-primop-info.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
+ $(GENPRIMOP_INPLACE) --primop-primop-info < $< > $@
+
+# Every PrimOp.o object file depends on $(PRIMOP_BITS):
+$(eval $(call compiler-hs-dependency,PrimOp,$(PRIMOP_BITS)))
+
+# Usages aren't used any more; but the generator
+# can still generate them if we want them back
+compiler/primop-usage.hs-incl: $(PRIMOPS_TXT)
+ $(GENPRIMOP_INPLACE) --usage < $< > $@
+
+# -----------------------------------------------------------------------------
+# Configuration
+
+compiler_stage1_CONFIGURE_OPTS += --flags=stage1
+compiler_stage2_CONFIGURE_OPTS += --flags=stage2
+compiler_stage3_CONFIGURE_OPTS += --flags=stage3
+
+ifeq "$(GhcWithNativeCodeGen)" "YES"
+compiler_stage1_CONFIGURE_OPTS += --flags=ncg
+compiler_stage2_CONFIGURE_OPTS += --flags=ncg
+endif
+
+ifeq "$(GhcWithInterpreter)" "YES"
+compiler_stage2_CONFIGURE_OPTS += --flags=ghci
+
+ifeq "$(BuildSharedLibs)" "YES"
+compiler_stage2_CONFIGURE_OPTS += --enable-shared
+# If we are going to use dynamic libraries instead of .o files for ghci,
+# we will need to always retain CAFs in the compiler.
+# ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
+# function which sets the keepCAFs flag for the RTS before any Haskell
+# code is run.
+compiler_stage2_CONFIGURE_OPTS += --flags=dynlibs
+endif
+
+ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
+# Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
+# or not?
+# XXX This should logically be a CPP option, but there doesn't seem to
+# be a flag for that
+compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DGHCI_TABLES_NEXT_TO_CODE
+endif
+
+# Should the debugger commands be enabled?
+ifeq "$(GhciWithDebugger)" "YES"
+compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DDEBUGGER
+endif
+
+endif
+
+ifeq "$(GhcWithNativeCodeGen)" "NO"
+# XXX This should logically be a CPP option, but there doesn't seem to
+# be a flag for that
+compiler_CONFIGURE_OPTS += --ghc-option=-DOMIT_NATIVE_CODEGEN
+endif
+
+ifeq "$(TargetOS_CPP)" "openbsd"
+compiler_CONFIGURE_OPTS += --ld-options=-E
+endif
+
+ifeq "$(GhcUnregisterised)" "NO"
+ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
+# needed for generating proper relocation in large binaries: trac #856
+compiler_CONFIGURE_OPTS += --ld-option=-Wl,--relax
+endif
+endif
+
+# We need to turn on profiling either if we have been asked to
+# (GhcLibProfiled = YES) or if we want GHC itself to be compiled with
+# profiling enabled (GhcProfiled = YES).
+ifneq "$(GhcLibProfiled) $(GhcProfiled)" "NO NO"
+compiler_stage2_CONFIGURE_OPTS += --enable-library-profiling
+# And if we're profiling GHC then we want lots of SCCs.
+# We also don't want to waste time building the non-profiling library,
+# either normally or for ghci. Unfortunately this means that we have to
+# tell ghc-pkg --force as it gets upset when libHSghc-6.9.a doesn't
+# exist.
+ifeq "$(GhcProfiled)" "YES"
+compiler_stage2_CONFIGURE_OPTS += --ghc-option=-auto-all
+compiler_stage2_CONFIGURE_OPTS += --disable-library-vanilla
+compiler_stage2_CONFIGURE_OPTS += --disable-library-for-ghci
+compiler_stage2_CONFIGURE_OPTS += --ghc-pkg-option=--force
+endif
+endif
+
+ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
+# The #include is vital for the via-C route with older compilers, else the C
+# compiler doesn't realise that the stcall foreign imports are indeed
+# stdcall, and doesn't generate the Foo@8 name for them
+# As it's only important for older compilers we don't need to do anything
+# for stage2+.
+compiler_stage1_CONFIGURE_OPTS += --ghc-option='-\#include' \
+ --ghc-option='"<windows.h>"' \
+ --ghc-option='-\#include' \
+ --ghc-option='"<process.h>"'
+endif
+
+# ghc_strlen percolates through so many modules that it is easier to get its
+# prototype via a global option instead of a myriad of per-file OPTIONS.
+# Again, this is only important for older compilers, so we don't do it in
+# stage 2+.
+compiler_stage1_CONFIGURE_OPTS += --ghc-options='-\#include "cutils.h"'
+
+compiler_stage3_CONFIGURE_OPTS := $(compiler_stage2_CONFIGURE_OPTS)
+
+compiler_stage1_CONFIGURE_OPTS += --ghc-option=-DSTAGE=1
+compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DSTAGE=2
+compiler_stage3_CONFIGURE_OPTS += --ghc-option=-DSTAGE=3
+compiler_stage2_HADDOCK_OPTS += --haddock-option=--optghc=-DSTAGE=2
+
+compiler_stage1_CONFIGURE_OPTS += --ghc-options='$(GhcStage1HcOpts)'
+compiler_stage2_CONFIGURE_OPTS += --ghc-options='$(GhcStage2HcOpts)'
+compiler_stage3_CONFIGURE_OPTS += --ghc-options='$(GhcStage3HcOpts)'
+
+compiler/stage1/package-data.mk : compiler/ghc.mk
+compiler/stage2/package-data.mk : compiler/ghc.mk
+compiler/stage3/package-data.mk : compiler/ghc.mk
+
+# -----------------------------------------------------------------------------
+# And build the package
+
+compiler_PACKAGE = ghc
+
+# haddocking only happens for stage2
+compiler_stage1_DO_HADDOCK = NO
+compiler_stage3_DO_HADDOCK = NO
+
+# Don't do splitting for the GHC package, it takes too long and
+# there's not much benefit.
+compiler_stage1_SplitObjs = NO
+compiler_stage2_SplitObjs = NO
+compiler_stage3_SplitObjs = NO
+
+# For now, bindists always use stage 2
+ifneq "$(BINDIST)" "YES"
+# stage 1 is enabled unless $(stage) is set to something other than 1
+ifeq "$(filter-out 1,$(stage))" ""
+$(eval $(call build-package,compiler,stage1,0))
+endif
+endif
+
+# stage 2 is enabled unless $(stage) is set to something other than 2
+ifeq "$(filter-out 2,$(stage))" ""
+$(eval $(call build-package,compiler,stage2,1))
+endif
+
+ifneq "$(BINDIST)" "YES"
+# stage 3 has to be requested explicitly with stage=3
+ifeq "$(stage)" "3"
+$(eval $(call build-package,compiler,stage3,2))
+endif
+
+$(compiler_stage1_depfile) : compiler/stage1/$(PLATFORM_H)
+$(compiler_stage2_depfile) : compiler/stage2/$(PLATFORM_H)
+$(compiler_stage3_depfile) : compiler/stage3/$(PLATFORM_H)
+
+$(compiler_stage1_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
+$(compiler_stage2_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
+$(compiler_stage3_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
+endif
+
-- Prcess them one by one, dumping results into makefile
-- and complaining about cycles
hsc_env <- getSession
- mapM (liftIO . processDeps dflags hsc_env excl_mods (mkd_tmp_hdl files)) sorted
+ root <- liftIO getCurrentDirectory
+ mapM (liftIO . processDeps dflags hsc_env excl_mods root (mkd_tmp_hdl files)) sorted
-- If -ddump-mod-cycles, show cycles in the module graph
liftIO $ dumpModCycles dflags mod_summaries
processDeps :: DynFlags
-> HscEnv
-> [ModuleName]
+ -> FilePath
-> Handle -- Write dependencies to here
-> SCC ModSummary
-> IO ()
--
-- For {-# SOURCE #-} imports the "hi" will be "hi-boot".
-processDeps _ _ _ _ (CyclicSCC nodes)
+processDeps _ _ _ _ _ (CyclicSCC nodes)
= -- There shouldn't be any cycles; report them
ghcError (ProgramError (showSDoc $ GHC.cyclicModuleErr nodes))
-processDeps dflags hsc_env excl_mods hdl (AcyclicSCC node)
+processDeps dflags hsc_env excl_mods root hdl (AcyclicSCC node)
= do { let extra_suffixes = depSuffixes dflags
include_pkg_deps = depIncludePkgDeps dflags
src_file = msHsFilePath node
Nothing -> return () ;
Just hi_file -> do
{ let hi_files = insertSuffixes hi_file extra_suffixes
- write_dep (obj,hi) = writeDependency hdl [obj] hi
+ write_dep (obj,hi) = writeDependency root hdl [obj] hi
-- Add one dependency for each suffix;
-- e.g. A.o : B.hi
-- Emit std dependency of the object(s) on the source file
-- Something like A.o : A.hs
- ; writeDependency hdl obj_files src_file
+ ; writeDependency root hdl obj_files src_file
-- Emit a dependency for each import
}
-----------------------------
-writeDependency :: Handle -> [FilePath] -> FilePath -> IO ()
--- (writeDependency h [t1,t2] dep) writes to handle h the dependency
+writeDependency :: FilePath -> Handle -> [FilePath] -> FilePath -> IO ()
+-- (writeDependency r h [t1,t2] dep) writes to handle h the dependency
-- t1 t2 : dep
-writeDependency hdl targets dep
- = hPutStrLn hdl (unwords (map forOutput targets) ++ " : " ++ forOutput dep)
- where forOutput = escapeSpaces . reslash Forwards . normalise
+writeDependency root hdl targets dep
+ = do let -- We need to avoid making deps on
+ -- c:/foo/...
+ -- on cygwin as make gets confused by the :
+ -- Making relative deps avoids some instances of this.
+ dep' = makeRelative root dep
+ forOutput = escapeSpaces . reslash Forwards . normalise
+ output = unwords (map forOutput targets) ++ " : " ++ forOutput dep'
+ hPutStrLn hdl output
-----------------------------
insertSuffixes
[Note topdir]
GHC needs various support files (library packages, RTS etc), plus
-various auxiliary programs (cp, gcc, etc). It starts by finding topdir:
-
- for "installed" topdir is the root of GHC's support files ($libdir)
- for "in-place" topdir is the root of the build tree
+various auxiliary programs (cp, gcc, etc). It starts by finding topdir,
+the root of GHC's support files
On Unix:
- ghc always has a shell wrapper that passes a -B<dir> option
- - in an installation, <dir> is $libdir
- - in a build tree, <dir> is $TOP/inplace-datadir
- - so we detect the build-tree case and add ".." to get us back to $TOP
On Windows:
- ghc never has a shell wrapper.
- we can find the location of the ghc binary, which is
- $topdir/bin/ghc.exe in an installation, or
- $topdir/ghc/stage1-inplace/ghc.exe in a build tree.
- - we detect which one of these we have, and calculate $topdir.
-
+ $topdir/bin/<something>.exe
+ where <something> may be "ghc", "ghc-stage2", or similar
+ - we strip off the "bin/<something>.exe" to leave $topdir.
-from topdir we can find package.conf, which contains the locations of
-almost everything else, whether we're in a build tree or installed.
+from topdir we can find package.conf, ghc-asm, etc.
SysTools.initSysProgs figures out exactly where all the auxiliary programs
etc They do *not* include paths
- cUNLIT_DIR_REL The *path* to the directory containing unlit, split etc
- cSPLIT_DIR_REL *relative* to the root of the build tree,
+ cUNLIT_DIR The *path* to the directory containing unlit, split etc
+ cSPLIT_DIR *relative* to the root of the build tree,
for use when running *in-place* in a build tree (only)
initSysTools mbMinusB dflags0
- = do { (am_installed, top_dir) <- findTopDir mbMinusB
+ = do { top_dir <- findTopDir mbMinusB
-- see [Note topdir]
-- NB: top_dir is assumed to be in standard Unix
-- format, '/' separated
- ; let installed, installed_bin :: FilePath -> FilePath
- installed_bin pgm = top_dir </> pgm
- installed file = top_dir </> file
- inplace dir pgm = top_dir </> dir </> pgm
-
- ; let pkgconfig_path
- | am_installed = installed "package.conf"
- | otherwise = inplace "inplace-datadir" "package.conf"
-
- ghc_usage_msg_path
- | am_installed = installed "ghc-usage.txt"
- | otherwise = inplace cGHC_DRIVER_DIR_REL "ghc-usage.txt"
+ ; let installed :: FilePath -> FilePath
+ installed file = top_dir </> file
+ installed_mingw_bin file = top_dir </> ".." </> "mingw" </> "bin" </> file
- ghci_usage_msg_path
- | am_installed = installed "ghci-usage.txt"
- | otherwise = inplace cGHC_DRIVER_DIR_REL "ghci-usage.txt"
+ ; let pkgconfig_path = installed "package.conf"
+ ghc_usage_msg_path = installed "ghc-usage.txt"
+ ghci_usage_msg_path = installed "ghci-usage.txt"
-- For all systems, unlit, split, mangle are GHC utilities
-- architecture-specific stuff is done when building Config.hs
- unlit_path
- | am_installed = installed_bin cGHC_UNLIT_PGM
- | otherwise = inplace cGHC_UNLIT_DIR_REL cGHC_UNLIT_PGM
+ unlit_path = installed cGHC_UNLIT_PGM
-- split and mangle are Perl scripts
- split_script
- | am_installed = installed_bin cGHC_SPLIT_PGM
- | otherwise = inplace cGHC_SPLIT_DIR_REL cGHC_SPLIT_PGM
+ split_script = installed cGHC_SPLIT_PGM
+ mangle_script = installed cGHC_MANGLER_PGM
- mangle_script
- | am_installed = installed_bin cGHC_MANGLER_PGM
- | otherwise = inplace cGHC_MANGLER_DIR_REL cGHC_MANGLER_PGM
-
- windres_path
- | am_installed = installed_bin "bin/windres"
- | otherwise = "windres"
+ windres_path = installed_mingw_bin "windres"
; tmpdir <- getTemporaryDirectory
; let dflags1 = setTmpDir tmpdir dflags0
ghcError (InstallationError
("Can't find package.conf as " ++ pkgconfig_path))
- -- On Windows, gcc and friends are distributed with GHC,
- -- so when "installed" we look in TopDir/bin
- -- When "in-place", or when not on Windows, we look wherever
- -- the build-time configure script found them
+ -- On Windows, mingw is distributed with GHC,
+ -- so we look in TopDir/../mingw/bin
; let
- -- The trailing "/" is absolutely essential; gcc seems
- -- to construct file names simply by concatenating to
- -- this -B path with no extra slash We use "/" rather
- -- than "\\" because otherwise "\\\" is mangled
- -- later on; although gcc_args are in NATIVE format,
- -- gcc can cope
- -- (see comments with declarations of global variables)
- gcc_b_arg = Option ("-B" ++ installed "gcc-lib/")
- gcc_mingw_include_arg = Option ("-I" ++ installed "include/mingw")
- (gcc_prog,gcc_args)
- | isWindowsHost && am_installed
- -- We tell gcc where its specs file + exes are (-B)
- -- and also some places to pick up include files. We need
- -- to be careful to put all necessary exes in the -B place
- -- (as, ld, cc1, etc) since if they don't get found there,
- -- gcc then tries to run unadorned "as", "ld", etc, and
- -- will pick up whatever happens to be lying around in
- -- the path, possibly including those from a cygwin
- -- install on the target, which is exactly what we're
- -- trying to avoid.
- = (installed_bin "gcc", [gcc_b_arg, gcc_mingw_include_arg])
- | otherwise = (cGCC, [])
+ gcc_prog
+ | isWindowsHost = installed_mingw_bin "gcc"
+ | otherwise = cGCC
perl_path
- | isWindowsHost && am_installed = installed_bin cGHC_PERL
- | otherwise = cGHC_PERL
+ | isWindowsHost = installed cGHC_PERL
+ | otherwise = cGHC_PERL
-- 'touch' is a GHC util for Windows
touch_path
- | isWindowsHost
- = if am_installed
- then installed_bin cGHC_TOUCHY_PGM
- else inplace cGHC_TOUCHY_DIR_REL cGHC_TOUCHY_PGM
- | otherwise = "touch"
+ | isWindowsHost = installed cGHC_TOUCHY_PGM
+ | otherwise = "touch"
-- On Win32 we don't want to rely on #!/bin/perl, so we prepend
-- a call to Perl to get the invocation of split and mangle.
-- On Unix, scripts are invoked using the '#!' method. Binary
(mkdll_prog, mkdll_args)
| not isWindowsHost
= panic "Can't build DLLs on a non-Win32 system"
- | am_installed =
- (installed "gcc-lib/" </> cMKDLL,
- [ Option "--dlltool-name",
- Option (installed "gcc-lib/" </> "dlltool"),
- Option "--driver-name",
- Option gcc_prog, gcc_b_arg, gcc_mingw_include_arg ])
- | otherwise = (cMKDLL, [])
+ | otherwise =
+ (installed_mingw_bin cMKDLL, [])
-- cpp is derived from gcc on all platforms
-- HACK, see setPgmP below. We keep 'words' here to remember to fix
-- Config.hs one day.
- ; let cpp_path = (gcc_prog, gcc_args ++
+ ; let cpp_path = (gcc_prog,
(Option "-E"):(map Option (words cRAWCPP_FLAGS)))
-- Other things being equal, as and ld are simply gcc
- ; let (as_prog,as_args) = (gcc_prog,gcc_args)
- (ld_prog,ld_args) = (gcc_prog,gcc_args)
+ ; let as_prog = gcc_prog
+ ld_prog = gcc_prog
; return dflags1{
ghcUsagePath = ghc_usage_msg_path,
pgm_L = unlit_path,
pgm_P = cpp_path,
pgm_F = "",
- pgm_c = (gcc_prog,gcc_args),
+ pgm_c = (gcc_prog,[]),
pgm_m = (mangle_prog,mangle_args),
pgm_s = (split_prog,split_args),
- pgm_a = (as_prog,as_args),
- pgm_l = (ld_prog,ld_args),
+ pgm_a = (as_prog,[]),
+ pgm_l = (ld_prog,[]),
pgm_dll = (mkdll_prog,mkdll_args),
pgm_T = touch_path,
pgm_sysman = top_dir ++ "/ghc/rts/parallel/SysMan",
\end{code}
\begin{code}
-findTopDir :: Maybe String -- Maybe TopDir path (without the '-B' prefix).
- -> IO (Bool, -- True <=> am installed, False <=> in-place
- String) -- TopDir (in Unix format '/' separated)
-
-findTopDir mbMinusB
- = do { top_dir <- get_proto
- ; exists1 <- doesFileExist (top_dir </> "package.conf")
- ; exists2 <- doesFileExist (top_dir </> "inplace")
- ; let amInplace = not exists1 -- On Windows, package.conf doesn't exist
- -- when we are inplace
- || exists2 -- On Linux, the presence of inplace signals
- -- that we are inplace
-
- ; let real_top = if exists2 then top_dir </> ".." else top_dir
-
- ; return (not amInplace, real_top)
- }
- where
- -- get_proto returns a Unix-format path (relying on getBaseDir to do so too)
- get_proto = case mbMinusB of
- Just minusb -> return (normalise minusb)
- Nothing
- -> do maybe_exec_dir <- getBaseDir -- Get directory of executable
- case maybe_exec_dir of -- (only works on Windows;
- -- returns Nothing on Unix)
- Nothing -> ghcError (InstallationError "missing -B<dir> option")
- Just dir -> return dir
+-- returns a Unix-format path (relying on getBaseDir to do so too)
+findTopDir :: Maybe String -- Maybe TopDir path (without the '-B' prefix).
+ -> IO String -- TopDir (in Unix format '/' separated)
+findTopDir (Just minusb) = return (normalise minusb)
+findTopDir Nothing
+ = do -- Get directory of executable
+ maybe_exec_dir <- getBaseDir
+ case maybe_exec_dir of
+ -- "Just" on Windows, "Nothing" on unix
+ Nothing -> ghcError (InstallationError "missing -B<dir> option")
+ Just dir -> return dir
\end{code}
runWindres :: DynFlags -> [Option] -> IO ()
runWindres dflags args = do
- let (gcc,gcc_args) = pgm_c dflags
+ let (_gcc,gcc_args) = pgm_c dflags
windres = pgm_windres dflags
mb_env <- getGccEnv gcc_args
- runSomethingFiltered dflags id "Windres" windres
- -- we must tell windres where to find gcc: it might not be on PATH
- (Option ("--preprocessor=" ++
- unwords (map quote (gcc : map showOpt gcc_args ++
- ["-E", "-xc", "-DRC_INVOKED"])))
- -- -- use-temp-file is required for windres to interpret the
- -- quoting in the preprocessor arg above correctly. Without
- -- this, windres calls the preprocessor with popen, which gets
- -- the quoting wrong (discovered by experimentation and
- -- reading the windres sources). See #1828.
- : Option "--use-temp-file"
- : args)
- -- we must use the PATH workaround here too, since windres invokes gcc
- mb_env
- where
- quote x = '\"' : x ++ "\""
+ runSomethingFiltered dflags id "Windres" windres args mb_env
touch :: DynFlags -> String -> String -> IO ()
touch dflags purpose arg =
getBaseDir :: IO (Maybe String)
#if defined(mingw32_HOST_OS)
--- Assuming we are running ghc, accessed by path $()/bin/ghc.exe,
--- return the path $(stuff). Note that we drop the "bin/" directory too.
+-- Assuming we are running ghc, accessed by path $(stuff)/bin/ghc.exe,
+-- return the path $(stuff)/lib.
getBaseDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32.
buf <- mallocArray len
ret <- getModuleFileName nullPtr buf len
return (Just (rootDir s))
where
rootDir s = case splitFileName $ normalise s of
- (d, ghc_exe) | lower ghc_exe == "ghc.exe" ->
+ (d, ghc_exe)
+ | lower ghc_exe `elem` ["ghc.exe",
+ "ghc-stage1.exe",
+ "ghc-stage2.exe",
+ "ghc-stage3.exe"] ->
case splitFileName $ takeDirectory d of
- -- installed ghc.exe is in $topdir/bin/ghc.exe
- (d', bin) | lower bin == "bin" -> takeDirectory d'
- -- inplace ghc.exe is in $topdir/ghc/stage1-inplace/ghc.exe
- (d', x) | "-inplace" `isSuffixOf` lower x ->
- takeDirectory d' </> ".."
+ -- ghc is in $topdir/bin/ghc.exe
+ (d', bin) | lower bin == "bin" -> takeDirectory d' </> "lib"
_ -> fail
_ -> fail
where fail = panic ("can't decompose ghc.exe path: " ++ show s)
-- Issue a user warning for a redundant {- SOURCE -} import
-- NB that we arrange to read all the ordinary imports before
- -- any of the {- SOURCE -} imports
- warnIf (want_boot && not (mi_boot iface))
+ -- any of the {- SOURCE -} imports.
+ --
+ -- in --make and GHCi, the compilation manager checks for this,
+ -- and indeed we shouldn't do it here because the existence of
+ -- the non-boot module depends on the compilation order, which
+ -- is not deterministic. The hs-boot test can show this up.
+ dflags <- getDOpts
+ warnIf (want_boot && not (mi_boot iface) && isOneShot (ghcMode dflags))
(warnRedundantSourceImport imp_mod_name)
let
TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
if test x"$TargetPlatform" != x"$HostPlatform" ; then
- echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
- exit 1
+ AC_MSG_ERROR([
+ GHC configuration does not support differing host/target (i.e., cross-compiling)])
fi
+case $HostPlatform in
+*-cygwin*)
+ AC_MSG_WARN([GHC does not support the Cygwin target at the moment])
+ AC_MSG_WARN([I'm assuming you wanted to build for i386-unknown-mingw32])
+ HostPlatform=i386-unknown-mingw32
+ ;;
+esac
+
exeext=''
soext='.so'
#
fi
WithGhc="$GHC"])
# GHC is passed to Cabal, so we need a native path
-if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
- test "${OSTYPE}" != "msys" && \
- test "${WithGhc}" != ""
+if test "${WithGhc}" != "" && test "$HostPlatform" = "i386-unknown-mingw32"
then
- # Canonicalise to <drive>:/path/to/ghc
- WithGhc=`cygpath -m ${WithGhc}`
+ if test "${OSTYPE}" = "msys"
+ then
+ WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"`
+ else
+ # Canonicalise to <drive>:/path/to/ghc
+ WithGhc=`cygpath -m ${WithGhc}`
+ fi
+ echo "Canonicalised to: ${WithGhc}"
fi
AC_SUBST([WithGhc])
)
AC_SUBST(WithHc)
+AC_ARG_ENABLE(bootstrap-with-devel-snapshot,
+[AC_HELP_STRING([--enable-bootstrap-with-devel-snapshot],
+ [Allow bootstrapping using a development snapshot of GHC. This is not guaranteed to work.])],
+ EnableBootstrapWithDevelSnaphost=YES,
+ EnableBootstrapWithDevelSnaphost=NO
+)
+
if test "$WithGhc" != ""; then
FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
+
+ if test `expr $GhcMinVersion % 2` = "1"; then
+ echo $EnableBootstrapWithDevelSnaphost
+ if test "$EnableBootstrapWithDevelSnaphost" = "NO"; then
+ AC_MSG_ERROR([
+ $WithGhc is a development snapshot of GHC, version $GhcVersion.
+ Bootstrapping using this version of GHC is not supported, and may not
+ work. Use --enable-bootstrap-with-devel-snapshot to try it anyway,
+ or --with-ghc to specify a different GHC to use.])
+ fi
+ fi
+
AC_SUBST(GhcVersion)dnl
AC_SUBST(GhcMajVersion)dnl
AC_SUBST(GhcMinVersion)dnl
dnl if GNU tar is named gtar, look for it first.
AC_PATH_PROGS(TarCmd,gtar tar,tar)
+dnl ** check for patch
+dnl if GNU patch is named gpatch, look for it first
+AC_PATH_PROGS(PatchCmd,gpatch patch, patch)
+
AC_PATH_PROG(HSCOLOUR,HsColour)
# HsColour is passed to Cabal, so we need a native path
if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
dnl ** check for ghc-pkg command
FP_PROG_GHC_PKG
-AC_ARG_WITH(greencard,
-[AC_HELP_STRING([--with-greencard=ARG],
- [Use ARG as the path to greencard [default=autodetct]])],
-[
-GreenCardCmd=$withval;
-FPTOOLS_GREENCARD(3.00)
-]
-)
-
dnl ** check for installed happy binary + version
dnl (don't do it if we're booting from .hc files though.)
if test "$BootingFromHc" = "NO"; then
fi
AC_SUBST(HavePapi)
-AC_CONFIG_FILES([mk/config.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml])
+AC_CONFIG_FILES([mk/config.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml])
AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
AC_OUTPUT
checkMake380 make
checkMake380 gmake
+echo ["
+----------------------------------------------------------------------
+Configure completed successfully.
+
+ Building GHC version : $ProjectVersion
+
+ Build platform : $BuildPlatform
+ Host platform : $HostPlatform
+ Target platform : $TargetPlatform
+"]
+
+if test "$BootingFromHc" = "YES"; then
+echo ["\
+ Bootstrapping from HC files.
+"]
+else
+echo ["\
+ Bootstrapping using : $WithGhc
+ which is version : $GhcVersion
+"]
+fi
+
+echo ["\
+ Using GCC : $WhatGccIsCalled
+ which is version : $GccVersion
+
+ ld : $LdCmd
+ Happy : $HappyCmd
+ Alex : $AlexCmd
+ Python : $PythonCmd
+ Perl : $PerlCmd"]
+
+if test "$HSCOLOUR" = ""; then
+echo ["
+ HsColour was not found; documentation will not contain source links
+"]
+else
+echo ["\
+ HsColour : $HSCOLOUR
+"]
+fi
+
+if test "$DIR_DOCBOOK_XSL" = ""; then
+echo ["\
+ Building DocBook documentation : no"]
+else
+echo ["\
+ Building DocBook documentation : yes"]
+fi
+
+
+echo ["\
+ Building shared libraries : $BuildSharedLibs"]
+
+echo ["----------------------------------------------------------------------
+"]
+
+echo "\
+For a standard build of GHC (fully optimised with profiling), type (g)make.
+
+To make changes to the default build configuration, copy the file
+mk/build.mk.sample to mk/build.mk, and edit the settings in there.
+
+For more information on how to configure your GHC build, see
+ http://hackage.haskell.org/trac/ghc/wiki/Building
+"
#
# Is it there?
-AC_INIT(Makefile-vars.in)
+AC_INIT(mk/config.mk.in)
exeext=''
FP_GCC_EXTRA_FLAGS
#
-AC_CONFIG_FILES(Makefile-vars extra-gcc-opts)
+AC_CONFIG_FILES(extra-gcc-opts mk/config.mk)
AC_OUTPUT
echo "****************************************************"
maintainer-clean: distclean
-ifeq "$(LATEX_DOCS)" "YES"
-BINDIST_EXTRAS += core.pdf
-endif
include $(TOP)/mk/bindist.mk
# dummy targets
endif
-BINDIST_EXTRAS += $(MAN_PAGE).$(MAN_SECTION)
include $(TOP)/mk/bindist.mk
include $(TOP)/mk/target.mk
--- /dev/null
+
+docs/users_guide_DOCBOOK_SOURCES := \
+ $(wildcard docs/users_guide/*.xml) \
+ $(basename $(wildcard docs/users_guide/*.xml.in))
+
+$(eval $(call docbook,docs/users_guide,users_guide))
+
+++ /dev/null
-TOP=../..
-include $(TOP)/mk/boilerplate.mk
-
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-SCRIPT_DIR = $(DESTDIR)$(bindir)
-SCRIPT_BASE = ghc-pkg
-SCRIPT_VERSIONED_BASE = $(SCRIPT_BASE)-$(ProjectVersion)
-SCRIPT = $(SCRIPT_DIR)/$(SCRIPT_BASE)
-SCRIPT_VERSIONED = $(SCRIPT_DIR)/$(SCRIPT_VERSIONED_BASE)
-
-install::
- mv $(SCRIPT) $(SCRIPT_VERSIONED)
- ln -s $(SCRIPT_VERSIONED_BASE) $(SCRIPT)
-endif
-
-include $(TOP)/mk/bindist.mk
-
-include $(TOP)/mk/target.mk
--- /dev/null
+
+$(eval $(call all-target,driver,$(INPLACE_LIB)/ghc-usage.txt) $(INPLACE_LIB)/ghci-usage.txt)
+
+$(INPLACE_LIB)/ghc-usage.txt: driver/ghc-usage.txt
+ cp $< $@
+
+$(INPLACE_LIB)/ghci-usage.txt: driver/ghci-usage.txt
+ cp $< $@
+
+INSTALL_LIBS += driver/ghc-usage.txt driver/ghci-usage.txt
+
--- /dev/null
+ifeq "$(Windows)" "YES"
+
+driver/ghc_dist_C_SRCS = ghc.c
+driver/ghc_dist_PROG = ghc-$(ProjectVersion)
+driver/ghc_dist_INSTALL = YES
+
+$(eval $(call build-prog,driver/ghc,dist,0))
+
+endif
+
-#-----------------------------------------------------------------------------
-# $Id: Makefile,v 1.11 2005/05/05 00:58:38 sof Exp $
-#
-
-TOP=../..
-include $(TOP)/mk/boilerplate.mk
-
-# -----------------------------------------------------------------------------
-# ghci script
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-C_PROG = ghci$(exeext)
-C_PROG_VERSIONED = ghci-$(ProjectVersion)$(exeext)
-C_OBJS += ghci.res
-
-all :: $(C_PROG_VERSIONED)
-$(C_PROG_VERSIONED) : $(C_PROG)
- cp $< $@
-else
-C_SRCS=
-endif
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-INSTALL_PROGS += $(C_PROG) $(C_PROG_VERSIONED)
-GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
-GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
-install::
- $(RM) -f $(GHCII_SCRIPT)
- echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
- echo 'exec "$$0"/../ghc --interactive $${1+"$$@"}' >> $(GHCII_SCRIPT)
- chmod +x $(GHCII_SCRIPT)
- cp $(GHCII_SCRIPT) $(GHCII_SCRIPT_VERSIONED)
- chmod +x $(GHCII_SCRIPT_VERSIONED)
-else
-LINK = ghci
-LINK_TARGET = $(LINK)-$(ProjectVersion)
-INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET)
-install::
- $(RM) -f $(INSTALLED_SCRIPT)
- echo "#!$(SHELL)" >> $(INSTALLED_SCRIPT)
- echo 'exec $(bindir)/ghc-$(ProjectVersion) --interactive $${1+"$$@"}' >> $(INSTALLED_SCRIPT)
- $(EXECUTABLE_FILE) $(INSTALLED_SCRIPT)
-endif
-
-ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-INPLACE_SCRIPT = ghci
-INPLACE_GHC = $(FPTOOLS_TOP_ABS)/ghc/stage2-inplace/ghc
-CLEAN_FILES += $(INPLACE_SCRIPT)
-all::
- $(RM) -f $(INPLACE_SCRIPT)
- echo "#!$(SHELL)" >> $(INPLACE_SCRIPT)
- echo "exec $(INPLACE_GHC) --interactive $${1+"$$@"}" >> $(INPLACE_SCRIPT)
- $(EXECUTABLE_FILE) $(INPLACE_SCRIPT)
-endif
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-ghci.res : ghci.rc ghci.ico
- windres --preprocessor="$(CPP) -xc -DRC_INVOKED" -o ghci.res -i ghci.rc -O coff
-endif
-
-include $(TOP)/mk/bindist.mk
-
-include $(TOP)/mk/target.mk
+dir = driver/ghci
+TOP = ../..
+include $(TOP)/mk/sub-makefile.mk
--- /dev/null
+ifneq "$(Windows)" "YES"
+
+install: install_driver_ghci
+
+.PHONY: install_driver_ghci
+install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
+install_driver_ghci:
+ $(MKDIRHIER) $(DESTDIR)$(bindir)
+ $(RM) -f $(WRAPPER)
+ echo '#!$(SHELL)' >> $(WRAPPER)
+ echo 'exec $(bindir)/ghc-$(ProjectVersion) --interactive ${1+"$@"}' >> $(WRAPPER)
+ $(EXECUTABLE_FILE) $(WRAPPER)
+ $(RM) -f $(DESTDIR)$(bindir)/ghci
+ $(LN_S) ghci-$(ProjectVersion) $(DESTDIR)$(bindir)/ghci
+
+else # Windows...
+
+driver/ghci_dist_C_SRCS = ghci.c
+driver/ghci_dist_PROG = ghci$(exeext)
+driver/ghci_dist_INSTALL = YES
+driver/ghci_dist_OTHER_OBJS = driver/ghci/ghci.res
+
+$(eval $(call build-prog,driver/ghci,dist,0))
+
+driver/ghci_dist_PROG_VER = ghci-$(ProjectVersion)$(exeext)
+
+INSTALL_BINS += driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER)
+
+driver/ghci/ghci.res : driver/ghci/ghci.rc driver/ghci/ghci.ico
+ windres --preprocessor="$(CPP) -xc -DRC_INVOKED" -o driver/ghci/ghci.res -i driver/ghci/ghci.rc -O coff
+
+driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER) : driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG)
+ $(CP) $< $@
+
+install : install_driver_ghcii
+
+.PHONY: install_driver_ghcii
+install_driver_ghcii: GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
+install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
+install_driver_ghcii:
+ $(MKDIRHIER) $(DESTDIR)$(bindir)
+ $(RM) -f $(GHCII_SCRIPT)
+ echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
+ echo 'exec "$$0"/../ghc --interactive $${1+"$$@"}' >> $(GHCII_SCRIPT)
+ $(EXECUTABLE_FILE) $(GHCII_SCRIPT)
+ cp $(GHCII_SCRIPT) $(GHCII_SCRIPT_VERSIONED)
+ $(EXECUTABLE_FILE) $(GHCII_SCRIPT_VERSIONED)
+
+endif
+
-#-----------------------------------------------------------------------------
-# $Id: Makefile,v 1.3 2001/03/23 16:36:21 simonmar Exp $
-
-TOP=../..
-include $(TOP)/mk/boilerplate.mk
-
-PROG = ghc-asm
-all:: $(PROG).prl
- $(RM) -f $(PROG)
- echo '#!$(PERL)' >> $(PROG)
- echo '$$TARGETPLATFORM = "$(TARGETPLATFORM)";' >> $(PROG)
- cat $< >> $(PROG)
- $(EXECUTABLE_FILE) $(PROG)
-
-INSTALL_LIBEXEC_SCRIPTS += $(PROG)
-CLEAN_FILES += $(PROG) $(PROG).prl
-
-# needed for bootstrapping with HC files
-ifeq "$(BootingFromHc)" "YES"
-boot :: all
-endif
-
-BINDIST_EXTRAS += $(PROG)
-include $(TOP)/mk/bindist.mk
-
-include $(TOP)/mk/target.mk
+dir = driver/mangler
+TOP = ../..
+include $(TOP)/mk/sub-makefile.mk
--- /dev/null
+driver/mangler_PERL_SRC = ghc-asm.lprl
+driver/mangler_dist_PROG = $(GHC_MANGLER_PGM)
+driver/mangler_dist_LIBEXEC = YES
+
+$(eval $(call build-perl,driver/mangler,dist))
+
+INSTALL_LIBEXEC_SCRIPTS += driver/mangler/dist/$(GHC_MANGLER_PGM)
+++ /dev/null
-TOP=../..
-include $(TOP)/mk/boilerplate.mk
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-install::
- cp $(DESTDIR)$(bindir)/runghc.exe $(DESTDIR)$(bindir)/runhaskell.exe
-else
-install::
- ln -sf runghc $(DESTDIR)$(bindir)/runhaskell
-endif
-
-include $(TOP)/mk/bindist.mk
-
-include $(TOP)/mk/target.mk
-#-----------------------------------------------------------------------------
-# $Id: Makefile,v 1.2 2000/11/03 16:54:52 simonmar Exp $
-
-TOP=../..
-include $(TOP)/mk/boilerplate.mk
-
-PROG = ghc-split
-all:: $(PROG).prl
- $(RM) -f $(PROG)
- echo '#!$(PERL)' >> $(PROG)
- echo '$$TARGETPLATFORM = "$(TARGETPLATFORM)";' >> $(PROG)
- cat $< >> $(PROG)
- $(EXECUTABLE_FILE) $(PROG)
-
-INSTALL_LIBEXEC_SCRIPTS += $(PROG)
-CLEAN_FILES += $(PROG) $(PROG).prl
-
-BINDIST_EXTRAS += $(PROG)
-include $(TOP)/mk/bindist.mk
-
-include $(TOP)/mk/target.mk
+dir = driver/split
+TOP = ../..
+include $(TOP)/mk/sub-makefile.mk
--- /dev/null
+driver/split_PERL_SRC = ghc-split.lprl
+driver/split_dist_PROG = $(GHC_SPLIT_PGM)
+driver/split_dist_LIBEXEC = YES
+
+$(eval $(call build-perl,driver/split,dist))
+
+INSTALL_LIBEXEC_SCRIPTS += driver/split/dist/$(GHC_SPLIT_PGM)
--- /dev/null
+# ToDo List.
+#
+# Before we can merge the new build system into HEAD:
+#
+# * finish installation
+# * other documentation
+# * create doc index and contents
+# * Windows: should we have ghc-pkg-<version>?
+# * should we be stripping things?
+# * install libgmp.a, gmp.h
+# * finish binary distributions
+# * need to fix Cabal for new Windows layout, see
+# Distribution/Simple/GHC.configureToolchain.
+#
+# As we merge the new build system into HEAD:
+#
+# * remove old Makefiles, add new stubs for building in subdirs
+# * utils/hsc2hs/Makefile
+# * utils/haddock/Makefile
+# * mk/oldconfig.mk.in
+#
+# Once the new build system is in HEAD, and before 6.12:
+#
+# * docbook PDFs, e.g. "dblatex -T db2latex users_guide.xml"
+# * GhcProfiled
+# * optionally install stage3?
+# * why does so much stuff get rebuilt after re-configuring?
+# * shared libraries, way dyn
+# * add pointers to wiki docs from the build system source
+# * get HC bootstrapping working
+# * add Makefiles for the rest of the utils/ programs that aren't built
+# by default (need to exclude them from 'make all' too)
+#
+# Tickets we can now close, or fix and close:
+#
+# * 912 build system doesn't have enough dependencies (it does now!)
+# * 2744 check for presence of hsc2hs in ./configure
+# * 2966 make sure --with-gcc does the right thing (#2966)
+# * 3115 make ghc.cabal read-only
+# * 2107 install the docs by default
+# * 1693 make distclean
+# * 2689 make maintainer-clean
+# * 2619 bootstrapping using a newer GHC shouldn't fail
+# for bogus reasons (picking the wrong version of the ghc package)
+# * 2770 check which version of gcc we require
+# * 3173 make install with DESTDIR
+
+# Possible cleanups:
+#
+# * per-source-file dependencies instead of one .depend file?
+# * eliminate undefined variables, and use --warn-undefined-variables?
+# * perhaps we should make all the output dirs in the .depend rule, to
+# avoid all these mkdirhier calls?
+# * put outputs from different ways in different subdirs of distdir/build,
+# then we don't have to use -osuf/-hisuf. We would have to install
+# them in different places too, so we'd need ghc-pkg support for packages
+# of different ways.
+# * make PACKAGES generated by configure or sh boot?
+# * we should use a directory of package.conf files rather than a single
+# file for the inplace package database, so that we can express
+# dependencies more accurately. Otherwise it's possible to get into
+# a state where the package database is out of date, and the build
+# system doesn't know.
+
+# NOTES on how to debug:
+# make --debug=b --debug=m shows dependencies
+# make -p prints all generated makefile rules and variables
+# make show VALUE=VAR prints the value of VAR
+# $(warning stuff) prints stuff when reading the makefile
+
+# BUILD ORDER
+#
+# * With bootstrapping compiler:
+# o Build libraries/{hpc,extensible-exceptions,Cabal}
+# o Build utils/ghc-pkg
+# o Build utils/ghc-cabal
+# * With bootstrapping compiler and ghc-cabal:
+# o Build utils/hsc2hs
+# o Build libraries/hpc
+# o Build compiler (stage 1)
+# * For each package:
+# o generate package-data.mk and inplace-pkg-info
+# o register each package into inplace/lib/package.conf
+# o generate .depend for each package
+# * With stage 1:
+# o Build libraries/*
+# o Build utils/* (except haddock)
+# o Build compiler (stage 2)
+# * With stage 2:
+# o Build utils/haddock
+# o Build compiler (stage 3)
+# * With haddock:
+# o libraries/*
+# o compiler
+
+default : all
+
+# Just bring makefiles up to date:
+.PHONY: just-makefiles
+just-makefiles:
+ @:
+
+# -----------------------------------------------------------------------------
+# Misc GNU make utils
+
+nothing=
+space=$(nothing) $(nothing)
+comma=,
+
+# Cancel all suffix rules. Ideally we'd like to have 'make -r' turned on
+# by default, because that disables all the implicit rules, but there doesn't
+# seem to be a good way to do that. This turns off all the old-style suffix
+# rules, which does half the job and speeds up make quite a bit:
+.SUFFIXES:
+
+# -----------------------------------------------------------------------------
+# Makefile debugging
+# to see the effective value used for a Makefile variable, do
+# make show VALUE=MY_VALUE
+#
+
+show:
+ @echo '$(VALUE)="$($(VALUE))"'
+
+# -----------------------------------------------------------------------------
+# Include subsidiary build-system bits
+
+include mk/config.mk
+
+ifeq "$(ProjectVersion)" ""
+$(error Please run ./configure first)
+endif
+
+# (Optional) build-specific configuration
+include mk/custom-settings.mk
+
+ifeq "$(GhcLibWays)" ""
+$(error $$(GhcLibWays) is empty, it must contain at least one way)
+endif
+
+# -----------------------------------------------------------------------------
+# Macros for standard targets
+
+include rules/all-target.mk
+include rules/clean-target.mk
+
+# -----------------------------------------------------------------------------
+# The inplace tree
+
+$(eval $(call clean-target,inplace,,inplace))
+
+# -----------------------------------------------------------------------------
+# Whether to build dependencies or not
+
+# When we're just doing 'make clean' or 'make show', then we don't need
+# to build dependencies.
+
+NO_INCLUDE_DEPS = NO
+NO_INCLUDE_PKGDATA = NO
+ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
+NO_INCLUDE_DEPS = YES
+NO_INCLUDE_PKGDATA = YES
+endif
+ifeq "$(findstring show,$(MAKECMDGOALS))" "show"
+NO_INCLUDE_DEPS = YES
+# We want package-data.mk for show
+endif
+
+# We don't haddock base3-compat, as it has the same package name as base
+libraries/base3-compat_dist-install_DO_HADDOCK = NO
+
+# We don't haddock the bootstrapping libraries
+libraries/hpc_dist-boot_DO_HADDOCK = NO
+libraries/Cabal_dist-boot_DO_HADDOCK = NO
+libraries/extensible-exceptions_dist-boot_DO_HADDOCK = NO
+libraries/filepath_dist-boot_DO_HADDOCK = NO
+
+# -----------------------------------------------------------------------------
+# Ways
+
+include rules/way-prelims.mk
+
+$(foreach way,$(ALL_WAYS),\
+ $(eval $(call way-prelims,$(way))))
+
+# -----------------------------------------------------------------------------
+# Compilation Flags
+
+include rules/distdir-opts.mk
+include rules/distdir-way-opts.mk
+
+# -----------------------------------------------------------------------------
+# Finding source files and object files
+
+include rules/hs-sources.mk
+include rules/c-sources.mk
+include rules/includes-sources.mk
+include rules/hs-objs.mk
+include rules/c-objs.mk
+
+# -----------------------------------------------------------------------------
+# Suffix rules
+
+include rules/hs-suffix-rules-srcdir.mk
+include rules/hs-suffix-rules.mk
+
+# -----------------------------------------------------------------------------
+# Suffix rules for .hi files
+
+include rules/hi-rule.mk
+
+$(foreach way,$(ALL_WAYS),\
+ $(eval $(call hi-rule,$(way))))
+
+#-----------------------------------------------------------------------------
+# C-related suffix rules
+
+include rules/c-suffix-rules.mk
+
+# -----------------------------------------------------------------------------
+# Building package-data.mk files from .cabal files
+
+include rules/package-config.mk
+
+# -----------------------------------------------------------------------------
+# Building dependencies
+
+include rules/build-dependencies.mk
+
+# -----------------------------------------------------------------------------
+# Build package-data.mk files
+
+include rules/build-package-data.mk
+
+# -----------------------------------------------------------------------------
+# Build and install a program
+
+include rules/build-prog.mk
+include rules/shell-wrapper.mk
+
+# -----------------------------------------------------------------------------
+# Build a perl script
+
+include rules/build-perl.mk
+
+# -----------------------------------------------------------------------------
+# Build a package
+
+include rules/build-package.mk
+include rules/build-package-way.mk
+include rules/haddock.mk
+
+# -----------------------------------------------------------------------------
+# Registering hand-written package descriptions (used in libffi and rts)
+
+include rules/manual-package-config.mk
+
+# -----------------------------------------------------------------------------
+# Docs
+
+include rules/docbook.mk
+
+# -----------------------------------------------------------------------------
+# Making bindists
+
+include rules/bindist.mk
+
+# -----------------------------------------------------------------------------
+# Building libraries
+
+# XXX generate from $(TOP)/packages
+PACKAGES = \
+ ghc-prim \
+ integer-gmp \
+ base \
+ filepath \
+ array \
+ bytestring \
+ containers
+
+ifeq "$(Windows)" "YES"
+PACKAGES += Win32
+else
+PACKAGES += unix
+endif
+
+PACKAGES += \
+ old-locale \
+ old-time \
+ directory \
+ process \
+ random \
+ extensible-exceptions \
+ haskell98 \
+ hpc \
+ packedstring \
+ pretty \
+ syb \
+ template-haskell \
+ base3-compat \
+ Cabal
+
+BOOT_PKGS = Cabal hpc extensible-exceptions
+
+# The actual .a files: needed for dependencies.
+ALL_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB))
+BOOT_LIBS = $(foreach lib,$(BOOT_PKGS),$(libraries/$(lib)_dist-boot_v_LIB))
+
+OTHER_LIBS = libffi/libHSffi.a libffi/HSffi.o
+ifeq "$(HaveLibGmp)" "NO"
+OTHER_LIBS += gmp/libgmp.a
+endif
+
+# We cannot run ghc-cabal to configure a package until we have
+# configured and registered all of its dependencies. So the following
+# hack forces all the configure steps to happen in exactly the order
+# given in the PACKAGES variable above. Ideally we should use the
+# correct dependencies here to allow more parallelism, but we don't
+# know the dependencies until we've generated the pacakge-data.mk
+# files.
+define fixed_pkg_dep
+libraries/$1/$2/package-data.mk : $(GHC_PKG_INPLACE) $$(if $$(fixed_pkg_prev),libraries/$$(fixed_pkg_prev)/$2/package-data.mk)
+fixed_pkg_prev:=$1
+endef
+
+ifneq "$(BINDIST)" "YES"
+fixed_pkg_prev=
+$(foreach pkg,$(PACKAGES),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
+
+# We assume that the stage2 compiler depends on all the libraries, so
+# they all get added to the package database before we try to configure
+# it
+compiler/stage2/package-data.mk: $(foreach pkg,$(PACKAGES),libraries/$(pkg)/dist-install/package-data.mk)
+# haddock depends on ghc and some libraries, but depending on GHC's
+# package-data.mk is sufficient, as that in turn depends on all the
+# libraries
+utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk
+
+utils/hsc2hs/dist-install/package-data.mk: compiler/stage2/package-data.mk
+
+# add the final two package.conf dependencies: ghc-prim depends on RTS,
+# and RTS depends on libffi.
+libraries/ghc-prim/dist-install/package-data.mk : rts/package.conf.inplace
+rts/package.conf.inplace : libffi/package.conf.inplace
+endif
+
+# -----------------------------------------------------------------------------
+# Special magic for the ghc-prim package
+
+# We want the ghc-prim package to include the GHC.Prim module when it
+# is registered, but not when it is built, because GHC.Prim is not a
+# real source module, it is built-in to GHC. The old build system did
+# this using Setup.hs, but we can't do that here, so we have a flag to
+# enable GHC.Prim in the .cabal file (so that the ghc-prim package
+# remains compatible with the old build system for the time being).
+# GHC.Prim module in the ghc-prim package with a flag:
+#
+libraries/ghc-prim_CONFIGURE_OPTS += --flag=include-ghc-prim
+
+# And then we strip it out again before building the package:
+define libraries/ghc-prim_PACKAGE_MAGIC
+libraries/ghc-prim_dist-install_MODULES := $$(filter-out GHC.Prim,$$(libraries/ghc-prim_dist-install_MODULES))
+endef
+
+PRIMOPS_TXT = $(GHC_COMPILER_DIR)/prelude/primops.txt
+
+libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT)
+ $(MKDIRHIER) $(dir $@)
+ $(GENPRIMOP_INPLACE) --make-haskell-wrappers <$(PRIMOPS_TXT) >$@
+
+libraries/ghc-prim/GHC/Prim.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT)
+ $(GENPRIMOP_INPLACE) --make-haskell-source <$(PRIMOPS_TXT) >$@
+
+
+# -----------------------------------------------------------------------------
+# Include build instructions from all subdirs
+
+# See commentary in the top-level Makefile for why we divide the build
+# into phases.
+
+# Setting foo_dist_DISABLE=YES means "in directory foo, for build
+# "dist", just read the package-data.mk file, do not build anything".
+
+# We carefully engineer things so that we can build the
+# package-data.mk files early on: they depend only on a few tools also
+# built early. Having got the package-data.mk files built, we can
+# restart make with up-to-date information about all the packages
+# (this is phase 0). The remaining problem is the .depend files:
+#
+# - .depend files in libraries need the stage 1 compiler to build
+# - ghc/stage1/.depend needs compiler/stage1 built
+# - compiler/stage1/.depend needs the bootstrap libs built
+#
+# GHC 6.11+ can build a .depend file without having built the
+# dependencies of the package, but we can't rely on the bootstrapping
+# compiler being able to do this, which is why we have to separate the
+# three phases above.
+
+# So this is the final ordering:
+
+# Phase 0 : all package-data.mk files
+# (requires ghc-cabal, ghc-pkg, mkdirhier, dummy-ghc etc.)
+# Phase 1 : .depend files for bootstrap libs
+# (requires hsc2hs)
+# Phase 2 : compiler/stage1/.depend
+# (requires bootstrap libs and genprimopcode)
+# Phase 3 : ghc/stage1/.depend
+# (requires compiler/stage1)
+#
+# The rest : libraries/*/dist-install, compiler/stage2, ghc/stage2
+
+BUILD_DIRS =
+
+ifneq "$(BINDIST)" "YES"
+BUILD_DIRS += \
+ $(GHC_MKDEPENDC_DIR) \
+ $(GHC_MKDIRHIER_DIR)
+endif
+
+BUILD_DIRS += \
+ gmp \
+ docs/users_guide \
+ libraries/Cabal/doc \
+ $(GHC_MANGLER_DIR) \
+ $(GHC_SPLIT_DIR) \
+ $(GHC_UNLIT_DIR) \
+ $(GHC_HP2PS_DIR)
+
+ifneq "$(BINDIST)" "YES"
+BUILD_DIRS += \
+ $(GHC_GENPRIMOP_DIR)
+endif
+
+BUILD_DIRS += \
+ driver \
+ driver/ghci \
+ driver/ghc \
+ libffi \
+ includes \
+ rts
+
+ifneq "$(BINDIST)" "YES"
+BUILD_DIRS += \
+ $(GHC_CABAL_DIR) \
+ $(GHC_GENAPPLY_DIR)
+endif
+
+BUILD_DIRS += \
+ utils/haddock \
+ $(patsubst %, libraries/%, $(PACKAGES)) \
+ compiler \
+ $(GHC_HSC2HS_DIR) \
+ $(GHC_PKG_DIR) \
+ utils/hasktags \
+ utils/hpc \
+ utils/runghc \
+ ghc
+ifeq "$(Windows)" "YES"
+BUILD_DIRS += \
+ $(GHC_TOUCHY_DIR)
+endif
+
+# XXX libraries/% must come before any programs built with stage1, see
+# Note [lib-depends].
+
+ifeq "$(phase)" "0"
+$(foreach lib,$(BOOT_PKGS),$(eval \
+ libraries/$(lib)_dist-boot_DISABLE = YES))
+endif
+
+ifneq "$(findstring $(phase),0 1)" ""
+# We can build deps for compiler/stage1 in phase 2
+compiler_stage1_DISABLE = YES
+endif
+
+ifneq "$(findstring $(phase),0 1 2)" ""
+ghc_stage1_DISABLE = YES
+endif
+
+ifneq "$(findstring $(phase),0 1 2 3)" ""
+# In phases 0-3, we disable stage2-3, the full libraries and haddock
+utils/haddock_dist_DISABLE = YES
+utils/runghc_dist_DISABLE = YES
+utils/hpc_dist_DISABLE = YES
+utils/hasktags_dist_DISABLE = YES
+utils/hsc2hs_dist-install_DISABLE = YES
+utils/ghc-pkg_dist-install_DISABLE = YES
+compiler_stage2_DISABLE = YES
+compiler_stage3_DISABLE = YES
+ghc_stage2_DISABLE = YES
+ghc_stage3_DISABLE = YES
+$(foreach lib,$(PACKAGES),$(eval \
+ libraries/$(lib)_dist-install_DISABLE = YES))
+endif
+
+include $(patsubst %, %/ghc.mk, $(BUILD_DIRS))
+
+# We need -fno-warn-deprecated-flags to avoid failure with -Werror
+GhcLibHcOpts += -fno-warn-deprecated-flags
+ifeq "$(ghc_ge_609)" "YES"
+GhcBootLibHcOpts += -fno-warn-deprecated-flags
+endif
+
+# Add $(GhcLibHcOpts) to all library builds
+$(foreach pkg,$(PACKAGES),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts)))
+
+# XXX we configure packages with the bootsrapping compiler (for
+# dependency reasons, see the phase ordering), which doesn't
+# necessarily support all the extensions we need, and Cabal filters
+# out the ones it thinks aren't supported.
+libraries/base3-compat_dist-install_HC_OPTS += -XPackageImports
+
+# -----------------------------------------------------------------------------
+# Bootstrapping libraries
+
+# We need to build a few libraries with the installed GHC, since GHC itself
+# and some of the tools depend on them:
+
+ifneq "$(BINDIST)" "YES"
+
+ifeq "$(wildcard $(BOOTSTRAPPING_CONF))" ""
+$(shell echo "[]" >$(BOOTSTRAPPING_CONF))
+endif
+
+$(eval $(call clean-target,$(BOOTSTRAPPING_CONF),,$(BOOTSTRAPPING_CONF)))
+
+# These three libraries do not depend on each other, so we can build
+# them straight off:
+
+$(eval $(call build-package,libraries/hpc,dist-boot,0))
+$(eval $(call build-package,libraries/extensible-exceptions,dist-boot,0))
+$(eval $(call build-package,libraries/Cabal,dist-boot,0))
+
+# register the boot packages in strict sequence, because running
+# multiple ghc-pkgs in parallel doesn't work (registrations may get
+# lost).
+fixed_pkg_prev=
+$(foreach pkg,$(BOOT_PKGS),$(eval $(call fixed_pkg_dep,$(pkg),dist-boot)))
+
+compiler/stage1/package-data.mk : \
+ libraries/Cabal/dist-boot/package-data.mk \
+ libraries/hpc/dist-boot/package-data.mk \
+ libraries/extensible-exceptions/dist-boot/package-data.mk
+
+# These are necessary because the bootstrapping compiler may not know
+# about cross-package dependencies:
+$(compiler_stage1_depfile) : $(BOOT_LIBS)
+$(ghc_stage1_depfile) : $(compiler_stage1_v_LIB)
+
+$(foreach pkg,$(BOOT_PKGS),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBootLibHcOpts)))
+
+endif
+
+# -----------------------------------------------------------------------------
+# Creating a local mingw copy on Windows
+
+ifeq "$(Windows)" "YES"
+
+# directories don't work well as dependencies, hence a stamp file
+$(INPLACE)/stamp-mingw : $(MKDIRHIER)
+ $(MKDIRHIER) $(INPLACE_MINGW)/bin
+ GCC=`type -p $(WhatGccIsCalled)`; \
+ GccDir=`dirname $$GCC`; \
+ $(CP) -p $$GccDir/{gcc.exe,ar.exe,as.exe,dlltool.exe,dllwrap.exe,windres.exe} $(INPLACE_MINGW)/bin; \
+ $(CP) -Rp $$GccDir/../include $(INPLACE_MINGW); \
+ $(CP) -Rp $$GccDir/../lib $(INPLACE_MINGW); \
+ $(CP) -Rp $$GccDir/../libexec $(INPLACE_MINGW); \
+ $(CP) -Rp $$GccDir/../mingw32 $(INPLACE_MINGW)
+ touch $(INPLACE)/stamp-mingw
+
+install : install_mingw
+.PHONY: install_mingw
+install_mingw : $(INPLACE_MINGW)
+ $(CP) -Rp $(INPLACE_MINGW) $(prefix)
+
+$(INPLACE_LIB)/perl.exe $(INPLACE_LIB)/perl56.dll :
+ $(CP) $(GhcDir)../{perl.exe,perl56.dll} $(INPLACE_LIB)
+
+endif # Windows
+
+libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock: \
+ libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs \
+ libraries/ghc-prim/dist-install/build/autogen/GHC/PrimopWrappers.hs
+
+libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs: \
+ $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) $(MKDIRHIER)
+ $(MKDIRHIER) $(dir $@)
+ $(GENPRIMOP_INPLACE) --make-haskell-source < $< > $@
+
+libraries/ghc-prim/dist-install/build/autogen/GHC/PrimopWrappers.hs: \
+ $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) $(MKDIRHIER)
+ $(MKDIRHIER) $(dir $@)
+ $(GENPRIMOP_INPLACE) --make-haskell-wrappers < $< > $@
+
+# -----------------------------------------------------------------------------
+# Installation
+
+install: install_packages install_libs install_libexecs install_headers \
+ install_libexec_scripts install_bins
+
+install_bins: $(INSTALL_BINS)
+ $(INSTALL_DIR) $(DESTDIR)$(bindir)
+ for i in $(INSTALL_BINS); do \
+ $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(bindir) ; \
+ if test "$(darwin_TARGET_OS)" = "1"; then \
+ sh mk/fix_install_names.sh $(libdir) $(DESTDIR)$(bindir)/$$i ; \
+ fi ; \
+ done
+
+install_libs: $(INSTALL_LIBS)
+ $(INSTALL_DIR) $(DESTDIR)$(libdir)
+ for i in $(INSTALL_LIBS); do \
+ case $$i in \
+ *.a) \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
+ $(RANLIB) $(DESTDIR)$(libdir)/`basename $$i` ;; \
+ *.dll) \
+ $(INSTALL_DATA) -s $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir) ;; \
+ *.so) \
+ $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir) ;; \
+ *.dylib) \
+ $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
+ install_name_tool -id $(DESTDIR)$(libdir)/`basename $$i` $(DESTDIR)$(libdir)/`basename $$i` ;; \
+ *) \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
+ esac; \
+ done
+
+install_libexec_scripts: $(INSTALL_LIBEXEC_SCRIPTS)
+ $(MKDIRHIER) $(DESTDIR)$(libexecdir)
+ for i in $(INSTALL_LIBEXEC_SCRIPTS); do \
+ $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(libexecdir); \
+ done
+
+install_libexecs: $(INSTALL_LIBEXECS)
+ $(MKDIRHIER) $(DESTDIR)$(libexecdir)
+ for i in $(INSTALL_LIBEXECS); do \
+ $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(libexecdir); \
+ done
+
+install_headers: $(INSTALL_HEADERS)
+ $(INSTALL_DIR) $(DESTDIR)$(headerdir)
+ for i in $(INSTALL_HEADERS); do \
+ $(INSTALL_HEADER) $(INSTALL_OPTS) $$i $(DESTDIR)$(headerdir); \
+ done
+
+INSTALLED_PACKAGE_CONF=$(DESTDIR)$(libdir)/package.conf
+
+# Install packages in the right order, so that ghc-pkg doesn't complain.
+# Also, install ghc-pkg first.
+ifeq "$(Windows)" "NO"
+INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(libexecdir)/ghc-pkg
+else
+INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
+endif
+
+install_packages: install_libexecs
+install_packages: libffi/package.conf.install rts/package.conf.install
+ $(MKDIRHIER) $(DESTDIR)$(libdir)
+ echo "[]" > $(INSTALLED_PACKAGE_CONF)
+ $(INSTALLED_GHC_PKG_REAL) --force --global-conf $(INSTALLED_PACKAGE_CONF) update libffi/package.conf.install
+ $(INSTALLED_GHC_PKG_REAL) --force --global-conf $(INSTALLED_PACKAGE_CONF) update rts/package.conf.install
+ $(foreach p, $(PACKAGES),\
+ $(GHC_CABAL_INPLACE) install \
+ $(INSTALLED_GHC_PKG_REAL) \
+ $(INSTALLED_PACKAGE_CONF) \
+ libraries/$p dist-install \
+ '$(DESTDIR)' '$(prefix)' '$(libdir)' '$(docdir)/libraries' &&) true
+ $(GHC_CABAL_INPLACE) install \
+ $(INSTALLED_GHC_PKG_REAL) \
+ $(INSTALLED_PACKAGE_CONF) \
+ compiler stage2 \
+ '$(DESTDIR)' '$(prefix)' '$(libdir)' '$(docdir)/libraries'
+
+# -----------------------------------------------------------------------------
+# Binary distributions
+
+$(eval $(call bindist,.,\
+ LICENSE \
+ configure config.sub config.guess \
+ extra-gcc-opts.in \
+ Makefile \
+ mk/config.mk.in \
+ $(INPLACE_BIN)/mkdirhier \
+ $(INPLACE_BIN)/ghc-cabal \
+ utils/pwd/pwd \
+ $(BINDIST_WRAPPERS) \
+ $(BINDIST_LIBS) \
+ $(BINDIST_HI) \
+ $(BINDIST_EXTRAS) \
+ $(INSTALL_HEADERS) \
+ $(INSTALL_LIBEXECS) \
+ $(INSTALL_LIBEXEC_SCRIPTS) \
+ $(INSTALL_BINS) \
+ $(filter-out extra-gcc-opts,$(INSTALL_LIBS)) \
+ $(filter-out %/project.mk,$(filter-out mk/config.mk,$(MAKEFILE_LIST))) \
+ mk/fix_install_names.sh \
+ mk/project.mk \
+ ))
+# mk/project.mk gets an absolute path, so we manually include it in
+# the bindist with a relative path
+
+binary-dist:
+ $(RM) -rf $(BIN_DIST_NAME)
+ mkdir $(BIN_DIST_NAME)
+ set -e; for i in LICENSE compiler ghc rts libraries utils gmp docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess extra-gcc-opts.in ghc.mk inplace; do ln -s ../$$i $(BIN_DIST_NAME)/; done
+ ln -s ../distrib/configure-bin.ac $(BIN_DIST_NAME)/configure.ac
+ cd $(BIN_DIST_NAME) && autoreconf
+ $(RM) -f $(BIN_DIST_TAR)
+# h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
+# tree then we want to include the real file, not a symlink to it
+ $(TAR) hcf $(BIN_DIST_TAR) -T $(BIN_DIST_LIST)
+ bzip2 < $(BIN_DIST_TAR) > $(BIN_DIST_TAR_BZ2)
+
+# -----------------------------------------------------------------------------
+# Source distributions
+
+# Do it like this:
+#
+# $ make
+# $ make sdist
+#
+
+# A source dist is built from a complete build tree, because we
+# require some extra files not contained in a darcs checkout: the
+# output from Happy and Alex, for example.
+#
+# The steps performed by 'make dist' are as follows:
+# - create a complete link-tree of the current build tree in /tmp
+# - run 'make distclean' on that tree
+# - remove a bunch of other files that we know shouldn't be in the dist
+# - tar up first the extralibs package, then the main source package
+
+#
+# Directory in which we're going to build the src dist
+#
+SRC_DIST_NAME=ghc-$(ProjectVersion)
+SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME)
+
+#
+# Files to include in source distributions
+#
+SRC_DIST_DIRS = mk rules docs distrib bindisttest gmp libffi includes utils docs rts compiler ghc driver libraries
+SRC_DIST_FILES += \
+ configure.ac config.guess config.sub configure \
+ aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \
+ ghc.spec.in ghc.spec extra-gcc-opts.in VERSION boot ghc.mk
+
+EXTRA_LIBS=$(patsubst %, $(SRC_DIST_NAME)/%, $(shell grep -E "extralibs|dph" packages | grep -v "^\#" | sed "s/ .*//"))
+
+SRC_DIST_TARBALL = ghc-$(ProjectVersion)-src.tar.bz2
+SRC_DIST_EXTRALIBS_TARBALL = ghc-$(ProjectVersion)-src-extralibs.tar.bz2
+
+VERSION :
+ echo $(ProjectVersion) >VERSION
+
+sdist : VERSION
+
+# Use:
+# $(call sdist_file,compiler,stage2,cmm,CmmLex,x)
+# to copy the generated file that replaces compiler/cmm/CmmLex.x, where
+# "stage2" is the dist dir.
+sdist_file = \
+ if test -f $(TOP)/$1/$2/build/$4.hs; then \
+ $(CP) $(TOP)/$1/$2/build/$4.hs $1/$3/ ; \
+ mv $1/$3/$4.$5 $1/$3/$4.$5.source ;\
+ else \
+ echo "does not exist: $1/$2//build/$4.hs"; \
+ exit 1; \
+ fi
+
+.PHONY: sdist-prep
+sdist-prep :
+ $(RM) -rf $(SRC_DIST_DIR)
+ $(RM) $(SRC_DIST_NAME).tar.gz
+ mkdir $(SRC_DIST_DIR)
+ ( cd $(SRC_DIST_DIR) \
+ && for i in $(SRC_DIST_DIRS); do mkdir $$i; (cd $$i && lndir $(TOP)/$$i ); done \
+ && for i in $(SRC_DIST_FILES); do $(LN_S) $(TOP)/$$i .; done \
+ && $(MAKE) distclean \
+ && if test -f $(TOP)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs; then $(CP) $(TOP)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs libraries/haskell-src/Language/Haskell/ ; mv libraries/haskell-src/Language/Haskell/Parser.ly libraries/haskell-src/Language/Haskell/Parser.ly.source ; fi \
+ && $(call sdist_file,compiler,stage2,cmm,CmmLex,x) \
+ && $(call sdist_file,compiler,stage2,cmm,CmmParse,y) \
+ && $(call sdist_file,compiler,stage2,main,ParsePkgConf,y) \
+ && $(call sdist_file,compiler,stage2,parser,HaddockLex,x) \
+ && $(call sdist_file,compiler,stage2,parser,HaddockParse,y) \
+ && $(call sdist_file,compiler,stage2,parser,Lexer,x) \
+ && $(call sdist_file,compiler,stage2,parser,Parser,y.pp) \
+ && $(call sdist_file,compiler,stage2,parser,ParserCore,y) \
+ && $(call sdist_file,utils/hpc,dist,,HpcParser,y) \
+ && $(call sdist_file,utils/genprimopcode,dist,,Lexer,x) \
+ && $(call sdist_file,utils/genprimopcode,dist,,Parser,y) \
+ && $(RM) -rf compiler/stage[123] mk/build.mk \
+ && $(FIND) $(SRC_DIST_DIRS) \( -name _darcs -o -name SRC -o -name "autom4te*" -o -name "*~" -o -name ".cvsignore" -o -name "\#*" -o -name ".\#*" -o -name "log" -o -name "*-SAVE" -o -name "*.orig" -o -name "*.rej" -o -name "*-darcs-backup*" \) -print | xargs $(RM) -rf \
+ )
+
+.PHONY: sdist
+sdist : sdist-prep
+ $(TAR) chf - $(EXTRA_LIBS) | bzip2 >$(TOP)/$(SRC_DIST_EXTRALIBS_TARBALL)
+ $(RM) -rf $(EXTRA_LIBS)
+ $(TAR) chf - $(SRC_DIST_NAME) 2>$src_log | bzip2 >$(TOP)/$(SRC_DIST_TARBALL)
+
+sdist-manifest : $(SRC_DIST_TARBALL)
+ tar tjf $(SRC_DIST_TARBALL) | sed "s|^ghc-$(ProjectVersion)/||" | sort >sdist-manifest
+
+# Upload the distribution(s)
+# Retrying is to work around buggy firewalls that corrupt large file transfers
+# over SSH.
+ifneq "$(PublishLocation)" ""
+publish-sdist :
+ @for i in 0 1 2 3 4 5 6 7 8 9; do \
+ echo "Try $$i: $(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist"; \
+ if $(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist; then break; fi; \
+ done
+ @for i in 0 1 2 3 4 5 6 7 8 9; do \
+ echo "Try $$i: $(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist"; \
+ if $(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist; then break; fi; \
+ done
+endif
+
+# -----------------------------------------------------------------------------
+# Cleaning
+
+.PHONY: clean
+
+clean : clean_files
+.PHONY: clean_files
+clean_files :
+ $(RM) $(CLEAN_FILES)
+
+distclean : clean
+ $(RM) config.cache config.status config.log mk/config.h mk/stamp-h
+ $(RM) mk/config.mk mk/are-validating.mk
+ $(RM) extra-gcc-opts docs/users_guide/ug-book.xml
+ $(RM) compiler/ghc.cabal ghc/ghc-bin.cabal
+ $(RM) libraries/base/include/HsBaseConfig.h
+ $(RM) libraries/directory/include/HsDirectoryConfig.h
+
+maintainer-clean : distclean
+ $(RM) ghc.spec
+ $(RM) libraries/*/GNUmakefile
+# WARNING: ghc.spec is automatically generated from ghc.spec.in by
+# ./configure. Make sure you are editing ghc.spec.in, not ghc.spec.
+#
# RPM spec file for GHC -*-rpm-spec-*-
#
# Copyright [1998..2007] The GHC Team
module Main (main) where
-#include "HsVersions.h"
-
-- The official GHC API
import qualified GHC
import GHC ( DynFlags(..), HscTarget(..),
+dir = ghc
+TOP = ..
+SPEC_TARGETS = 1 2 3
+include $(TOP)/mk/sub-makefile.mk
-TOP=..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/cabal-flags.mk
+.PHONY: 1 2 3
-ifeq "$(stage)" ""
-stage=1
-endif
+1:
+ +$(TOPMAKE) stage=1 all_ghc_stage1 compiler_stage1_NO_BUILD_DEPS=YES
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-INSTALL_FLAGS =
-else
-INSTALL_FLAGS = --enable-shell-wrappers
-endif
+2:
+ +$(TOPMAKE) stage=2 all_ghc_stage2 compiler_stage2_NO_BUILD_DEPS=YES
-# Don't strip the inplace versions, we might need to debug them
-INPLACE_INSTALL_FLAGS += --disable-executable-stripping
-
-boot:: boot.stage.$(stage)
-
-all:: build.stage.$(stage)
-
-rebuild ::
- -$(CABAL) clean --distpref dist-stage$(stage)
- $(RM) -rf stage$(stage)-inplace
- $(MAKE) boot all
-
-stage1 ::
- $(MAKE) stage=1
-
-stage2 ::
- $(MAKE) stage=2
-
-stage3 ::
- $(MAKE) stage=3
-
-
-ifeq "$(CLEAN_ALL_STAGES)" "YES"
-clean distclean maintainer-clean:: clean.stage.1 clean.stage.2 clean.stage.3
-else
-clean distclean maintainer-clean:: clean.stage.$(stage)
-endif
-
-ifeq "$(CLEAN_ALL_STAGES)" "YES"
-distclean maintainer-clean::
- $(RM) -f ghc-bin.cabal
-endif
-
-clean.stage.%:
- $(RM) -rf stage$*-inplace
-# This is a bit naughty. We ought to use:
-# -$(CABAL) clean --distpref dist-stage$*
-# but that won't work if the Cabal file (a generated file) doesn't
-# exist. So we do this instead:
- $(RM) -rf dist-stage$*
-
-CONFIGURE_FLAGS_STAGE1 += --flags=-ghci
-
-ifeq "$(GhcWithInterpreter)" "YES"
-CONFIGURE_FLAGS_STAGE2PLUS += --flags=ghci
-else
-CONFIGURE_FLAGS_STAGE2PLUS += --flags=-ghci
-endif
-
-ifeq "$(GhcProfiled)" "YES"
-CONFIGURE_FLAGS_STAGE2PLUS += --enable-executable-profiling
-endif
-ifeq "$(GhcDebugged)" "YES"
-CONFIGURE_FLAGS_STAGE2PLUS += --ghc-option=-debug
-endif
-ifeq "$(GhcThreaded)" "YES"
-# Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
-CONFIGURE_FLAGS_STAGE2PLUS += --ghc-option=-threaded
-endif
-
-ifeq "$(BuildSharedLibs)" "YES"
-CONFIGURE_FLAGS_STAGE2PLUS += --ghc-option=-dynamic
-endif
-
-CONFIGURE_FLAGS_STAGE2 = $(CONFIGURE_FLAGS_STAGE2PLUS)
-CONFIGURE_FLAGS_STAGE3 = $(CONFIGURE_FLAGS_STAGE2PLUS)
-
-CONFIGURE_FLAGS_STAGE1 += $(USE_BOOT_CONFIGURE_FLAGS)
-CONFIGURE_FLAGS_STAGE2 += $(USE_STAGE1_CONFIGURE_FLAGS)
-CONFIGURE_FLAGS_STAGE3 += $(USE_STAGE2_CONFIGURE_FLAGS)
-CONFIGURE_FLAGS_STAGE3 += --package-db $(STAGE3_PACKAGE_CONF)
-
-CONFIGURE_FLAGS_STAGE1 += $(foreach flag, $(GhcStage1HcOpts), --ghc-option=$(flag))
-CONFIGURE_FLAGS_STAGE2 += $(foreach flag, $(GhcStage2HcOpts), --ghc-option=$(flag))
-CONFIGURE_FLAGS_STAGE3 += $(foreach flag, $(GhcStage3HcOpts), --ghc-option=$(flag))
-
-BUILD_FLAGS += $(patsubst %, --ghc-option=%, $(SRC_HC_OPTS))
-# Allow EXTRA_HC_OPTS to be used from the command line to add options
-# when building (e.g. -v)
-BUILD_FLAGS += $(patsubst %, --ghc-option=%, $(EXTRA_HC_OPTS))
-
-# XXX In stage2+ we should really use the inplace ghc-pkg
-# It works because installPackage doesn't actually use ghc-pkg, as there's
-# no library to register
-
-ifeq "$(stage)" "1"
-ifeq "$(ghc_ge_609)" "NO"
-# GHC 6.9+ can handle cross-package recompilation checking, but
-# we don't rely on the bootstrapping compiler being able to do this.
-TOUCH_MAIN = $(RM) dist-stage1/build/ghc/ghc-tmp/Main.o
-endif
-endif
-
-dist-stage1 dist-stage2 dist-stage3: dist-stage%: boot.stage.%
-
-boot.stage.%:
- $(CABAL) configure --distpref dist-stage$* \
- $(INSTALL_DIRS_CONFIGURE_FLAGS) \
- $(CONFIGURE_FLAGS_STAGE$*) \
- $(COMMON_CONFIGURE_FLAGS) \
- --libsubdir=. \
- --datadir='$$libdir' \
- --datasubdir=.
-
-build.stage.%: dist-stage%
- $(TOUCH_MAIN)
- $(CABAL) build --distpref dist-stage$* $(BUILD_FLAGS)
- $(INSTALL_PACKAGE) install '$(GHC_PKG_PROG)' 'XXX/package.conf' "" \
- $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
- $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
- '$$prefix' \
- '$(INPLACE_DATA_DIR)' \
- '$$prefix/libexec' \
- '$$prefix/dynlib' \
- '$(INPLACE_DATA_DIR)' \
- '$$prefix/doc' \
- '$$prefix/html' \
- '$$prefix/haddock' \
- --distpref dist-stage$* \
- $(INPLACE_INSTALL_FLAGS) \
- $(INSTALL_FLAGS)
-
-# XXX For now we always install the stage 2 compiler
-install:
- $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
- '$(prefix)' '$(bindir)' '$(libdir)' \
- '$(libexecdir)' '$(dynlibdir)' '$(datadir)' \
- '$(docdir)' '$(htmldir)' '$(haddockdir)' \
- --distpref dist-stage2 \
- $(INSTALL_FLAGS)
-
-html:
- @:
-
-install-docs:
- @:
-
-include $(TOP)/mk/bindist.mk
-EXE_DIST_DIR = dist-stage2
+3:
+ +$(TOPMAKE) stage=3 all_ghc_stage3 compiler_stage3_NO_BUILD_DEPS=YES
+-- WARNING: ghc-bin.cabal is automatically generated from ghc-bin.cabal.in by
+-- ./configure. Make sure you are editing ghc-bin.cabal.in, not ghc-bin.cabal.
+
Name: ghc-bin
Version: @ProjectVersion@
Copyright: XXX
--- /dev/null
+# ToDo
+ghc_USES_CABAL = NO
+# ghc_PACKAGE = ghc-bin
+
+ghc_stage1_HC_OPTS = $(GhcStage1HcOpts)
+ghc_stage2_HC_OPTS = $(GhcStage2HcOpts)
+ghc_stage3_HC_OPTS = $(GhcStage3HcOpts)
+
+ifeq "$(GhcWithInterpreter)" "YES"
+ghc_stage2_HC_OPTS += -DGHCI
+ghc_stage3_HC_OPTS += -DGHCI
+endif
+
+ifeq "$(GhcDebugged)" "YES"
+ghc_HC_OPTS += -debug
+endif
+
+ifeq "$(GhcThreaded)" "YES"
+# Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
+ghc_HC_OPTS += -threaded
+endif
+
+ifeq "$(BuildSharedLibs)" "YES"
+ghc_HC_OPTS += -dynamic
+endif
+
+# XXX ToDp
+# ifeq "$(GhcProfiled)" "YES"
+
+ghc_stage1_MODULES = Main
+
+ghc_stage2_MODULES = $(ghc_stage1_MODULES)
+ghc_stage3_MODULES = $(ghc_stage1_MODULES)
+
+ghc_stage1_PROG = ghc-stage1$(exeext)
+ghc_stage2_PROG = ghc-stage2$(exeext)
+ghc_stage3_PROG = ghc-stage3$(exeext)
+
+# ToDo: perhaps use ghc-cabal to configure ghc-bin
+ghc_stage1_USE_BOOT_LIBS = YES
+ghc_stage1_HC_OPTS += -package $(compiler_PACKAGE)-$(compiler_stage1_VERSION)
+ghc_stage2_HC_OPTS += -package $(compiler_PACKAGE)-$(compiler_stage2_VERSION)
+ghc_stage3_HC_OPTS += -package $(compiler_PACKAGE)-$(compiler_stage3_VERSION)
+
+ghc_stage1_HC_OPTS += -XCPP -XPatternGuards
+ghc_stage2_HC_OPTS += -XCPP -XPatternGuards
+ghc_stage3_HC_OPTS += -XCPP -XPatternGuards
+
+# In stage1 we might not benefit from cross-package dependencies and
+# recompilation checking. We must force recompilation here, otherwise
+# Main.o won't necessarily be rebuilt when the ghc package has changed:
+ghc_stage1_HC_OPTS += -fforce-recomp
+
+# Further dependencies we need only in stage 1, due to no
+# cross-package dependencies or recompilation checking.
+ghc/stage1/build/Main.o : $(compiler_stage1_v_LIB)
+
+ghc_stage1_SHELL_WRAPPER = YES
+ghc_stage2_SHELL_WRAPPER = YES
+ghc_stage3_SHELL_WRAPPER = YES
+ghc_stage1_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
+ghc_stage2_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
+ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
+
+ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER = YES
+ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion)
+
+# stage 1 is enabled unless $(stage) is set to something other than 1
+ifeq "$(filter-out 1,$(stage))" ""
+$(eval $(call build-prog,ghc,stage1,0))
+endif
+
+# stage 2 is enabled unless $(stage) is set to something other than 2
+ifeq "$(filter-out 2,$(stage))" ""
+$(eval $(call build-prog,ghc,stage2,1))
+endif
+
+# stage 3 has to be requested explicitly with stage=3
+ifeq "$(stage)" "3"
+$(eval $(call build-prog,ghc,stage3,2))
+endif
+
+ifneq "$(BINDIST)" "YES"
+
+# ToDo: should we add these in the build-prog macro?
+ghc/stage1/build/tmp/$(ghc_stage1_PROG) : $(compiler_stage1_v_LIB)
+ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_v_LIB)
+ghc/stage3/build/tmp/$(ghc_stage3_PROG) : $(compiler_stage3_v_LIB)
+
+all_ghc_stage1 : $(GHC_STAGE1)
+all_ghc_stage2 : $(GHC_STAGE2)
+all_ghc_stage3 : $(GHC_STAGE3)
+
+$(INPLACE_LIB)/extra-gcc-opts : extra-gcc-opts
+ $(CP) $< $@
+
+# The GHC programs need to depend on all the helper programs they might call
+$(GHC_STAGE1) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
+$(GHC_STAGE2) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
+$(GHC_STAGE3) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
+
+ifeq "$(Windows)" "YES"
+$(GHC_STAGE1) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
+$(GHC_STAGE2) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
+$(GHC_STAGE3) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
+endif
+
+endif
+
+INSTALL_LIBS += extra-gcc-opts
+
+ifeq "$(Windows)" "NO"
+install: install_ghc_link
+.PNONY: install_ghc_link
+install_ghc_link:
+ $(RM) -f $(DESTDIR)$(bindir)/ghc
+ $(LN_S) ghc-$(ProjectVersion) $(DESTDIR)$(bindir)/ghc
+else
+# On Windows we install the main binary as $(bindir)/ghc.exe
+# To get ghc-<version>.exe we have a little C program in driver/ghc
+install: install_ghc_post
+.PHONY: install_ghc_post
+install_ghc_post: install_bins
+ $(RM) -f $(DESTDIR)$(bindir)/ghc.exe
+ $(MV) -f $(DESTDIR)$(bindir)/ghc-stage$(INSTALL_GHC_STAGE).exe $(DESTDIR)$(bindir)/ghc.exe
+endif
+
-#!/bin/sh
-
exec $executablename -B$datadir -dynload wrapped ${1+"$@"}
+++ /dev/null
-
-TOP=..
-
-include $(TOP)/mk/boilerplate.mk
-
-# -----------------------------------------------------------------------------
-# Compile GMP only if we don't have it already
-#
-# We use GMP's own configuration stuff, because it's all rather hairy
-# and not worth re-implementing in our Makefile framework.
-
-ifneq "$(HaveLibGmp)" "YES"
-ifneq "$(HaveFrameworkGMP)" "YES"
-
-PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
-
-# 2007-09-26
-# set -o igncr
-# is not a valid command on non-Cygwin-systems.
-# Let it fail silently instead of aborting the build.
-#
-# 2007-07-05
-# We do
-# set -o igncr; export SHELLOPTS
-# here as otherwise checking the size of limbs
-# makes the build fall over on Cygwin. See the thread
-# http://www.cygwin.com/ml/cygwin/2006-12/msg00011.html
-# for more details.
-
-# 2007-07-05
-# Passing
-# as_ln_s='cp -p'
-# isn't sufficient to stop cygwin using symlinks the mingw gcc can't
-# follow, as it isn't used consistently. Instead we put an ln.bat in
-# path that always fails.
-
-# We use a tarball like gmp-4.2.1-nodoc.tar.gz, which is
-# gmp-4.2.1.tar.gz repacked without the doc/ directory contents.
-# That's because the doc/ directory contents are under the GFDL,
-# which causes problems for Debian.
-
-GMP_TARBALL := $(firstword $(wildcard gmp*.tar.gz))
-GMP_DIR := $(subst -nodoc.tar.gz,,$(GMP_TARBALL))
-
-ifeq "$(findstring dyn, $(GhcRTSWays))" "dyn"
-BUILD_SHARED=yes
-else
-BUILD_SHARED=no
-endif
-
-BINDIST_STAMPS = stamp.gmp.static
-INSTALL_HEADERS += gmp.h
-INSTALL_LIBS += libgmp.a
-
-ifeq "$(BUILD_SHARED)" "yes"
-BINDIST_STAMPS += stamp.gmp.shared
-INSTALL_LIBS += libgmp.dll.a
-INSTALL_PROGS += libgmp-3.dll
-endif
-
-install all :: $(INSTALL_HEADERS) $(INSTALL_LIBS) $(INSTALL_PROGS)
-
-stamp.gmp.static:
- $(RM) -rf $(GMP_DIR) gmpbuild
- $(TAR) -zxf $(GMP_TARBALL)
- mv $(GMP_DIR) gmpbuild
- chmod +x ln
- (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
- PATH=`pwd`:$$PATH; \
- export PATH; \
- cd gmpbuild && \
- CC=$(WhatGccIsCalled) $(SHELL) configure \
- --enable-shared=no --host=$(PLATFORM) --build=$(PLATFORM)
- touch $@
-
-stamp.gmp.shared:
- $(RM) -rf $(GMP_DIR) gmpbuild-shared
- $(TAR) -zxf $(GMP_TARBALL)
- mv $(GMP_DIR) gmpbuild-shared
- chmod +x ln
- (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
- PATH=`pwd`:$$PATH; \
- export PATH; \
- cd gmpbuild-shared && \
- CC=$(WhatGccIsCalled) $(SHELL) configure \
- --enable-shared=yes --disable-static --host=$(PLATFORM) --build=$(PLATFORM)
- touch $@
-
-gmp.h: stamp.gmp.static
- $(CP) gmpbuild/gmp.h .
-
-libgmp.a: stamp.gmp.static
- $(MAKE) -C gmpbuild MAKEFLAGS=
- $(CP) gmpbuild/.libs/libgmp.a .
- $(RANLIB) libgmp.a
-
-libgmp-3.dll: stamp.gmp.shared
- $(MAKE) -C gmpbuild-shared MAKEFLAGS=
- $(CP) gmpbuild-shared/.libs/libgmp-3.dll .
-
-libgmp.dll.a: libgmp-3.dll
- $(CP) gmpbuild-shared/.libs/libgmp.dll.a .
-endif
-endif
-
-# GMP takes a long time to build, but changes rarely. Hence we don't
-# bother cleaning it before validating, because that adds a
-# significant overhead to validation.
-ifeq "$(Validating)" "NO"
-clean distclean maintainer-clean ::
- $(RM) -f stamp.gmp.static stamp.gmp.shared
- $(RM) -rf gmpbuild
- $(RM) -rf gmpbuild-shared
-endif
-
-#-----------------------------------------------------------------------------
-#
-# binary-dist
-
-include $(TOP)/mk/target.mk
-
-BINDIST_EXTRAS += $(BINDIST_STAMPS)
-BINDIST_EXTRAS += $(INSTALL_PROGS)
-BINDIST_EXTRAS += $(INSTALL_LIBS)
-BINDIST_EXTRAS += $(INSTALL_HEADERS)
-include $(TOP)/mk/bindist.mk
-
--- /dev/null
+
+# Compile GMP only if we don't have it already
+#
+# We use GMP's own configuration stuff, because it's all rather hairy
+# and not worth re-implementing in our Makefile framework.
+
+ifeq "$(findstring dyn, $(GhcRTSWays))" "dyn"
+BUILD_SHARED=yes
+else
+BUILD_SHARED=no
+endif
+
+# In a bindist, we don't want to know whether /this/ machine has gmp,
+# but whether the machine the bindist was built on had gmp.
+ifeq "$(BINDIST)" "YES"
+ifeq "$(wildcard gmp/libgmp.a)" ""
+HaveLibGmp = YES
+HaveFrameworkGMP = YES
+else
+HaveLibGmp = NO
+HaveFrameworkGMP = NO
+endif
+endif
+
+ifneq "$(HaveLibGmp)" "YES"
+ifneq "$(HaveFrameworkGMP)" "YES"
+
+INSTALL_LIBS += gmp/libgmp.a
+
+$(eval $(call all-target,gmp_dynamic,gmp/libgmp.a))
+
+ifeq "$(BUILD_SHARED)" "yes"
+$(eval $(call all-target,gmp_dynamic,gmp/libgmp.dll.a gmp/libgmp-3.dll))
+endif
+
+endif
+endif
+
+PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
+
+# 2007-09-26
+# set -o igncr
+# is not a valid command on non-Cygwin-systems.
+# Let it fail silently instead of aborting the build.
+#
+# 2007-07-05
+# We do
+# set -o igncr; export SHELLOPTS
+# here as otherwise checking the size of limbs
+# makes the build fall over on Cygwin. See the thread
+# http://www.cygwin.com/ml/cygwin/2006-12/msg00011.html
+# for more details.
+
+# 2007-07-05
+# Passing
+# as_ln_s='cp -p'
+# isn't sufficient to stop cygwin using symlinks the mingw gcc can't
+# follow, as it isn't used consistently. Instead we put an ln.bat in
+# path that always fails.
+
+# We use a tarball like gmp-4.2.4-nodoc.tar.bz2, which is
+# gmp-4.2.4.tar.bz2 repacked without the doc/ directory contents.
+# That's because the doc/ directory contents are under the GFDL,
+# which causes problems for Debian.
+
+GMP_TARBALL := $(wildcard gmp/tarball/gmp*.tar.bz2)
+GMP_DIR := $(patsubst gmp/tarball/%-nodoc.tar.bz2,%,$(GMP_TARBALL))
+
+# XXX INSTALL_HEADERS += gmp.h
+
+gmp/libgmp.a:
+ $(RM) -rf $(GMP_DIR) gmp/gmpbuild
+ cd gmp && $(TAR) -jxf ../$(GMP_TARBALL)
+ mv gmp/$(GMP_DIR) gmp/gmpbuild
+ chmod +x gmp/ln
+ cd gmp; (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
+ PATH=`pwd`:$$PATH; \
+ export PATH; \
+ cd gmpbuild && \
+ CC=$(WhatGccIsCalled) $(SHELL) configure \
+ --enable-shared=no --host=$(PLATFORM) --build=$(PLATFORM)
+ $(MAKE) -C gmp/gmpbuild MAKEFLAGS=
+ $(CP) gmp/gmpbuild/.libs/libgmp.a gmp/
+ $(RANLIB) gmp/libgmp.a
+
+$(eval $(call clean-target,gmp,,\
+ gmp/libgmp.a gmp/gmpbuild gmp/$(GMP_DIR)))
+
+# XXX TODO:
+#stamp.gmp.shared:
+# $(RM) -rf $(GMP_DIR) gmpbuild-shared
+# $(TAR) -zxf $(GMP_TARBALL)
+# mv $(GMP_DIR) gmpbuild-shared
+# chmod +x ln
+# (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
+# PATH=`pwd`:$$PATH; \
+# export PATH; \
+# cd gmpbuild-shared && \
+# CC=$(WhatGccIsCalled) $(SHELL) configure \
+# --enable-shared=yes --disable-static --host=$(PLATFORM) --build=$(PLATFORM)
+# touch $@
+#
+#gmp.h: stamp.gmp.static
+# $(CP) gmpbuild/gmp.h .
+#
+#libgmp.a: stamp.gmp.static
+#
+#libgmp-3.dll: stamp.gmp.shared
+# $(MAKE) -C gmpbuild-shared MAKEFLAGS=
+# $(CP) gmpbuild-shared/.libs/libgmp-3.dll .
+#
+#libgmp.dll.a: libgmp-3.dll
+# $(CP) gmpbuild-shared/.libs/libgmp.dll.a .
+
+## GMP takes a long time to build, but changes rarely. Hence we don't
+## bother cleaning it before validating, because that adds a
+## significant overhead to validation.
+#ifeq "$(Validating)" "NO"
+#clean distclean maintainer-clean ::
+# $(RM) -f stamp.gmp.static stamp.gmp.shared
+# $(RM) -rf gmpbuild
+# $(RM) -rf gmpbuild-shared
+#endif
+
-# -----------------------------------------------------------------------------
-
-TOP = ..
-include $(TOP)/mk/boilerplate.mk
-
-#
-# Header files built from the configure script's findings
-#
-H_CONFIG = ghcautoconf.h
-H_PLATFORM = ghcplatform.h
-
-#
-# All header files
-#
-H_FILES = $(filter-out $(H_CONFIG) $(H_PLATFORM),$(wildcard *.h))
-
-ifneq "$(DOING_BIN_DIST)" "YES"
-
-#
-# Options
-#
-ifeq "$(GhcUnregisterised)" "YES"
-SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
-endif
-
-ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
-SRC_CC_OPTS += -DTABLES_NEXT_TO_CODE
-endif
-
-SRC_CC_OPTS += -I. -I../rts -I../rts/parallel
-ifeq "$(HaveLibGmp)" "YES"
-ifneq "$(GMP_INCLUDE_DIRS)" ""
-SRC_CC_OPTS += -I$(GMP_INCLUDE_DIRS)
-endif
-else
-SRC_CC_OPTS += -I../gmp/gmpbuild
-endif
-
-ifneq "$(GhcWithSMP)" "YES"
-SRC_CC_OPTS += -DNOSMP
-endif
-
-all :: $(H_CONFIG) $(H_PLATFORM)
-
-# The fptools configure script creates the configuration header file and puts it
-# in fptools/mk/config.h. We copy it down to here (without any PACKAGE_FOO
-# definitions to avoid clashes), prepending some make variables specifying cpp
-# platform variables.
-
-ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
-
-$(H_CONFIG) :
- @echo "*** Cross-compiling: please copy $(H_CONFIG) from the target system"
- @exit 1
-
-else
-
-$(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
-
-$(H_CONFIG) : Makefile
- @echo "Creating $@..."
- @echo "#ifndef __GHCAUTOCONF_H__" >$@
- @echo "#define __GHCAUTOCONF_H__" >>$@
-# Turn '#define PACKAGE_FOO "blah"' into '/* #undef PACKAGE_FOO */'.
- @sed 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$$,\1/* #undef \2 */,' $(FPTOOLS_TOP)/mk/config.h >> $@
- @echo "#endif /* __GHCAUTOCONF_H__ */" >> $@
- @echo "Done."
-
-endif
-
-$(H_PLATFORM) : Makefile
- @echo "Creating $@..."
- @$(RM) $@
- @echo "#ifndef __GHCPLATFORM_H__" >$@
- @echo "#define __GHCPLATFORM_H__" >>$@
- @echo >> $@
- @echo "#define BuildPlatform_TYPE $(HostPlatform_CPP)" >> $@
- @echo "#define HostPlatform_TYPE $(TargetPlatform_CPP)" >> $@
- @echo >> $@
- @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
- @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
- @echo >> $@
- @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
- @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
- @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
- @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo >> $@
- @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
- @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
- @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
- @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
- @echo "#ifndef $(IRIX_MAJOR)_HOST_OS" >> $@
- @echo "#define $(IRIX_MAJOR)_HOST_OS 1" >> $@
- @echo "#endif" >> $@
-endif
- @echo >> $@
- @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
- @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
- @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
- @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
- @echo >> $@
- @echo "/* These TARGET macros are for backwards compatibily... DO NOT USE! */" >> $@
- @echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
- @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
- @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
- @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
- @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
- @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
- @echo >> $@
- @echo "#endif /* __GHCPLATFORM_H__ */" >> $@
- @echo "Done."
-
-# ---------------------------------------------------------------------------
-# Make DerivedConstants.h for the compiler
-
-all :: DerivedConstants.h
-
-ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
-
-DerivedConstants.h :
- @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
- @exit 1
-
-else
-
-mkDerivedConstants.c : $(H_CONFIG) $(H_PLATFORM)
-
-mkDerivedConstantsHdr : mkDerivedConstants.o
- $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkDerivedConstants.o
-
-DerivedConstants.h : mkDerivedConstantsHdr
- ./mkDerivedConstantsHdr >$@
-
-endif
-
-CLEAN_FILES += mkDerivedConstantsHdr$(exeext) DerivedConstants.h
-
-# -----------------------------------------------------------------------------
-#
-
-all :: GHCConstants.h
-
-ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
-
-GHCConstants.h :
- @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
- @exit 1
-
-else
-
-mkGHCConstants : mkGHCConstants.o
- $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) mkGHCConstants.o
-
-mkGHCConstants.o : mkDerivedConstants.c
- $(CC) -o $@ $(CC_OPTS) -c $< -DGEN_HASKELL
-
-GHCConstants.h : mkGHCConstants
- ./mkGHCConstants >$@
-
-endif
-
-CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h
-
-endif
-
-# ---------------------------------------------------------------------------
-# boot setup:
-#
-#
-# Install all header files
-#
-# Note: we keep per-platform copies of all the include files
-# (ditto for interface files). This is not *really* needed, but
-# it gives (perhaps) a cleaner binary dist structure..might change.
-#
-INSTALL_HEADERS += $(H_FILES) $(H_CONFIG) $(H_PLATFORM)
-
-BINDIST_EXTRAS += $(INSTALL_HEADERS)
-include $(TOP)/mk/bindist.mk
-
-#
-# `make clean' settings:
-#
-CLEAN_FILES += $(H_CONFIG) $(H_PLATFORM)
-
-#
-# Finally, slurp in the standard targets.
-#
-include $(TOP)/mk/target.mk
-
-# We need DerivedConstants.h in order to make dependencies in the RTS
-# sources, so 'make boot' here should behave like 'make all'.
-#
-# However, note that we should do this only *after* 'make boot' has
-# created .depend in here; otherwise an out-of-date .depend file can
-# prevent 'make boot' from working, requiring manual removal of
-# .depend (see #1095). This is why the following target comes *after*
-# target.mk is included above (target.mk contains "boot :: depend").
-#
-boot :: all
+dir = includes
+TOP = ../..
+include $(TOP)/mk/sub-makefile.mk
-------------------------------------------------------------------------- */
-#define FunReg ((StgFunTable *)((void *)BaseReg - FIELD_OFFSET(struct PartCapability_, r)))
+#define FunReg ((StgFunTable *)((void *)BaseReg - STG_FIELD_OFFSET(struct PartCapability_, r)))
#define stg_EAGER_BLACKHOLE_info (FunReg->stgEagerBlackholeInfo)
#define stg_gc_enter_1 (FunReg->stgGCEnter1)
/* Compute offsets of struct fields
*/
-#define FIELD_OFFSET(s_type, field) ((StgWord)&(((s_type*)0)->field))
+#define STG_FIELD_OFFSET(s_type, field) ((StgWord)&(((s_type*)0)->field))
/*
* 'Portable' inlining:
--- /dev/null
+#
+# Header files built from the configure script's findings
+#
+# XXX: these should go in includes/dist/build?
+includes_H_CONFIG = includes/ghcautoconf.h
+includes_H_PLATFORM = includes/ghcplatform.h
+
+#
+# All header files
+#
+includes_H_FILES = $(filter-out $(includes_H_CONFIG) $(includes_H_PLATFORM),$(wildcard includes/*.h))
+
+#
+# Options
+#
+ifeq "$(GhcUnregisterised)" "YES"
+includes_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
+endif
+
+ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
+includes_CC_OPTS += -DTABLES_NEXT_TO_CODE
+endif
+
+includes_CC_OPTS += -Iincludes -Irts -Irts/parallel
+ifeq "$(HaveLibGmp)" "YES"
+ifneq "$(GMP_INCLUDE_DIRS)" ""
+includes_CC_OPTS += -I$(GMP_INCLUDE_DIRS)
+endif
+else
+includes_CC_OPTS += -Igmp/gmpbuild
+endif
+
+ifneq "$(GhcWithSMP)" "YES"
+includes_CC_OPTS += -DNOSMP
+endif
+
+# The fptools configure script creates the configuration header file and puts it
+# in fptools/mk/config.h. We copy it down to here (without any PACKAGE_FOO
+# definitions to avoid clashes), prepending some make variables specifying cpp
+# platform variables.
+
+ifneq "$(BINDIST)" "YES"
+
+ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
+
+$(includes_H_CONFIG) :
+ @echo "*** Cross-compiling: please copy $(includes_H_CONFIG) from the target system"
+ @exit 1
+
+else
+
+$(includes_H_CONFIG) : mk/config.h mk/config.mk includes/ghc.mk
+ @echo "Creating $@..."
+ @echo "#ifndef __GHCAUTOCONF_H__" >$@
+ @echo "#define __GHCAUTOCONF_H__" >>$@
+# Turn '#define PACKAGE_FOO "blah"' into '/* #undef PACKAGE_FOO */'.
+ @sed 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$$,\1/* #undef \2 */,' mk/config.h >> $@
+ @echo "#endif /* __GHCAUTOCONF_H__ */" >> $@
+ @echo "Done."
+
+endif
+
+$(includes_H_PLATFORM) : Makefile
+ $(RM) $@
+ @echo "Creating $@..."
+ @echo "#ifndef __GHCPLATFORM_H__" >$@
+ @echo "#define __GHCPLATFORM_H__" >>$@
+ @echo >> $@
+ @echo "#define BuildPlatform_TYPE $(HostPlatform_CPP)" >> $@
+ @echo "#define HostPlatform_TYPE $(TargetPlatform_CPP)" >> $@
+ @echo >> $@
+ @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
+ @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
+ @echo >> $@
+ @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
+ @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
+ @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
+ @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
+ @echo >> $@
+ @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
+ @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
+ @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
+ @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
+ifeq "$(HostOS_CPP)" "irix"
+ @echo "#ifndef $(IRIX_MAJOR)_HOST_OS" >> $@
+ @echo "#define $(IRIX_MAJOR)_HOST_OS 1" >> $@
+ @echo "#endif" >> $@
+endif
+ @echo >> $@
+ @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
+ @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
+ @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
+ @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
+ @echo >> $@
+ @echo "/* These TARGET macros are for backwards compatibily... DO NOT USE! */" >> $@
+ @echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
+ @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
+ @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
+ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
+ @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
+ @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
+ @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
+ @echo >> $@
+ @echo "#endif /* __GHCPLATFORM_H__ */" >> $@
+ @echo "Done."
+
+endif
+
+# ---------------------------------------------------------------------------
+# Make DerivedConstants.h for the compiler
+
+includes_DERIVEDCONSTANTS = includes/DerivedConstants.h
+
+ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
+
+DerivedConstants.h :
+ @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
+ @exit 1
+
+else
+
+includes_dist-derivedconstants_C_SRCS = mkDerivedConstants.c
+includes_dist-derivedconstants_PROG = mkDerivedConstants$(exeext)
+
+$(eval $(call build-prog,includes,dist-derivedconstants,0))
+
+$(includes_dist-derivedconstants_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM)
+includes/dist-derivedconstants/build/mkDerivedConstants.o : $(includes_H_CONFIG) $(includes_H_PLATFORM)
+
+ifneq "$(BINDIST)" "YES"
+$(includes_DERIVEDCONSTANTS) : $(INPLACE_BIN)/mkDerivedConstants$(exeext)
+ ./$< >$@
+endif
+
+endif
+
+# -----------------------------------------------------------------------------
+#
+
+includes_GHCCONSTANTS = includes/GHCConstants.h
+
+ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)"
+
+$(includes_GHCCONSTANTS) :
+ @echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
+ @exit 1
+
+else
+
+includes_dist-ghcconstants_C_SRCS = mkDerivedConstants.c
+includes_dist-ghcconstants_PROG = mkGHCConstants$(exeext)
+includes_dist-ghcconstants_CC_OPTS = -DGEN_HASKELL
+
+$(eval $(call build-prog,includes,dist-ghcconstants,0))
+
+ifneq "$(BINDIST)" "YES"
+$(includes_dist-ghcconstants_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM)
+
+includes/dist-ghcconstants/build/mkDerivedConstants.o : $(includes_H_CONFIG) $(includes_H_PLATFORM)
+
+$(includes_GHCCONSTANTS) : $(INPLACE_BIN)/mkGHCConstants$(exeext)
+ ./$< >$@
+endif
+
+endif
+
+# ---------------------------------------------------------------------------
+# Install all header files
+
+INSTALL_HEADERS += $(includes_H_FILES) $(includes_H_CONFIG) $(includes_H_PLATFORM)
+
+$(eval $(call clean-target,includes,,\
+ $(includes_H_CONFIG) $(includes_H_PLATFORM) \
+ $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS)))
+
+$(eval $(call all-target,includes,,\
+ $(includes_H_CONFIG) $(includes_H_PLATFORM) \
+ $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS)))
+
-
-TOP=..
-DONT_WANT_STD_GHCI_LIB_RULE=YES
-DONT_WANT_STD_LIBRARY=YES
-
-include $(TOP)/mk/boilerplate.mk
-# Override haddock generation for this package
-HADDOCK_DOCS=NO
-
-# We package libffi as Haskell package for two reasons:
-
-# 1) GHC uses different names for shared and static libs, so it can
-# choose the lib variant to link with on its own. With regular
-# libtool styled shared lib names, the linker would interfer and
-# link against the shared lib variant even when GHC runs in -static
-# mode.
-# 2) The first issue isn't a problem when a shared lib of libffi would
-# be installed in system locations, but we do not assume that. So,
-# when running in -dynamic mode, we must either install libffi to
-# system locations ourselves, or we must add its location to
-# respective environment variable, (DY)LD_LIBRARY_PATH etc...before
-# we call dynamically linked binaries. Especially, the latter is
-# necessary as GHC calls binary it produced before its installation
-# phase. However, both mechanism, installing to system locations or
-# modifying (DY)LD_LIBRARY_PATH, are already in place for Haskell
-# packages so with packaging libffi as Haskell package we reuse
-# them naturally.
-
-PACKAGE=ffi
-# -----------------------------------------------------------------------------
-#
-# We use libffi's own configuration stuff.
-
-PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
-
-# 2007-09-26
-# set -o igncr
-# is not a valid command on non-Cygwin-systems.
-# Let it fail silently instead of aborting the build.
-#
-# 2007-07-05
-# We do
-# set -o igncr; export SHELLOPTS
-# here as otherwise checking the size of limbs
-# makes the build fall over on Cygwin. See the thread
-# http://www.cygwin.com/ml/cygwin/2006-12/msg00011.html
-# for more details.
-
-# 2007-07-05
-# Passing
-# as_ln_s='cp -p'
-# isn't sufficient to stop cygwin using symlinks the mingw gcc can't
-# follow, as it isn't used consistently. Instead we put an ln.bat in
-# path that always fails.
-
-LIBFFI_TARBALL := $(firstword $(wildcard libffi*.tar.gz))
-LIBFFI_DIR := $(subst .tar.gz,,$(LIBFFI_TARBALL))
-
-BINDIST_STAMPS = stamp.ffi.build stamp.ffi.configure
-
-ifeq "$(BuildSharedLibs)" "YES"
-STAMP_BUILD = stamp.ffi.build-shared
-STAMP_CONFIGURE = stamp.ffi.configure-shared
-else
-STAMP_BUILD = stamp.ffi.build
-STAMP_CONFIGURE = stamp.ffi.configure
-endif
-
-INSTALL_HEADERS += ffi.h
-STATIC_LIB = libffi.a
-INSTALL_LIBS += libHSffi.a libHSffi_p.a HSffi.o
-
-# We have to add the GHC version to the name of our dynamic libs, because
-# they will be residing in the system location along with dynamic libs from
-# other GHC installations.
-
-HS_DYN_LIB_NAME=libHSffi-ghc$(ProjectVersion)$(soext)
-
-ifeq "$(Windows)" "YES"
-DYNAMIC_PROG = $(HS_DYN_LIB_NAME).a
-DYNAMIC_LIBS = $(HS_DYN_LIB_NAME)
-else
-DYNAMIC_PROG =
-DYNAMIC_LIBS = libffi.so libffi.so.5 libffi.so.5.0.7
-endif
-
-ifeq "$(BuildSharedLibs)" "YES"
-EnableShared=yes
-else
-EnableShared=no
-endif
-
-ifeq "$(BuildSharedLibs)" "YES"
-INSTALL_LIBS += $(HS_DYN_LIB_NAME)
-ifeq "$(Windows)" "YES"
-INSTALL_PROGS += $(HS_DYN_LIB_NAME).a
-endif
-endif
-
-install all :: $(INSTALL_HEADERS) $(INSTALL_LIBS) $(INSTALL_PROGS)
-
-# We have to fake a non-working ln for configure, so that the fallback
-# option (cp -p) gets used instead. Otherwise the libffi build system
-# will use cygwin symbolic linkks which cannot be read by mingw gcc.
-# The same trick is played by the GMP build in ../gmp.
-
-$(STAMP_CONFIGURE):
- $(RM) -rf $(LIBFFI_DIR) build
- $(TAR) -zxf $(LIBFFI_TARBALL)
- mv $(LIBFFI_DIR) build
- chmod +x ln
- patch -p0 < libffi-dllize-3.0.6.patch
-
- # This patch is just the resulting delta from running automake, autoreconf, libtoolize --force --copy
- patch -p0 < libffi-autotools-update.patch
-
- (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
- PATH=`pwd`:$$PATH; \
- export PATH; \
- cd build && \
- CC=$(WhatGccIsCalled) $(SHELL) configure \
- --enable-static=yes \
- --enable-shared=$(EnableShared) \
- --host=$(PLATFORM) --build=$(PLATFORM)
-
- # libffi.so needs to be built with the correct soname.
- # NOTE: this builds libffi_convience.so with the incorrect
- # soname, but we don't need that anyway!
- $(CP) build/libtool build/libtool.orig
- sed -e s/soname_spec=.*/soname_spec="$(HS_DYN_LIB_NAME)"/ build/libtool.orig > build/libtool
-
- # We don't want libtool's cygwin hacks
- $(CP) build/libtool build/libtool.orig
- sed -e s/dlname=\'\$$tdlname\'/dlname=\'\$$dlname\'/ build/libtool.orig > build/libtool
-
- touch $@
-
-ffi.h: $(STAMP_CONFIGURE)
- $(CP) build/include/ffi.h .
-
-$(STAMP_BUILD): $(STAMP_CONFIGURE)
- $(MAKE) -C build MAKEFLAGS=
- (cd build; ./libtool --mode=install cp libffi.la $(FPTOOLS_TOP_ABS)/libffi)
- $(CP) $(STATIC_LIB) libHSffi.a
- $(CP) $(STATIC_LIB) libHSffi_p.a
- touch $@
-
-libHSffi.a libHSffi_p.a: $(STAMP_BUILD)
-
-all :: libHSffi.a libHSffi_p.a
-
-# The GHCi import lib isn't needed as compiler/ghci/Linker.lhs + rts/Linker.c
-# link the interpreted references to FFI to the compiled FFI.
-# Instead of adding libffi to the list preloaded packages (see
-# compiler/ghci/Linker.lhs:emptyPLS) we generate an empty HSffi.o
-
-HSffi.o: libHSffi.a
- touch empty.c
- $(CC) -c empty.c -o HSffi.o
-
-all :: HSffi.o
-
-ifeq "$(BuildSharedLibs)" "YES"
-ifeq "$(Windows)" "YES"
-# Windows libtool creates <soname>.dll, and as we already patched that
-# there is no need to copy from libffi.dll to libHSffi...dll.
-# However, the renaming is still required for the import library
-# libffi.dll.a.
-$(HS_DYN_LIB_NAME).a: $(STAMP_BUILD)
- $(CP) libffi.dll.a $(HS_DYN_LIB_NAME).a
-all :: $(HS_DYN_LIB_NAME).a
-
-else
-# Rename libffi.so to libHSffi...so
-$(HS_DYN_LIB_NAME): $(DYNAMIC_LIBS)
- $(CP) $(word 1,$(DYNAMIC_LIBS)) $(HS_DYN_LIB_NAME)
-
-all :: $(HS_DYN_LIB_NAME)
-endif
-endif
-
-clean distclean maintainer-clean ::
- $(RM) -f stamp.ffi.* ffi.h empty.c
- $(RM) -f libffi.a libffi.la $(DYNAMIC_PROG) $(DYNAMIC_LIBS) $(HS_DYN_LIB_NAME) $(HS_DYN_LIB_NAME).a
- $(RM) -rf build
-
-#-----------------------------------------------------------------------------
-#
-# binary-dist
-
-include $(TOP)/mk/target.mk
-
-BINDIST_EXTRAS += package.conf.in
-BINDIST_EXTRAS += $(BINDIST_STAMPS)
-BINDIST_EXTRAS += $(INSTALL_PROGS)
-BINDIST_EXTRAS += $(INSTALL_LIBS)
-BINDIST_EXTRAS += $(INSTALL_HEADERS)
-include $(TOP)/mk/bindist.mk
-
+dir = libffi
+TOP = ../..
+include $(TOP)/mk/sub-makefile.mk
--- /dev/null
+
+# We package libffi as Haskell package for two reasons:
+
+# 1) GHC uses different names for shared and static libs, so it can
+# choose the lib variant to link with on its own. With regular
+# libtool styled shared lib names, the linker would interfer and
+# link against the shared lib variant even when GHC runs in -static
+# mode.
+# 2) The first issue isn't a problem when a shared lib of libffi would
+# be installed in system locations, but we do not assume that. So,
+# when running in -dynamic mode, we must either install libffi to
+# system locations ourselves, or we must add its location to
+# respective environment variable, (DY)LD_LIBRARY_PATH etc...before
+# we call dynamically linked binaries. Especially, the latter is
+# necessary as GHC calls binary it produced before its installation
+# phase. However, both mechanism, installing to system locations or
+# modifying (DY)LD_LIBRARY_PATH, are already in place for Haskell
+# packages so with packaging libffi as Haskell package we reuse
+# them naturally.
+
+# -----------------------------------------------------------------------------
+#
+# We use libffi's own configuration stuff.
+
+PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
+
+# 2007-09-26
+# set -o igncr
+# is not a valid command on non-Cygwin-systems.
+# Let it fail silently instead of aborting the build.
+#
+# 2007-07-05
+# We do
+# set -o igncr; export SHELLOPTS
+# here as otherwise checking the size of limbs
+# makes the build fall over on Cygwin. See the thread
+# http://www.cygwin.com/ml/cygwin/2006-12/msg00011.html
+# for more details.
+
+# 2007-07-05
+# Passing
+# as_ln_s='cp -p'
+# isn't sufficient to stop cygwin using symlinks the mingw gcc can't
+# follow, as it isn't used consistently. Instead we put an ln.bat in
+# path that always fails.
+
+ifeq "$(BuildSharedLibs)" "YES"
+libffi_STAMP_BUILD = libffi/stamp.ffi.build-shared
+libffi_STAMP_CONFIGURE = libffi/stamp.ffi.configure-shared
+else
+libffi_STAMP_BUILD = libffi/stamp.ffi.build
+libffi_STAMP_CONFIGURE = libffi/stamp.ffi.configure
+endif
+
+BINDIST_STAMPS = libffi/stamp.ffi.build libfii/stamp.ffi.configure
+
+INSTALL_HEADERS += libffi/ffi.h
+libffi_STATIC_LIB = libffi/libffi.a
+INSTALL_LIBS += libffi/libHSffi.a libffi/HSffi.o
+
+# We have to add the GHC version to the name of our dynamic libs, because
+# they will be residing in the system location along with dynamic libs from
+# other GHC installations.
+
+libffi_HS_DYN_LIB_NAME=libHSffi-ghc$(ProjectVersion)$(soext)
+libffi_HS_DYN_LIB_PATH=libffi/$(libffi_HS_DYN_LIB_NAME)
+
+ifeq "$(Windows)" "YES"
+libffi_DYNAMIC_PROG = $(libffi_HS_DYN_LIB_PATH).a
+libffi_DYNAMIC_LIBS = $(libffi_HS_DYN_LIB_PATH)
+else
+libffi_DYNAMIC_PROG =
+libffi_DYNAMIC_LIBS = libffi/libffi.so libffi/libffi.so.5 libffi/libffi.so.5.0.7
+endif
+
+ifeq "$(BuildSharedLibs)" "YES"
+libffi_EnableShared=yes
+else
+libffi_EnableShared=no
+endif
+
+ifeq "$(BuildSharedLibs)" "YES"
+INSTALL_LIBS += $(libffi_HS_DYN_LIB_PATH)
+ifeq "$(Windows)" "YES"
+INSTALL_PROGS += $(libffi_HS_DYN_LIB_PATH).a
+endif
+endif
+
+# We have to fake a non-working ln for configure, so that the fallback
+# option (cp -p) gets used instead. Otherwise the libffi build system
+# will use cygwin symbolic linkks which cannot be read by mingw gcc.
+# The same trick is played by the GMP build in ../gmp.
+
+ifneq "$(BINDIST)" "YES"
+$(libffi_STAMP_CONFIGURE):
+ $(RM) -rf $(LIBFFI_DIR) libffi/build
+ cd libffi && $(TAR) -zxf tarball/libffi*.tar.gz
+ mv libffi/libffi-* libffi/build
+ chmod +x libffi/ln
+ cd libffi && $(PATCH) -p0 < libffi.dllize-3.0.6.patch
+
+ # This patch is just the resulting delta from running automake, autoreconf, libtoolize --force --copy
+ cd libffi && $(PATCH) -p0 < libffi.autotools-update.patch
+
+ cd libffi && \
+ (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
+ PATH=`pwd`:$$PATH; \
+ export PATH; \
+ cd build && \
+ CC=$(WhatGccIsCalled) $(SHELL) configure \
+ --enable-static=yes \
+ --enable-shared=$(libffi_EnableShared) \
+ --host=$(PLATFORM) --build=$(PLATFORM)
+
+ # libffi.so needs to be built with the correct soname.
+ # NOTE: this builds libffi_convience.so with the incorrect
+ # soname, but we don't need that anyway!
+ cd libffi && \
+ $(CP) build/libtool build/libtool.orig; \
+ sed -e s/soname_spec=.*/soname_spec="$(libffi_HS_DYN_LIB_NAME)"/ build/libtool.orig > build/libtool
+
+ # We don't want libtool's cygwin hacks
+ cd libffi && \
+ $(CP) build/libtool build/libtool.orig; \
+ sed -e s/dlname=\'\$$tdlname\'/dlname=\'\$$dlname\'/ build/libtool.orig > build/libtool
+
+ touch $@
+
+libffi/ffi.h: $(libffi_STAMP_CONFIGURE)
+ $(CP) libffi/build/include/ffi.h $@
+
+$(libffi_STAMP_BUILD): $(libffi_STAMP_CONFIGURE)
+ cd libffi && \
+ $(MAKE) -C build MAKEFLAGS=; \
+ (cd build; ./libtool --mode=install cp libffi.la $(TOP)/libffi)
+ $(CP) $(libffi_STATIC_LIB) libffi/libHSffi.a
+ $(CP) $(libffi_STATIC_LIB) libffi/libHSffi_p.a
+ touch $@
+
+libffi/libHSffi.a libffi/libHSffi_p.a: $(libffi_STAMP_BUILD)
+
+all_libffi : libffi/libHSffi.a libffi/libHSffi_p.a
+
+# The GHCi import lib isn't needed as compiler/ghci/Linker.lhs + rts/Linker.c
+# link the interpreted references to FFI to the compiled FFI.
+# Instead of adding libffi to the list preloaded packages (see
+# compiler/ghci/Linker.lhs:emptyPLS) we generate an empty HSffi.o
+
+libffi/HSffi.o: libffi/libHSffi.a
+ cd libffi && \
+ touch empty.c; \
+ $(CC) -c empty.c -o HSffi.o
+
+all_libffi : libffi/HSffi.o
+
+ifeq "$(BuildSharedLibs)" "YES"
+ifeq "$(Windows)" "YES"
+# Windows libtool creates <soname>.dll, and as we already patched that
+# there is no need to copy from libffi.dll to libHSffi...dll.
+# However, the renaming is still required for the import library
+# libffi.dll.a.
+$(libffi_HS_DYN_LIB_PATH).a: $(libffi_STAMP_BUILD)
+ $(CP) libffi/libffi.dll.a $(libffi_HS_DYN_LIB_PATH).a
+all_libffi : $(libffi_HS_DYN_LIB_PATH).a
+
+else
+# Rename libffi.so to libHSffi...so
+$(libffi_HS_DYN_LIB_PATH): $(libffi_DYNAMIC_LIBS)
+ $(CP) $(word 1,$(libffi_DYNAMIC_LIBS)) $(libffi_HS_DYN_LIB_PATH)
+
+all_libffi : $(libffi_HS_DYN_LIB_PATH)
+endif
+endif
+
+$(eval $(call clean-target,libffi,, \
+ libffi/build libffi/stamp.ffi.* libffi/ffi.h libffi/empty.c \
+ libffi/libffi.a libffi/libffi.la \
+ libffi/HSffi.o libffi/libHSffi.a libffi/libHSffi_p.a \
+ $(libffi_DYNAMIC_PROG) $(libffi_DYNAMIC_LIBS) \
+ $(libffi_HS_DYN_LIB_NAME) $(libffi_HS_DYN_LIB_NAME).a))
+endif
+
+#-----------------------------------------------------------------------------
+# Do the package config
+
+$(eval $(call manual-package-config,libffi))
+
+#-----------------------------------------------------------------------------
+#
+# binary-dist
+
+BINDIST_EXTRAS += libffi/package.conf.in
+
-name: PACKAGE
+name: ffi
version: 1.0
license: BSD3
maintainer: glasgow-haskell-users@haskell.org
#ifdef INSTALLING
library-dirs: LIB_DIR
#else /* !INSTALLING */
-library-dirs: FPTOOLS_TOP_ABS"/libffi"
+library-dirs: TOP"/libffi"
#endif
hs-libraries: "HSffi"
#ifdef INSTALLING
include-dirs: INCLUDE_DIR
#else /* !INSTALLING */
-include-dirs: FPTOOLS_TOP_ABS"/libffi/build/include"
+include-dirs: TOP"/libffi/build/include"
#endif
depends:
+++ /dev/null
-
-# To do a fresh build:
-#
-# make clean
-# make boot
-# make
-#
-# To rebuild a particular library <package>:
-#
-# make clean.library.<package>
-# make make.library.<package>
-#
-# or the following is equivalent:
-#
-# make remake.library.<package>
-#
-# To add a new library to the tree, do
-#
-# darcs get http://darcs.haskell.org/packages/foo
-# [ -f foo/configure.ac ] && ( cd foo && autoreconf )
-# make make.library.foo
-
-.PHONY: default_target
-
-default_target: all
-
-# make doesn't give us an easy way to get the libraries built in
-# dependency order the first time, but not rebuild base (for example)
-# when we want to rebuild another library later.
-# So for now we just don't do anything in parallel in here.
-.NOTPARALLEL:
-
-# 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=..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/cabal-flags.mk
-
-ifeq "$(stage)" ""
-stage := 1
-endif
-
-DO_STAGE_1_LIBS := NO
-DO_STAGE_2_LIBS := NO
-ifeq "$(stage)" "1"
-DO_STAGE_1_LIBS := YES
-endif
-ifeq "$(stage)" "2"
-DO_STAGE_2_LIBS := YES
-endif
-ifneq "$(filter install clean maintainer-clean distclean binary-dist,$(MAKECMDGOALS))" ""
-DO_STAGE_1_LIBS := YES
-DO_STAGE_2_LIBS := YES
-endif
-
-# Any libraries listed here should also be in ../packages
-
-SUBDIRS :=
-
-ifeq "$(DO_STAGE_1_LIBS)" "YES"
-SUBDIRS += ghc-prim $(INTEGER_LIBRARY) base syb base3-compat array packedstring
-SUBDIRS += containers bytestring old-locale old-time filepath
-ifeq "$(GhcLibsWithUnix)" "YES"
-SUBDIRS += unix
-endif
-ifeq "$(Windows)" "YES"
-SUBDIRS += $(wildcard Win32)
-endif
-SUBDIRS += directory process pretty hpc template-haskell editline Cabal random haskell98
-
-# Set GhcBootLibs=YES from the command line to work with just the libraries
-# needed to bootstrap GHC.
-ifneq "$(GhcBootLibs)" "YES"
-SUBDIRS += $(wildcard regex-base)
-SUBDIRS += $(wildcard regex-posix)
-SUBDIRS += $(wildcard regex-compat)
-SUBDIRS += $(wildcard parsec)
-SUBDIRS += $(wildcard haskell-src)
-SUBDIRS += $(wildcard html)
-SUBDIRS += $(wildcard network)
-SUBDIRS += $(wildcard QuickCheck)
-SUBDIRS += $(wildcard HUnit)
-SUBDIRS += $(wildcard mtl)
-SUBDIRS += $(wildcard time)
-SUBDIRS += $(wildcard stm)
-SUBDIRS += $(wildcard xhtml)
-SUBDIRS += $(wildcard parallel)
-endif
-endif
-
-DPH_SUBDIRS :=
-ifneq "$(GhcBootLibs)" "YES"
-ifneq "$(wildcard dph)" ""
-DPH_SUBDIRS += dph/dph-base
-DPH_SUBDIRS += dph/dph-prim-interface
-DPH_SUBDIRS += dph/dph-prim-seq
-DPH_SUBDIRS += dph/dph-prim-par
-DPH_SUBDIRS += dph/dph-seq
-DPH_SUBDIRS += dph/dph-par
-endif
-endif
-
-# We have a separate variable for cleaning as this happens in stage=1 and
-# we want to clean the dph subdirectories, too.
-ifeq "$(DO_STAGE_2_LIBS)" "YES"
-SUBDIRS += $(DPH_SUBDIRS)
-CLEAN_SUBDIRS = $(SUBDIRS)
-else
-CLEAN_SUBDIRS = $(SUBDIRS) $(DPH_SUBDIRS)
-endif
-
-# -----------------------------------------------------------------------------
-
-empty=
-space=$(empty) $(empty)
-
-# -----------------------------------------------------------------------------
-
-ifeq "$(ghc_ge_609)" "YES"
-GhcLibHcOpts += -fno-warn-deprecated-flags
-endif
-
-IFBUILDABLE=ifBuildable/ifBuildable $(FPTOOLS_TOP_ABS)/packages
-
-ifneq "$(DOING_BIN_DIST)" "YES"
-
-CONFIGURE_OPTS =
-CONFIGURE_STAMP_EXTRAS :=
-
-ifneq "$(findstring $(space)p$(space), $(space)$(GhcLibWays)$(space))" ""
-CONFIGURE_OPTS += --enable-library-profiling
-CONFIGURE_STAMP_EXTRAS := $(CONFIGURE_STAMP_EXTRAS)-profiling
-endif
-
-ifeq "$(BuildSharedLibs)" "YES"
-CONFIGURE_OPTS += --enable-shared
-CONFIGURE_STAMP_EXTRAS := $(CONFIGURE_STAMP_EXTRAS)-shared
-endif
-
-ifeq "$(SplitObjs)" "YES"
-CONFIGURE_OPTS += --enable-split-objs
-CONFIGURE_STAMP_EXTRAS := $(CONFIGURE_STAMP_EXTRAS)-splitting
-endif
-
-.PHONY: subdirs
-
-subdirs:
- @echo $(SUBDIRS)
-
-HERE_ABS=$(FPTOOLS_TOP_ABS)/libraries
-
-CABAL_GHC_FLAGS = -Wall
-
-BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=$(CABAL_VERSION) -odir $(HERE_ABS)/bootstrapping -hidir $(HERE_ABS)/bootstrapping -i$(HERE_ABS)/Cabal -i$(HERE_ABS)/filepath -i$(HERE_ABS)/hpc
-
-.PHONY: boot
-
-boot: ifBuildable/ifBuildable cabal-bin bootstrapping.conf
-
-cabal-bin: cabal-bin.hs
- -mkdir bootstrapping
- $(GHC) $(BOOTSTRAPPING_FLAGS) --make cabal-bin -o cabal-bin
-
-bootstrapping.conf: cabal-bin
- echo "[]" > $@.tmp
- -cd extensible-exceptions && $(CABAL) clean --distpref=dist-bootstrapping
- cd extensible-exceptions && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
- cd extensible-exceptions && $(CABAL) build --distpref=dist-bootstrapping
- cd extensible-exceptions && $(CABAL) install --distpref=dist-bootstrapping --inplace
- -cd filepath && $(CABAL) clean --distpref=dist-bootstrapping
- cd filepath && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
- cd filepath && $(CABAL) build --distpref=dist-bootstrapping
- cd filepath && $(CABAL) install --distpref=dist-bootstrapping --inplace
- -cd Cabal && $(CABAL) clean --distpref=dist-bootstrapping
- cd Cabal && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
- cd Cabal && $(CABAL) build --distpref=dist-bootstrapping
- cd Cabal && $(CABAL) install --distpref=dist-bootstrapping --inplace
- -cd hpc && $(CABAL) clean --distpref=dist-bootstrapping
- cd hpc && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
- cd hpc && $(CABAL) build --distpref=dist-bootstrapping
- cd hpc && $(CABAL) install --distpref=dist-bootstrapping --inplace
- mv $@.tmp $@
-
-ifBuildable/ifBuildable: ifBuildable.hs
- -$(RM) -rf ifBuildable
- mkdir ifBuildable
- $(CP) ifBuildable.hs ifBuildable/
-ifeq "$(stage)" "2"
- cd ifBuildable && ../$(HC) -Wall --make ifBuildable -o ifBuildable
-else
- cd ifBuildable && $(GHC) -Wall --make ifBuildable -o ifBuildable
-endif
-
-.PHONY: all build configure
-
-all: build
-
-.PHONY: rebuild.library.%
-.PHONY: remake.library.%
-
-$(foreach SUBDIR,$(SUBDIRS),rebuild.library.$(SUBDIR)):\
-rebuild.library.%: clean.library.% build.library.%
-
-$(foreach SUBDIR,$(SUBDIRS),remake.library.$(SUBDIR)):\
-remake.library.%: clean.library.% make.library.%
-
-# The meta package dph is a special case
-ifeq "$(stage)" "1"
-remake.library.dph:
- @echo "*** Package dph needs to be made in stage=2"
-endif
-ifeq "$(stage)" "2"
-# NB. we're depending on make chasing dependencies from left to right here.
-# This bit goes wrong with 'make -j'.
-remake.library.dph: remake.library.dph/dph-base \
- remake.library.dph/dph-prim-interface \
- remake.library.dph/dph-prim-seq \
- remake.library.dph/dph-prim-par \
- remake.library.dph/dph-seq \
- remake.library.dph/dph-par
-endif
-
-# NB. we're depending on make chasing dependencies from left to right here.
-# This bit goes wrong with 'make -j'.
-build: $(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR))
-
-configure: $(foreach SUBDIR,$(SUBDIRS), \
- stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).$(SUBDIR))
-
-.PHONY: build.library.%
-.PHONY: make.library.%
-
-# We should depend on %/%.cabal here (and in other rules), but make
-# makes that difficult.
-
-ALL_CONFIGURE_FLAGS = \
- $(INSTALL_DIRS_CONFIGURE_FLAGS) \
- $(USE_STAGE$(stage)_CONFIGURE_FLAGS) \
- $(COMMON_CONFIGURE_FLAGS) \
- --haddock-options="--use-contents=../index.html \
- --use-index=../doc-index.html" \
- $(CONFIGURE_OPTS)
-
-stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).dph/dph-par: \
- dph/dph-par
-
-stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).dph/dph-seq: \
- dph/dph-seq
-
-dph/%:
- $(MAKE) -C dph $*
-
-$(foreach SUBDIR,$(SUBDIRS), \
- stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).$(SUBDIR)): \
-stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: cabal-bin
- -$(RM) -f stamp/configure.library.*.$* $*/unbuildable
- $(MKDIRHIER) `dirname $@`
- ( cd $* && $(CABAL) configure $(ALL_CONFIGURE_FLAGS) ) \
- && touch $@ || touch $*/unbuildable
-# We don't touch $@ if configure failed as we would prefer to try
-# configuring it next time round, rather than assuming it'll still fail.
-# This is particularly important for bootlibs, where failure means the
-# build dies!
-
-# Build the library using 'make'
-# We re-run 'setup makefile' each time, just in case any preprocessing
-# needs to be done. However, we're careful not to overwrite GNUmakefile
-# if it hasn't changed, so that dependency-generation isn't forced
-# every time.
-$(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR)):\
-make.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
- cabal-bin ifBuildable/ifBuildable
- if $(IFBUILDABLE) $*; then \
- cd $* && \
- cmp -s $(MAKEFILE_LOCAL) Makefile.local || cp $(MAKEFILE_LOCAL) .; \
- mv GNUmakefile GNUmakefile.tmp; \
- $(CABAL) makefile -f GNUmakefile; \
- cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \
- $(MAKE) $(MFLAGS) && \
- $(CABAL) register --inplace; \
- fi
-
-# Special case for meta package dph: we can only remake it as we don't have
-# any dependency info between the sub-packages
-make.library.dph:
- @echo "*** Please use the target 'remake.library.dph' instead"
-
-MAKEFILE_LOCAL = $(FPTOOLS_TOP_ABS)/libraries/Makefile.local
-
-# Build the library using 'setup build' (not the default)
-$(foreach SUBDIR,$(SUBDIRS),build.library.$(SUBDIR)):\
-build.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
- cabal-bin ifBuildable/ifBuildable
- if $(IFBUILDABLE) $*; then \
- cd $* && \
- $(CABAL) build $(BUILD_FLAGS); \
- $(CABAL) register --inplace; \
- fi
-
-.PHONY: doc html
-
-html: doc
-
-# No docs for compat libraries for now.
-DOC_SUBDIRS = $(filter-out %-compat, $(SUBDIRS))
-
-doc: $(foreach SUBDIR,$(DOC_SUBDIRS),doc.library.$(SUBDIR))
- sh gen_contents_index --inplace
-
-# Making hyperlinked source only works if we have hscolour
-ifeq "$(HSCOLOUR_SRCS)" "YES"
-CABAL_HADDOCK_FLAGS += --hyperlink-source
-endif
-CABAL_HADDOCK_FLAGS += --with-haddock=$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace/bin/haddock
-
-$(foreach SUBDIR,$(DOC_SUBDIRS),doc.library.$(SUBDIR)):\
-doc.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
- cabal-bin ifBuildable/ifBuildable
- if $(IFBUILDABLE) $*; then \
- cd $* && $(CABAL) haddock --html-location='../$$pkg' \
- $(CABAL_HADDOCK_FLAGS); \
- fi
-ifneq "$(HSCOLOUR)" ""
-# We use */src rather than $*/src due to the $(INTEGER_LIBRARY)/integer
-# mismatch
-# XXX We also need to check that the directory exists, as e.g. dph disables
-# haddock, so the directory doesn't get made. We should remove this once
-# we can always haddock everything.
- if $(IFBUILDABLE) $* && [ -d $*/dist/doc/html/*/src/ ]; then cp hscolour.css $*/dist/doc/html/*/src/; fi
-endif
-
-.PHONY: maintainer-clean distclean clean clean.library.%
-
-maintainer-clean: clean
-distclean: clean
-
-ifeq "$(DPH_SUBDIRS)" ""
-clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR))
-else
-clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR)) clean.library.dph
-endif
- -cd extensible-exceptions && $(CABAL) clean --distpref=dist-bootstrapping
- -cd filepath && $(CABAL) clean --distpref=dist-bootstrapping
- -cd Cabal && $(CABAL) clean --distpref=dist-bootstrapping
- -cd hpc && $(CABAL) clean --distpref=dist-bootstrapping
- $(RM) -rf bootstrapping
- $(RM) -f bootstrapping.conf bootstrapping.conf.old
- $(RM) -f bootstrapping.conf.tmp bootstrapping.conf.tmp.old
- $(RM) -f cabal-bin cabal-bin.exe
- $(RM) -rf ifBuildable
- $(RM) -f libraries.txt index.html doc-index.html doc-index*.html
- $(RM) -f haddock* *.gif
- $(RM) -rf stamp/*
-
-maintainer-clean distclean:
- $(RM) $(foreach lib, $(SUBDIRS), $(lib)/.depend $(lib)/.depend.bak)
-
-$(foreach SUBDIR,$(CLEAN_SUBDIRS),clean.library.$(SUBDIR)): \
-clean.library.%:
- $(RM) -f stamp/configure.library.*.$* $*/unbuildable
- -cd $* && $(CABAL) clean
- $(RM) -f $*/Setup $*/Setup.exe $*/Setup.hi $*/Setup.o
- $(RM) $*/GNUmakefile $*/Makefile.local
-endif
-
-# Extra target to clean all the sub-packages of dph
-clean.library.dph: clean.library.dph/dph-prim-par \
- clean.library.dph/dph-prim-seq \
- clean.library.dph/dph-prim-interface \
- clean.library.dph/dph-base
- $(MAKE) -C dph clean
-
-# -----------------------------------------------------------------------------
-
-.PHONY: install install-docs install.library.%
-
-install: $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR))
-ifeq "$(HADDOCK_DOCS)" "YES"
- $(INSTALL_DIR) $(DESTDIR)$(html_installed_root)
- $(INSTALL_DATA) index.html doc-index*.html $(DESTDIR)$(html_installed_root)
- $(INSTALL_SCRIPT) gen_contents_index $(DESTDIR)$(html_installed_root)
- $(INSTALL_DATA) prologue.txt $(DESTDIR)$(html_installed_root)
- # Hacks:
- $(INSTALL_DATA) base/dist/doc/html/*/*.css $(DESTDIR)$(html_installed_root)
- $(INSTALL_DATA) base/dist/doc/html/*/*.js $(DESTDIR)$(html_installed_root)
- $(INSTALL_DATA) base/dist/doc/html/*/*.gif $(DESTDIR)$(html_installed_root)
-endif
-
-# Cabal doesn't let us ask to install docs only, so do nothing here
-install-docs:
- @:
-
-# Ideally this would depend on a stamp/build.library.%, but if it does
-# then we can't change the libraries and then just rerun make.
-# Thus if you install without building then it will just break.
-
-# prefix and (on Windows) htmldir use $topdir when configuring, so we
-# need to tell installPackage the real path to use when installing.
-
-# We also need to pass all the other directories in, as they can be
-# overridden when installing a bindist.
-
-$(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \
-install.library.%: ifBuildable/ifBuildable
- if $(IFBUILDABLE) $*; then \
- cd $* && \
- $(INSTALL_PACKAGE) install '$(GHC_PKG_INSTALL_PROG)' '$(DESTDIR)$(datadir)/package.conf' '$(DESTDIR)' '$(prefix)' '$(iprefix)' '$(ibindir)' '$(ilibdir)' '$(ilibexecdir)' '$(idynlibdir)' '$(idatadir)' '$(idocdir)' '$(ihtmldir)' '$(ihaddockdir)' ; \
- fi
-
-.PHONY: binary-dist binary-dist.library.%
-
-BIN_DIST_LIBDIR=$(BIN_DIST_DIR)/libraries
-
-binary-dist: $(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR))
-ifeq "$(WHERE_AM_I)" ""
- echo "I don't know where I am" >&2
- exit 1
-endif
- echo $(WHERE_AM_I)/Makefile >> $(BIN_DIST_LIST)
-# XXX This needs to be changed: This ifBuildable is built with the
-# bootstrapping compiler, so isn't OS X friendly. It should be made into
-# a Cabal package if we keep it. However, once we drop extralibs we can
-# probably remove it anyway.
- echo $(WHERE_AM_I)/ifBuildable/ifBuildable >> $(BIN_DIST_LIST)
- for FILE in dph/dph-prim-interface/interface/*.h dph/dph/LICENSE; do if [ -f $$FILE ]; then echo $(WHERE_AM_I)/$$FILE >> $(BIN_DIST_LIST); fi; done
-ifeq "$(HADDOCK_DOCS)" "YES"
- for FILE in gen_contents_index prologue.txt index.html doc-index*.html; do echo $(WHERE_AM_I)/$$FILE >> $(BIN_DIST_LIST); done
-endif
-
-$(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR)): \
-binary-dist.library.%:
- if $(IFBUILDABLE) $*; then \
- $(MAKE) -C $* -f Makefile.local binary-dist BINDIST_EXTRAS="$*.cabal LICENSE $*.buildinfo unbuildable" WHERE_AM_I=$(WHERE_AM_I)/$*; \
- fi
-
-# Ignore some doc targets that we don't support
-# The root recurses into us when these targets are made
-.PHONY: html-no-chunks chm HxS fo dvi ps pdf
-html-no-chunks chm HxS fo dvi ps pdf:
- @:
-
+++ /dev/null
-
-LIB_DIST_DIR = dist
-EXE_DIST_DIR = dist-install
-
-# XXX This is a bit of a mess. Really we should be just asking Cabal
-# what it would install and putting those files in the bindist.
-binary-dist:
-ifeq "$(WHERE_AM_I)" ""
- echo "I don't know where I am" >&2
- exit 1
-endif
- # General bits
- -$(FIND) . -name Makefile -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) . -name LICENSE -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- # Libraries
- -$(FIND) $(LIB_DIST_DIR)/setup-config -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(LIB_DIST_DIR)/installed-pkg-config -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(LIB_DIST_DIR)/build -name "HS*.o" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(LIB_DIST_DIR)/build -name "HS*.p_o" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(LIB_DIST_DIR)/build -name "*.a" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(LIB_DIST_DIR)/build -name "*.p_a" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(LIB_DIST_DIR)/build -name "*.hi" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(LIB_DIST_DIR)/build -name "*.p_hi" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) include -name "*.h" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- # Executables
- -$(FIND) . -name "*.wrapper" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- -$(FIND) $(EXE_DIST_DIR)/setup-config -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- # We want the executable files, which in theory would be -perm /a+x
- # ("any execute bit is set") but that doesn't work on some solaris
- # and OS X machines, so we use -perm -100 instead ("the user execute
- # bit is set"). In practice, this is extremely unlikely not to be the
- # same set of files.
- -$(FIND) $(EXE_DIST_DIR) -type f -perm -100 -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- # Docs
- # This gives us both docbook docs, and haddock docs
- $(FIND) . -name "*.haddock" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- $(FIND) . -name "*.html" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- $(FIND) . -name "*.css" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- $(FIND) . -name "*.gif" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- $(FIND) . -name "*.js" -exec echo $(WHERE_AM_I)/{} \; >> $(BIN_DIST_LIST) 2> /dev/null
- # And anything else
-ifneq "$(strip $(BINDIST_EXTRAS))" ""
- for FILE in $(BINDIST_EXTRAS); do if [ -f $$FILE ]; then echo $(WHERE_AM_I)/$$FILE >> $(BIN_DIST_LIST); fi; done
-endif
-
+++ /dev/null
-#################################################################################
-#
-# mk/boilerplate.mk
-#
-# The Glorious GHC Boilerplate Makefile
-#
-# This one file should be included (directly or indirectly) by all Makefiles
-# in the GHC hierarchy.
-#
-#################################################################################
-
-# We want to disable all the built-in rules that make uses; having them
-# just slows things down, and we write all the rules ourselves.
-# Setting .SUFFIXES to empty disables them all.
-MAKEFLAGS += --no-builtin-rules
-
-# $(FPTOOLS_TOP) is the old name for $(TOP), kept for backwards compat
-FPTOOLS_TOP := $(TOP)
-
-
-# This rule makes sure that "all" is the default target, regardless of where it appears
-# THIS RULE MUST REMAIN FIRST!
-default: all
-
-#------------------------------------------------------------
-# Makefile debugging
-# to see the effective value used for a Makefile variable, do
-# make show VALUE=MY_VALUE
-#
-
-show:
- @echo '$(VALUE)="$($(VALUE))"'
-
-# -----------------------------------------------------------------------------
-# Misc bits
-
-# If $(way) is set then we define $(way_) and $(_way) from it in the
-# obvious fashion. This must be done before suffix.mk is included,
-# because the pattern rules in that file depend on these variables.
-
-ifneq "$(way)" ""
- way_ := $(way)_
- _way := _$(way)
-endif
-
-
-# When using $(patsubst ...) and friends, you can't use a literal comma
-# freely - so we use ${comma} instead. (See PACKAGE_CPP_OPTS in package.mk
-# for an example usage.)
-comma=,
-
-# -----------------------------------------------------------------------------
-# Now follow the pieces of boilerplate
-# The "-" signs tell make not to complain if they don't exist
-
-include $(TOP)/mk/config.mk
-# All configuration information
-# (generated by "configure" from config.mk.in)
-#
-
-
-include $(TOP)/mk/paths.mk
-# Variables that say where things belong (e.g install directories)
-# and where we are right now
-# Also defines variables for standard files (SRCS, LIBS etc)
-
-
-include $(TOP)/mk/opts.mk
-# Variables that control the option flags for all the
-# language processors
-
-ifeq "$(BootingFromHc)" "YES"
-include $(TOP)/mk/bootstrap.mk
-endif
-
-# (Optional) build-specific configuration
-include $(TOP)/mk/custom-settings.mk
-
-ifndef FAST
--include .depend
-endif
-# The dependencies file from the current directory
# Which warnings we like to use
MyWarningOpts = -W -fno-warn-unused-matches -fwarn-unused-imports
+GhcLibWays = v
+
# -------- 1. A Performance/Distribution build--------------------------------
ifeq "$(BuildFlavour)" "perf"
GhcStage2HcOpts = -O2 -fasm
GhcHcOpts = -Rghc-timing
GhcLibHcOpts = -O2 -XGenerics
-GhcLibWays = p
+GhcLibWays += p
endif
GhcStage1HcOpts = -O -fasm
GhcStage2HcOpts = -O0 -fasm
GhcLibHcOpts = -O0 -fasm
-GhcLibWays =
SplitObjs = NO
endif
GhcStage1HcOpts = -O -fasm
GhcStage2HcOpts = -O0 -fasm
GhcLibHcOpts = -O -fasm
-GhcLibWays =
SplitObjs = NO
endif
SRC_HC_OPTS = -H64m -O -fasm $(MyWarningOpts)
GhcLibHcOpts = -O -dcore-lint $(MyWarningOpts)
-GhcLibWays =
GhcStage1HcOpts = -Rghc-timing -O0 -DDEBUG
GhcStage2HcOpts = -Rghc-timing -O -fasm
SplitObjs = NO
SRC_HC_OPTS = -H64m -O -fasm $(MyWarningOpts)
GhcLibHcOpts = -O -dcore-lint $(MyWarningOpts)
-GhcLibWays =
GhcStage1HcOpts = -Rghc-timing -O -fasm
GhcStage2HcOpts = -Rghc-timing -O0 -DDEBUG
SplitObjs = NO
+++ /dev/null
-
-nothing=
-space=$(nothing) $(nothing)
-comma=,
-
-GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-install/build/ghc-pkg/ghc-pkg
-
-LIBRARIES_ABS = $(FPTOOLS_TOP_ABS)/libraries
-UTILS_ABS = $(FPTOOLS_TOP_ABS)/utils
-CABAL = $(LIBRARIES_ABS)/cabal-bin $(GHC) $(LIBRARIES_ABS)/bootstrapping.conf $(CABAL_DOTTED_VERSION)
-INSTALL_PACKAGE = \
- $(UTILS_ABS)/installPackage/install-inplace/bin/installPackage
-STAGE3_PACKAGE_CONF = $(FPTOOLS_TOP_ABS)/stage3.package.conf
-
-# Euch, hideous hack:
-CABAL_DOTTED_VERSION = $(shell grep "^Version:" $(LIBRARIES_ABS)/Cabal/Cabal.cabal | sed "s/^Version: //")
-CABAL_VERSION = $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
-CABAL_CONSTRAINT = --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
-
-# We rely on all the CONFIGURE_ARGS being quoted with '...', and there
-# being no 's inside the values.
-FLAGGED_CONFIGURE_ARGS = $(subst $(space)',\
- $(space)--configure-option=',\
- $(space)$(CONFIGURE_ARGS))
-
-COMMON_CONFIGURE_FLAGS = \
- --libsubdir='$$pkgid' \
- --with-gcc=$(WhatGccIsCalled) \
- --with-ld=$(LD) \
- $(addprefix --hsc2hs-option=,$(SRC_HSC2HS_OPTS))
-
-ifeq "$(HSCOLOUR_SRCS)" "YES"
-CONFIGURE_OPTS += --with-hscolour="$(HSCOLOUR)"
-endif
-
-ifneq "$(ALEX)" ""
-COMMON_CONFIGURE_FLAGS += --with-alex="$(ALEX)"
-endif
-
-ifneq "$(HAPPY)" ""
-COMMON_CONFIGURE_FLAGS += --with-happy="$(HAPPY)"
-endif
-
-COMMON_CONFIGURE_FLAGS += $(FLAGGED_CONFIGURE_ARGS) \
- --configure-option=--with-cc="$(CC)"
-
-COMMON_CONFIGURE_FLAGS += $(shell [ -f $(HSC2HS_INPLACE) ] && \
- echo --with-hsc2hs=$(HSC2HS_INPLACE) )
-
-ifeq "$(Windows)" "YES"
-NONEXISTENT=c:/NONEXISTENT
-else
-NONEXISTENT=/NONEXISTENT
-endif
-
-# We put non-existant paths in when configuring things that we plan to
-# install, as we require that builds don't depend on these paths when
-# making bindists.
-INSTALL_DIRS_CONFIGURE_FLAGS = \
- --prefix=$(NONEXISTENT) \
- --bindir=$(NONEXISTENT) \
- --libdir=$(NONEXISTENT) \
- --libexecdir=$(NONEXISTENT) \
- --datadir=$(NONEXISTENT) \
- --docdir=$(NONEXISTENT) \
- --haddockdir=$(NONEXISTENT) \
- --htmldir=$(NONEXISTENT)
-
-INPLACE_GHC_DATADIR_CONFIGURE_FLAGS = \
- --datadir=$(FPTOOLS_TOP_ABS)/inplace-datadir \
- --datasubdir=.
-
-INPLACE_DIRS_CONFIGURE_FLAGS = \
- --prefix=`$(FPTOOLS_TOP_ABS)/utils/pwd/pwd forwardslash`/install-inplace
-
-USE_BOOT_CONFIGURE_FLAGS = \
- --with-compiler=$(GHC) \
- --with-hc-pkg=$(GHC_PKG) \
- --package-db $(FPTOOLS_TOP_ABS)/libraries/bootstrapping.conf
-
-USE_STAGE_CONFIGURE_FLAGS = \
- --with-hc-pkg=$(GHC_PKG_INPLACE) \
- $(addprefix --cc-option=,$(MACOSX_DEPLOYMENT_CC_OPTS)) \
- $(addprefix --ld-option=,$(MACOSX_DEPLOYMENT_LD_OPTS))
-
-USE_STAGE1_CONFIGURE_FLAGS = \
- --with-compiler=$(GHC_STAGE1) \
- $(USE_STAGE_CONFIGURE_FLAGS)
-
-USE_STAGE2_CONFIGURE_FLAGS = \
- --with-compiler=$(GHC_STAGE2) \
- $(USE_STAGE_CONFIGURE_FLAGS)
-
-BUILD_FLAGS = $(addprefix --ghc-option=,$(SRC_HC_OPTS))
-
-
-# We now define various i* variables, which are used for the paths
-# when installing Cabal libraries
-ifeq "$(RelocatableBuild)" "YES"
-# On Windows we want to make moveable bindists, but we need to tell
-# ghc-pkg where the haddock docs are. Therefore we completely ignore
-# where the user tells us to put the haddock documentation and put it
-# somewhere whose relative location we know. When installing we need
-# to give Cabal a real path, though.
-iprefix = $$topdir
-ibindir = $$topdir
-ilibdir = $$topdir
-ilibexecdir = $$topdir
-idynlibdir = $$topdir
-idatadir = $$topdir
-idocdir = $$topdir/doc/libraries/$$pkg
-ihaddockdir = $$topdir/doc/libraries/$$pkg
-ihtmldir = $$httptopdir/doc/libraries/$$pkg
-html_installed_root = $(prefix)/doc/libraries
-else
-# On non-Windows we can just give absolute paths all the time, and
-# thus obey the htmldir that we are given.
-iprefix = $(prefix)
-ibindir = $(bindir)
-ilibdir = $(libdir)
-ilibexecdir = $(libexecdir)
-idynlibdir = $(dynlibdir)
-idatadir = $(datadir)
-idocdir = $(docdir)/libraries/$$pkg
-ihaddockdir = $(htmldir)/libraries/$$pkg
-ihtmldir = $(htmldir)/libraries/$$pkg
-html_installed_root = $(htmldir)/libraries
-endif
-
+++ /dev/null
-
-include $(TOP)/mk/cabal-flags.mk
-include $(TOP)/mk/bindist.mk
-
-SRC_HC_OPTS += -Wall
-
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-INSTALL_FLAGS =
-else
-ifeq "$(ENABLE_SHELL_WRAPPERS)" "YES"
-INSTALL_FLAGS = --enable-shell-wrappers
-else
-INSTALL_FLAGS =
-endif
-endif
-
-# Tell stage2 to make a dynamically-linked binary, but no wrapper. We assume
-# that in an installation the shared libs will be installed somewhere that
-# the system can find them.
-ifeq "$(BuildSharedLibs)" "YES"
-DYN_FLAGS = --ghc-option=-dynamic --ghc-option=-dynload --ghc-option=deploy
-endif
-
-.PHONY: default all with-bootstrapping-compiler with-stage-2 clean distclean
-
-default all: with-bootstrapping-compiler
-
-with-bootstrapping-compiler:
- $(CABAL) configure --distpref dist-inplace \
- $(INPLACE_DIRS_CONFIGURE_FLAGS) \
- $(USE_BOOT_CONFIGURE_FLAGS) \
- $(COMMON_CONFIGURE_FLAGS) \
- $(EXTRA_INPLACE_CONFIGURE_FLAGS)
- $(CABAL) build --distpref dist-inplace $(BUILD_FLAGS)
- $(CABAL) install --distpref dist-inplace $(INSTALL_FLAGS)
-
-with-stage-2:
- $(CABAL) configure --distpref dist-install \
- $(INSTALL_DIRS_CONFIGURE_FLAGS) \
- $(USE_STAGE2_CONFIGURE_FLAGS) \
- $(COMMON_CONFIGURE_FLAGS) \
- $(EXTRA_STAGE2_CONFIGURE_FLAGS)
- $(CABAL) build --distpref dist-install $(DYN_FLAGS) $(BUILD_FLAGS)
-
-install:
- $(INSTALL_PACKAGE) install \
- '$(GHC_PKG_INSTALL_PROG)' \
- '$(DESTDIR)$(datadir)/package.conf' \
- '$(DESTDIR)' '$(prefix)' \
- '$(prefix)' '$(bindir)' '$(libdir)' \
- '$(libexecdir)' '$(dynlibdir)' '$(datadir)' \
- '$(docdir)' '$(htmldir)' '$(haddockdir)' \
- --distpref dist-install \
- $(INSTALL_FLAGS)
-
-clean:
- -$(CABAL) clean --distpref dist-inplace
- -$(CABAL) clean --distpref dist-install
- $(RM) -rf install-inplace
-ifneq "$(EXTRA_CLEAN)" ""
- $(RM) -f $(EXTRA_CLEAN)
-endif
-
-distclean: clean
-ifneq "$(EXTRA_DISTCLEAN)" ""
- $(RM) -f $(EXTRA_DISTCLEAN)
-endif
-
endif
endif
-################################################################################
-#
-# GHC Version
-#
-
-# ProjectVersion is treated as a *string*
-# ProjectVersionInt is treated as an *integer* (for cpp defines)
-
-# Versioning scheme: A.B.C
-# A: major version, decimal, any number of digits
-# B: minor version, decimal, any number of digits
-# C: patchlevel, one digit, omitted if zero.
-#
-# ProjectVersionInt does *not* contain the patchlevel (rationale: this
-# figure is used for conditional compilations, and library interfaces
-# etc. are not supposed to change between patchlevels).
-#
-# The ProjectVersionInt is included in interface files, and GHC
-# checks that it's reading interface generated by the same ProjectVersion
-# as itself. It does this even though interface file syntax may not
-# change between versions. Rationale: calling conventions or other
-# random .o-file stuff might change even if the .hi syntax doesn't
-
-ProjectName = @ProjectName@
-ProjectTags =
-ProjectVersion = @ProjectVersion@$(ProjectTags)
-ProjectVersionInt = @ProjectVersionInt@
-ProjectPatchLevel = @ProjectPatchLevel@
-
-################################################################################
-#
-# Platform variables
-#
-################################################################################
+# TOP: the top of the fptools hierarchy, absolute path.
+# On Windows this is a c:/foo/bar style path.
+TOP = @hardtop@
-# A "platform" is the GNU cpu-type/manufacturer/operating-system target machine
-# specifier. E.g. sparc-sun-solaris2
-#
-# Build platform: the platform on which we are doing this build
-# Host platform: the platform on which these binaries will run
-# Target platform: the platform for which this compiler will generate code
-#
-# We don't support build & host being different, because the build
-# process creates binaries that are run during the build, and also
-# installed.
-#
-# If host & target are different, then we are building a compiler
-# which will generate intermediate .hc files to port to the target
-# architecture for bootstrapping. The libraries and stage 2 compiler
-# will be built as HC files for the target system, and likely won't
-# build on this host platform.
-#
-# An important invariant is that for any piece of source code, the
-# platform on which the code is going to run is the HOST platform,
-# and the platform on which we are building is the BUILD platform.
-# Additionally for the compiler, the platform this compiler will
-# generate code for is the TARGET. TARGET is not meaningful outside
-# the compiler sources.
-#
-# Guidelines for when to use HOST vs. TARGET:
-#
-# - In the build system (Makefile, foo.mk), normally we should test
-# $(HOSTPLATFORM). There are some cases (eg. installation), where
-# we expect $(HOSTPLATFORM)==$(TARGETPLATFORM), so in those cases it
-# doesn't matter which is used.
-#
-# - In the compiler itself, we should test HOST or TARGET depending
-# on whether the conditional relates to the code being generated, or
-# the platform on which the compiler is running. See the section
-# on "Coding Style" in the commentary for more details.
-#
-# - In all other code, we should be testing HOST only.
-#
-# NOTE: cross-compiling is not well supported by the build system.
-# You have to do a lot of work by hand to cross compile: see the
-# section on "Porting GHC" in the Building Guide.
-
-HOSTPLATFORM = @HostPlatform@
-TARGETPLATFORM = @TargetPlatform@
-BUILDPLATFORM = @BuildPlatform@
-
-# Hack alert:
-# in one or two places, we need to get at the OS version (major and
-# perhaps even minor), HostOS_Full is the OS name reported by
-# AC_CANONICAL_SYSTEM.
-#
-HostPlatform_CPP = @HostPlatform_CPP@
-HostArch_CPP = @HostArch_CPP@
-HostOS_CPP = @HostOS_CPP@
-HostOS_Full = @HostOS_Full@
-HostVendor_CPP = @HostVendor_CPP@
-
-TargetPlatform_CPP = @TargetPlatform_CPP@
-TargetArch_CPP = @TargetArch_CPP@
-TargetOS_CPP = @TargetOS_CPP@
-TargetVendor_CPP = @TargetVendor_CPP@
-
-BuildPlatform_CPP = @BuildPlatform_CPP@
-BuildArch_CPP = @BuildArch_CPP@
-BuildOS_CPP = @BuildOS_CPP@
-BuildVendor_CPP = @BuildVendor_CPP@
-
-@HostPlatform_CPP@_HOST = 1
-@TargetPlatform_CPP@_TARGET = 1
-@BuildPlatform_CPP@_BUILD = 1
-
-@HostArch_CPP@_HOST_ARCH = 1
-@TargetArch_CPP@_TARGET_ARCH = 1
-@BuildArch_CPP@_BUILD_ARCH = 1
-
-@HostOS_CPP@_HOST_OS = 1
-@TargetOS_CPP@_TARGET_OS = 1
-@BuildOS_CPP@_BUILD_OS = 1
-
-@HostVendor_CPP@_HOST_VENDOR = 1
-@TargetVendor_CPP@_TARGET_VENDOR = 1
-@BuildVendor_CPP@_BUILD_VENDOR = 1
+include $(TOP)/mk/project.mk
################################################################################
#
#
################################################################################
-# Leading underscores on symbol names in object files
-# Valid options: YES/NO
-#
-LeadingUnderscore=@LeadingUnderscore@
-
-# Pin a suffix on executables? If so, what (Windows only).
-exeext=@exeext@
-soext=@soext@
-
-# Windows=YES if on a Windows platform
-ifneq "$(findstring $(HostOS_CPP), mingw32 cygwin32)" ""
-Windows=YES
-else
-Windows=NO
-endif
-
# BootingFromHc - build GHC and the libraries from .hc files?
BootingFromHc = @BootingFromHc@
# Which directory (in libraries/) contains the integer library?
INTEGER_LIBRARY=integer-gmp
-# What extra ways to build the libraries in
+# We build the libraries at least the "vanilla" way (way "v")
+GhcLibWays = v
+
# In addition to the normal sequential way, the default is to also build
-# profiled prelude libraries.
-# When booting from .hc files, turn this off.
-ifeq "$(BootingFromHc)" "YES"
-GhcLibWays=
-else
-GhcLibWays=p
+# profiled prelude libraries unless we are booting from .hc files
+ifneq "$(BootingFromHc)" "YES"
+GhcLibWays += p
endif
ifeq "$(BuildSharedLibs)" "YES"
# but we switch it on for the libraries so that we generate
# the code in case someone importing wants it
-GhcLibHcOpts=-O2 -Rghc-timing -XGenerics
+GhcLibHcOpts=-O2 -XGenerics
# Win32 only: Enable the RTS and libraries to be built as DLLs
DLLized=@EnableWin32DLLs@
DEFAULT_TMPDIR = /C/TEMP
endif
-# FPTOOLS_TOP_ABS: the top of the fptools hierarchy, absolute path.
-# On Windows this is a c:/foo/bar style path.
-FPTOOLS_TOP_ABS = @hardtop@
-
-BIN_DIST_TOPDIR_ABS=$(FPTOOLS_TOP_ABS)
+BIN_DIST_TOPDIR_ABS=$(TOP)
BIN_DIST_DIR=$(BIN_DIST_TOPDIR_ABS)/$(BIN_DIST_NAME)
BIN_DIST_NAME=ghc-$(ProjectVersion)
-BIN_DIST_TAR=$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
+BIN_DIST_TAR=$(TOP)/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
BIN_DIST_TAR_BZ2=$(BIN_DIST_TAR).bz2
-BIN_DIST_PREP_DIR=$(FPTOOLS_TOP_ABS)/bindist-prep
+BIN_DIST_PREP_DIR=$(TOP)/bindist-prep
BIN_DIST_PREP=$(BIN_DIST_PREP_DIR)/$(BIN_DIST_NAME)
-BIN_DIST_LIST=$(FPTOOLS_TOP_ABS)/bindist-list
+BIN_DIST_LIST=$(TOP)/bindist-list
# Definition of installation directories, we don't use half of these, but since
# the configure script has them on offer while passing through, we might as well
# Hack: our directory layouts tend to be different on Windows, so
# hack around configure's bogus assumptions here.
datarootdir := $(prefix)
-datadir := $(prefix)
-libdir := $(prefix)
+datadir := $(prefix)/lib
+libdir := $(prefix)/lib
docdir := $(prefix)/doc
htmldir := $(docdir)
# (NOTE: configure script setting is ignored).
libexecdir = $(libdir)
-GHC_PKG_PROG = $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/install-inplace/bin/ghc-pkg
-
#-----------------------------------------------------------------------------
# install configuration
# These flags make flex 8-bit
SRC_FLEX_OPTS += -8
-# lint gets all CPP's flags too
-SRC_LINT_OPTS += -axz -DLINT $(SRC_CPP_OPTS)
-WAY$(_way)_LINT_OPTS += WAY$(_way)_CPP_OPTS
-
# Default fptools options for dllwrap.
SRC_BLD_DLL_OPTS += --target=i386-mingw32
################################################################################
# Here we provide defines for the various directories in the source tree,
-# so we can move things around more easily. A define $(GHC_FOO_DIR_REL)
-# indicates a directory relative to the top of the source tree, whereas
-# $(GHC_FOO_DIR) is a directory relative to the current directory.
-# $(GHC_FOO_DIR_ABS) is the absolute path to the directory.
-
-GHC_UTILS_DIR_REL = utils
-GHC_INCLUDE_DIR_REL = includes
-GHC_COMPILER_DIR_REL = ghc
-GHC_RTS_DIR_REL = rts
-GHC_UTILS_DIR_REL = utils
-GHC_DRIVER_DIR_REL = driver
-GHC_COMPAT_DIR_REL = compat
-
-GHC_MKDEPENDC_DIR_REL = $(GHC_UTILS_DIR_REL)/mkdependC
-GHC_LTX_DIR_REL = $(GHC_UTILS_DIR_REL)/ltx
-GHC_RUNTEST_DIR_REL = $(GHC_UTILS_DIR_REL)/runstdtest
-GHC_LNDIR_DIR_REL = $(GHC_UTILS_DIR_REL)/lndir
-GHC_MKDIRHIER_DIR_REL = $(GHC_UTILS_DIR_REL)/mkdirhier
-GHC_DOCBOOK_DIR_REL = $(GHC_UTILS_DIR_REL)/docbook
-GHC_UNLIT_DIR_REL = $(GHC_UTILS_DIR_REL)/unlit
-GHC_HP2PS_DIR_REL = $(GHC_UTILS_DIR_REL)/hp2ps
-GHC_HSTAGS_DIR_REL = $(GHC_UTILS_DIR_REL)/hasktags
-GHC_GHCTAGS_DIR_REL = $(GHC_UTILS_DIR_REL)/ghctags
-GHC_HSC2HS_DIR_REL = $(GHC_UTILS_DIR_REL)/hsc2hs
-GHC_TOUCHY_DIR_REL = $(GHC_UTILS_DIR_REL)/touchy
-GHC_PKG_DIR_REL = $(GHC_UTILS_DIR_REL)/ghc-pkg
-GHC_GENPRIMOP_DIR_REL = $(GHC_UTILS_DIR_REL)/genprimopcode
-GHC_GENAPPLY_DIR_REL = $(GHC_UTILS_DIR_REL)/genapply
-
-GHC_MANGLER_DIR_REL = $(GHC_DRIVER_DIR_REL)/mangler
-GHC_SPLIT_DIR_REL = $(GHC_DRIVER_DIR_REL)/split
-GHC_SYSMAN_DIR_REL = $(GHC_RTS_DIR_REL)/parallel
-
-INPLACE_DATA_DIR = $(FPTOOLS_TOP_ABS)/inplace-datadir
-
-GHC_UTILS_DIR = $(FPTOOLS_TOP)/$(GHC_UTILS_DIR_REL)
-GHC_INCLUDE_DIR = $(FPTOOLS_TOP)/$(GHC_INCLUDE_DIR_REL)
-GHC_COMPILER_DIR = $(FPTOOLS_TOP)/$(GHC_COMPILER_DIR_REL)
-GHC_RTS_DIR = $(FPTOOLS_TOP)/$(GHC_RTS_DIR_REL)
-GHC_UTILS_DIR = $(FPTOOLS_TOP)/$(GHC_UTILS_DIR_REL)
-GHC_DRIVER_DIR = $(FPTOOLS_TOP)/$(GHC_DRIVER_DIR_REL)
-GHC_COMPAT_DIR = $(FPTOOLS_TOP)/$(GHC_COMPAT_DIR_REL)
-
-GHC_MKDEPENDC_DIR = $(FPTOOLS_TOP)/$(GHC_MKDEPENDC_DIR_REL)
-GHC_LTX_DIR = $(FPTOOLS_TOP)/$(GHC_LTX_DIR_REL)
-GHC_RUNTEST_DIR = $(FPTOOLS_TOP)/$(GHC_RUNTEST_DIR_REL)
-GHC_LNDIR_DIR = $(FPTOOLS_TOP)/$(GHC_LNDIR_DIR_REL)
-GHC_MKDIRHIER_DIR = $(FPTOOLS_TOP)/$(GHC_MKDIRHIER_DIR_REL)
-GHC_DOCBOOK_DIR = $(FPTOOLS_TOP)/$(GHC_DOCBOOK_DIR_REL)
-GHC_UNLIT_DIR = $(FPTOOLS_TOP)/$(GHC_UNLIT_DIR_REL)
-GHC_HP2PS_DIR = $(FPTOOLS_TOP)/$(GHC_HP2PS_DIR_REL)
-GHC_HSTAGS_DIR = $(FPTOOLS_TOP)/$(GHC_HSTAGS_DIR_REL)
-GHC_GHCTAGS_DIR = $(FPTOOLS_TOP)/$(GHC_GHCTAGS_DIR_REL)
-GHC_HSC2HS_DIR = $(FPTOOLS_TOP_ABS)/$(GHC_HSC2HS_DIR_REL)
-GHC_TOUCHY_DIR = $(FPTOOLS_TOP)/$(GHC_TOUCHY_DIR_REL)
-GHC_PKG_DIR = $(FPTOOLS_TOP)/$(GHC_PKG_DIR_REL)
-GHC_GENPRIMOP_DIR = $(FPTOOLS_TOP)/$(GHC_GENPRIMOP_DIR_REL)
-GHC_GENAPPLY_DIR = $(FPTOOLS_TOP)/$(GHC_GENAPPLY_DIR_REL)
-
-GHC_MANGLER_DIR = $(FPTOOLS_TOP)/$(GHC_MANGLER_DIR_REL)
-GHC_SPLIT_DIR = $(FPTOOLS_TOP)/$(GHC_SPLIT_DIR_REL)
-GHC_SYSMAN_DIR = $(FPTOOLS_TOP)/$(GHC_SYSMAN_DIR_REL)
-
-GHC_UTILS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_UTILS_DIR_REL)
-GHC_INCLUDE_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_INCLUDE_DIR_REL)
-GHC_COMPILER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)
-GHC_RTS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_RTS_DIR_REL)
-GHC_UTILS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_UTILS_DIR_REL)
-GHC_DRIVER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_DRIVER_DIR_REL)
-GHC_COMPAT_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_COMPAT_DIR_REL)
-
-GHC_MKDEPENDC_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_MKDEPENDC_DIR_REL)
-GHC_LTX_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_LTX_DIR_REL)
-GHC_RUNTEST_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_RUNTEST_DIR_REL)
-GHC_LNDIR_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_LNDIR_DIR_REL)
-GHC_MKDIRHIER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_MKDIRHIER_DIR_REL)
-GHC_DOCBOOK_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_DOCBOOK_DIR_REL)
-GHC_UNLIT_DIR = $(FPTOOLS_TOP_ABS)/$(GHC_UNLIT_DIR_REL)
-GHC_HP2PS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_HP2PS_DIR_REL)
-GHC_HSTAGS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_HSTAGS_DIR_REL)
-GHC_GHCTAGS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_GHCTAGS_DIR_REL)
-GHC_HSC2HS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_HSC2HS_DIR_REL)
-GHC_TOUCHY_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_TOUCHY_DIR_REL)
-GHC_PKG_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)
-GHC_GENPRIMOP_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_GENPRIMOP_DIR_REL)
-GHC_GENAPPLY_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_GENAPPLY_DIR_REL)
-GHC_COMPILER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)
-
-GHC_MANGLER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_MANGLER_DIR_REL)
-GHC_SYSMAN_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_SYSMAN_DIR_REL)
-GHC_SPLIT_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_SPLIT_DIR_REL)
+# so we can move things around more easily. A define $(GHC_FOO_DIR)
+# indicates a directory relative to the top of the source tree.
+
+GHC_UTILS_DIR = utils
+GHC_INCLUDE_DIR = includes
+GHC_COMPILER_DIR = compiler
+GHC_PROG_DIR = ghc
+GHC_RTS_DIR = rts
+GHC_DRIVER_DIR = driver
+GHC_COMPAT_DIR = compat
+
+GHC_MKDEPENDC_DIR = $(GHC_UTILS_DIR)/mkdependC
+GHC_LTX_DIR = $(GHC_UTILS_DIR)/ltx
+GHC_RUNTEST_DIR = $(GHC_UTILS_DIR)/runstdtest
+GHC_LNDIR_DIR = $(GHC_UTILS_DIR)/lndir
+GHC_MKDIRHIER_DIR = $(GHC_UTILS_DIR)/mkdirhier
+GHC_DOCBOOK_DIR = $(GHC_UTILS_DIR)/docbook
+GHC_UNLIT_DIR = $(GHC_UTILS_DIR)/unlit
+GHC_HP2PS_DIR = $(GHC_UTILS_DIR)/hp2ps
+GHC_HSTAGS_DIR = $(GHC_UTILS_DIR)/hasktags
+GHC_GHCTAGS_DIR = $(GHC_UTILS_DIR)/ghctags
+GHC_HSC2HS_DIR = $(GHC_UTILS_DIR)/hsc2hs
+GHC_TOUCHY_DIR = $(GHC_UTILS_DIR)/touchy
+GHC_PKG_DIR = $(GHC_UTILS_DIR)/ghc-pkg
+GHC_GENPRIMOP_DIR = $(GHC_UTILS_DIR)/genprimopcode
+GHC_GENAPPLY_DIR = $(GHC_UTILS_DIR)/genapply
+GHC_CABAL_DIR = $(GHC_UTILS_DIR)/ghc-cabal
+GHC_MANGLER_DIR = $(GHC_DRIVER_DIR)/mangler
+GHC_SPLIT_DIR = $(GHC_DRIVER_DIR)/split
+GHC_SYSMAN_DIR = $(GHC_RTS_DIR)/parallel
# -----------------------------------------------------------------------------
# Names of programs in the GHC tree
#
-# xxx_PGM the name of an executable, without the path
-# xxx the executable relative to the current dir
-
-GHC_UNLIT_PGM = unlit$(exeext)
-GHC_HP2PS_PGM = hp2ps
-GHC_HSTAGS_PGM = hasktags
-GHC_GHCTAGS_INPLACE_PGM = ghctags-inplace
-GHC_HSC2HS_INPLACE_PGM = hsc2hs
-GHC_TOUCHY_PGM = touchy$(exeext)
-GHC_MANGLER_PGM = ghc-asm
-GHC_SPLIT_PGM = ghc-split
-GHC_SYSMAN_PGM = SysMan
-GHC_GENPRIMOP_PGM = genprimopcode
-GHC_GENAPPLY_PGM = genapply
-GHC_MKDEPENDC_PGM = mkdependC
-GHC_LTX_PGM = ltx
-GHC_MKDIRHIER_PGM = mkdirhier
-GHC_LNDIR_PGM = lndir
-GHC_RUNTEST_PGM = runstdtest
+# xxx_PGM the name of an executable, without the path
+# xxx the executable relative to the current dir
+
+GHC_UNLIT_PGM = unlit$(exeext)
+GHC_HP2PS_PGM = hp2ps$(exeext)
+GHC_HSTAGS_PGM = hasktags$(exeext)
+GHC_GHCTAGS_PGM = ghctags$(exeext)
+GHC_HSC2HS_PGM = hsc2hs$(exeext)
+GHC_TOUCHY_PGM = touchy$(exeext)
+GHC_MANGLER_PGM = ghc-asm
+GHC_SPLIT_PGM = ghc-split
+GHC_SYSMAN_PGM = SysMan
+GHC_GENPRIMOP_PGM = genprimopcode$(exeext)
+GHC_GENAPPLY_PGM = genapply$(exeext)
+GHC_CABAL_PGM = ghc-cabal$(exeext)
+GHC_PKG_PGM = ghc-pkg$(exeext)
+GHC_MKDEPENDC_PGM = mkdependC
+GHC_LTX_PGM = ltx$(exeext)
+GHC_MKDIRHIER_PGM = mkdirhier
+GHC_LNDIR_PGM = lndir
+GHC_RUNTEST_PGM = runstdtest
+GHC_DUMMY_GHC_PGM = dummy-ghc$(exeext)
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
GHC_CP = "xcopy /y"
GHC_PERL = $(PERL)
endif
-UNLIT = $(GHC_UNLIT_DIR)/$(GHC_UNLIT_PGM)
HP2PS = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM)
HSTAGS = $(GHC_HSTAGS_DIR)/$(GHC_HSTAGS_PGM)
-GHCTAGS_INPLACE = $(GHC_GHCTAGS_DIR)/$(GHC_GHCTAGS_INPLACE_PGM)
-HSC2HS_INPLACE = $(GHC_HSC2HS_DIR)/install-inplace/bin/$(GHC_HSC2HS_INPLACE_PGM)
-MANGLER = $(GHC_MANGLER_DIR)/$(GHC_MANGLER_PGM)
-SPLIT = $(GHC_SPLIT_DIR)/$(GHC_SPLIT_PGM)
+MANGLER = $(INPLACE_LIB)/$(GHC_MANGLER_PGM)
+SPLIT = $(INPLACE_LIB)/$(GHC_SPLIT_PGM)
SYSMAN = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM)
-GHC_PKG_INPLACE = $(GHC_PKG_PROG)
-GENPRIMOP = $(GHC_GENPRIMOP_DIR)/$(GHC_GENPRIMOP_PGM)
-GENAPPLY = $(GHC_GENAPPLY_DIR)/$(GHC_GENAPPLY_PGM)
-MKDEPENDC = $(GHC_MKDEPENDC_DIR)/$(GHC_MKDEPENDC_PGM)
LTX = $(GHC_LTX_DIR)/$(GHC_LTX_PGM)
-MKDIRHIER = $(GHC_MKDIRHIER_DIR)/$(GHC_MKDIRHIER_PGM)
LNDIR = $(GHC_LNDIR_DIR)/$(GHC_LNDIR_PGM)
RUNTEST = $(GHC_RUNTEST_DIR)/$(GHC_RUNTEST_PGM)
+INPLACE = inplace
+INPLACE_BIN = $(INPLACE)/bin
+INPLACE_LIB = $(INPLACE)/lib
+INPLACE_MINGW = $(INPLACE)/mingw
+
+UNLIT = $(INPLACE_LIB)/$(GHC_UNLIT_PGM)
+TOUCHY = $(INPLACE_LIB)/$(GHC_TOUCHY_PGM)
+MKDIRHIER = $(INPLACE_BIN)/$(GHC_MKDIRHIER_PGM)
+MKDEPENDC = $(INPLACE_BIN)/$(GHC_MKDEPENDC_PGM)
+GHC_CABAL_INPLACE = $(INPLACE_BIN)/$(GHC_CABAL_PGM)
+GENAPPLY_INPLACE = $(INPLACE_BIN)/$(GHC_GENAPPLY_PGM)
+GHC_PKG_INPLACE = $(INPLACE_BIN)/$(GHC_PKG_PGM)
+GHCTAGS_INPLACE = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM)
+HSC2HS_INPLACE = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
+GENPRIMOP_INPLACE = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
+DUMMY_GHC_INPLACE = $(INPLACE_BIN)/$(GHC_DUMMY_GHC_PGM)
+
GENERATED_FILE = chmod a-w
EXECUTABLE_FILE = chmod +x
# NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
# (because the version numbers have to be calculated).
-GHC = @WithGhc@
+GHC := @WithGhc@
+# If we have a make dependency on c:/ghc/ghc, and the file is actually
+# called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
+# and that it doesn't know how to create it.
+ifneq "$(wildcard $(GHC).exe)" ""
+GHC := $(GHC).exe
+endif
+
GhcDir = $(dir $(GHC))
# Set to YES if $(GHC) has the editline package installed
# tree). We can refer to "this ghc" as $(GHC_INPLACE):
GHC_INPLACE = $(GHC_STAGE1)
-GHC_STAGE1 = $(GHC_COMPILER_DIR_ABS)/stage1-inplace/ghc
-GHC_STAGE2 = $(GHC_COMPILER_DIR_ABS)/stage2-inplace/ghc
-GHC_STAGE3 = $(GHC_COMPILER_DIR_ABS)/stage3-inplace/ghc
-# XXX All those used to have -no-user-package-conf, but then we can't
-# pass them to Cabal
-BOOTSTRAPPING_CONF = $(FPTOOLS_TOP_ABS)/libraries/bootstrapping.conf
+GHC_STAGE0_ABS = $(GHC)
+GHC_STAGE1_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage1$(exeext)
+GHC_STAGE2_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage2$(exeext)
+GHC_STAGE3_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage3$(exeext)
-# NOTE: add -no-user-package-conf for stage 1-3 above, so that
-# we avoid picking up any packages the user might happen to have
-# installed for this GHC version. They are bound to be incompatible
-# with the packages we built in the tree.
+GHC_STAGE0 = $(GHC)
+GHC_STAGE1 = $(INPLACE_BIN)/ghc-stage1$(exeext)
+GHC_STAGE2 = $(INPLACE_BIN)/ghc-stage2$(exeext)
+GHC_STAGE3 = $(INPLACE_BIN)/ghc-stage3$(exeext)
-ifeq "$(stage)" "2"
- UseStage1 = YES
-endif
-ifneq "$(findstring YES, $(UseStage1) $(BootingFromHc))" ""
-
-# We are using the stage1 compiler to compile Haskell code, set up
-# some variables appropriately:
-HC =$(GHC_STAGE1)
-MKDEPENDHS =$(GHC_STAGE1)
-USE_NEW_MKDEPEND_FLAGS = YES
-GhcVersion = @ProjectVersion@
-GhcPatchLevel = @ProjectPatchLevel@
-# oops, these are wrong:
-GhcMajVersion = @GhcMajVersion@
-GhcMinVersion = @GhcMinVersion@
+# Install stage 2 by default, can be changed to 3
+INSTALL_GHC_STAGE=2
-ghc_ge_607 = YES
-ghc_ge_609 = YES
+BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
-else # not UseStage1 or BootingFromHc
+INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf
-# Some useful GHC version predicates:
-ghc_ge_607 = @ghc_ge_607@
-ghc_ge_609 = @ghc_ge_609@
-
-HC = @WithHc@
-MKDEPENDHS = $(GHC)
-USE_NEW_MKDEPEND_FLAGS = $(ghc_ge_609)
GhcVersion = @GhcVersion@
GhcPatchLevel = @GhcPatchLevel@
GhcMajVersion = @GhcMajVersion@
GhcMinVersion = @GhcMinVersion@
-# We build a few packages using the installed GHC as part of the
-# bootstrapping process. These are installed into a local
-# package.conf file, $(BOOTSTRAPPING_CONF). When we invoke the
-# installed GHC we need to pass it -package-conf $(BOOTSTRAPPING_CONF).
-# So the following variables expand to -package-conf $(BOOTSTRAPPING_CONF)
-# when $(HC) does *not* point to one of the GHC binaries built in
-# the local tree.
-#
-BOOTSTRAPPING_PACKAGE_CONF_HC_OPTS =$(if $(findstring inplace, $(HC)),,-package-conf $(BOOTSTRAPPING_CONF))
-BOOTSTRAPPING_PACKAGE_CONF_MKDEPENDHS_OPTS =$(if $(findstring inplace, $(MKDEPENDHS)),,-package-conf $(BOOTSTRAPPING_CONF))
-endif
+ghc_ge_607 = @ghc_ge_607@
+ghc_ge_609 = @ghc_ge_609@
# Canonicalised ghc version number, used for easy (integer) version
# comparisons. We must expand $(GhcMinVersion) to two digits by
CC = cc
else
CC = $(WhatGccIsCalled)
- GccDir = $(dir $(WhatGccIsCalled))
endif
endif
# install-sh script (if chosen). This not terribly useful to us, so we convert
# it into an abs. path.
#
-INSTALL := $(subst .././install-sh,$(FPTOOLS_TOP_ABS)/install-sh,$(INSTALL))
+INSTALL := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
LATEX = latex
HEVEA = hevea
HACHA = hacha
REAL_SHELL=$(SHELL)
SIZE = size
STRIP = strip
+PATCH = @PatchCmd@
TAR = @TarCmd@
ZIP = zip
BLD_DLL = dllwrap
#
-# .NET support software
-#
-ILX2IL = ilx2il
-ILASM = ilasm
-
-#
# ghc-pkg
#
GHC_PKG = @GhcPkgCmd@
#
# Options to pass to Happy when we're going to compile the output with GHC
#
-GHC_HAPPY_OPTS = -agc --strict
+SRC_HAPPY_OPTS = -agc --strict
# Temp. to work around performance problems in the HEAD around 8/12/2003,
# A Happy compiled with this compiler needs more stack.
-SRC_HAPPY_OPTS = +RTS -K2m -RTS
+SRC_HAPPY_OPTS += +RTS -K2m -RTS
#
# Alex
#
# Options to pass to Happy when we're going to compile the output with GHC
#
-GHC_ALEX_OPTS = -g
+SRC_ALEX_OPTS = -g
# Should we build haddock docs?
HADDOCK_DOCS = YES
#
# The ways currently defined.
#
-ALL_WAYS=p t s mp mg a b c d e f g h i j k l m n o A B
+ALL_WAYS=v p t l s mp mg debug dyn thr thr_l debug_dyn thr_dyn thr_debug_dyn thr_p thr_debug thr_debug_l
USER_WAYS=a b c d e f g h j k l m n o A B
#
#
# If you want to add to these default options, fill in the variables below:
-# Way 'i':
-WAY_i_NAME=ILX
-WAY_i_HC_OPTS= -filx -fruntime-types
+# Way 'v':
+WAY_v_NAME=vanilla
+WAY_v_HC_OPTS=
# Way 'p':
WAY_p_NAME=profiling
BIN_DIST_INST_SUBDIR = installed
endif
-BIN_DIST_INST_DIR = $(FPTOOLS_TOP_ABS)/bindisttest/$(BIN_DIST_INST_SUBDIR)
+BIN_DIST_INST_DIR = $(TOP)/bindisttest/$(BIN_DIST_INST_SUBDIR)
--include $(TOP)/mk/are-validating.mk
+-include mk/are-validating.mk
ifeq "$(Validating)" "YES"
-include $(TOP)/mk/validate-settings.mk
--include $(TOP)/mk/validate.mk
+include mk/validate-settings.mk
+-include mk/validate.mk
else
--include $(TOP)/mk/build.mk
+-include mk/build.mk
endif
+++ /dev/null
-#
-# install* installcheck installdirs
-# install-docs*
-#
-# Some of the above targets have a version that
-# recursively invokes that target in sub-directories.
-# This relies on the importing Makefile setting SUBDIRS
-#
-# The recursive targets are marked with a * above
-#
-
-##################################################################
-# GNU Standard targets
-#
-# Every Makefile should define the following targets
-#
-# `install'
-# Compile the program and copy the executables, libraries, and so on
-# to the file names where they should reside for actual use. If
-# there is a simple test to verify that a program is properly
-# installed, this target should run that test.
-#
-# The commands should create all the directories in which files are
-# to be installed, if they don't already exist. This includes the
-# directories specified as the values of the variables prefix and
-# exec_prefix , as well as all subdirectories that are needed. One
-# way to do this is by means of an installdirs target as described
-# below.
-#
-# Use `-' before any command for installing a man page, so that make
-# will ignore any errors. This is in case there are systems that
-# don't have the Unix man page documentation system installed.
-#
-# The following targets are suggested as conventional names, for programs
-# in which they are useful.
-#
-# installcheck
-# Perform installation tests (if any). The user must build and
-# install the program before running the tests. You should not
-# assume that `$(bindir)' is in the search path.
-#
-# installdirs
-# It's useful to add a target named `installdirs' to create the
-# directories where files are installed, and their parent
-# directories. There is a script called `mkinstalldirs' which is
-# convenient for this; find it in the Texinfo package.
-# (GHC: we use a close relative of the suggested script, situated
-# in glafp-utils/mkdirhier -- SOF)
-
-
-
-# ---------------------------------------------------------------------------
-# 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) $(DESTDIR)$(bindir)
- if ( $(PERL) -e '$$fn="$(DESTDIR)$(bindir)/$(LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
- echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(DESTDIR)$(bindir)"; \
- $(RM) $(DESTDIR)$(bindir)/$(LINK); \
- $(LN_S) $(LINK_TARGET) $(DESTDIR)$(bindir)/$(LINK); \
- else \
- echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(DESTDIR)$(bindir) failed: \`$(DESTDIR)$(bindir)/$(LINK)' already exists"; \
- echo "Perhaps remove \`$(DESTDIR)$(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-docs show-install
-
-show-install :
- @echo "DESTDIR = $(DESTDIR)"
- @echo "bindir = $(bindir)"
- @echo "libdir = $(libdir)"
- @echo "libexecdir = $(libexecdir) # by default, same as libdir"
- @echo "datadir = $(datadir) # unused for ghc project"
- @echo "ifacedir = $(ifacedir)"
- @echo "headerdir = $(headerdir)"
- @echo "includedir = $(includedir)"
-
-#
-# 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),\
- $(if $(filter $(exeext),$(suffix $p)),\
- $p,\
- $(addsuffix $(exeext),$p)\
- )\
- )
-
-install:: $(INSTALL_PROGS)
- $(INSTALL_DIR) $(DESTDIR)$(bindir)
- for i in $(INSTALL_PROGS); do \
- $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(bindir) ; \
- if test "$(darwin_TARGET_OS)" = "1"; then \
- sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(DESTDIR)$(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) $(DESTDIR)$(bindir)
- for i in $(INSTALL_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(bindir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_LIB_SCRIPTS))" ""
-install:: $(INSTALL_LIB_SCRIPTS)
- $(INSTALL_DIR) $(DESTDIR)$(libdir)
- for i in $(INSTALL_LIB_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_LIBEXEC_SCRIPTS))" ""
-install:: $(INSTALL_LIBEXEC_SCRIPTS)
- $(INSTALL_DIR) $(DESTDIR)$(libexecdir)
- for i in $(INSTALL_LIBEXEC_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(libexecdir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_LIBS))" ""
-install:: $(INSTALL_LIBS)
- $(INSTALL_DIR) $(DESTDIR)$(libdir)
- for i in $(INSTALL_LIBS); do \
- case $$i in \
- *.a) \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
- $(RANLIB) $(DESTDIR)$(libdir)/`basename $$i` ;; \
- *.dll) \
- $(INSTALL_DATA) -s $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir) ;; \
- *.so) \
- $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir) ;; \
- *.dylib) \
- $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
- install_name_tool -id $(DESTDIR)$(libdir)/`basename $$i` $(DESTDIR)$(libdir)/`basename $$i` ;; \
- *) \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(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) $(DESTDIR)$(libexecdir)
- -for i in $(INSTALL_LIBEXECS); do \
- $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(libexecdir); \
- if test "$(darwin_TARGET_OS)" = "1"; then \
- sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(DESTDIR)$(libexecdir)/`basename $$i` ; \
- fi ; \
- done
-endif
-
-ifneq "$(strip $(INSTALL_DATAS))" ""
-install:: $(INSTALL_DATAS)
- $(INSTALL_DIR) $(DESTDIR)$(datadir)
- for i in $(INSTALL_DATAS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(datadir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_HEADERS))" ""
-install:: $(INSTALL_HEADERS)
- $(INSTALL_DIR) $(DESTDIR)$(headerdir)
- for i in $(INSTALL_HEADERS); do \
- $(INSTALL_HEADER) $(INSTALL_OPTS) $$i $(DESTDIR)$(headerdir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_IFACES))" ""
-install:: $(INSTALL_IFACES)
- $(INSTALL_DIR) $(DESTDIR)$(ifacedir)
- for i in $(INSTALL_IFACES); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ifacedir); \
- done
-endif
-
-ifneq "$(strip $(INSTALL_IFACES_WITH_DIRS))" ""
-install:: $(INSTALL_IFACES_WITH_DIRS)
- $(INSTALL_DIR) $(DESTDIR)$(ifacedir)
- for i in $(INSTALL_IFACES_WITH_DIRS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ifacedir)/`dirname $$i`; \
- done
-endif
-
-ifneq "$(strip $(INSTALL_DOCS))" ""
-ifneq "$(XMLDocWays)" ""
-install-docs:: $(INSTALL_DOCS)
- $(INSTALL_DIR) $(DESTDIR)$(datadir)
- for i in $(INSTALL_DOCS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(datadir); \
- done
-endif
-endif
-
-ifneq "$(strip $(INSTALL_XML_DOC))" ""
-ifeq "$(DOC_SUBDIR)" ""
-DOC_SUBDIR=docs/$(XML_DOC)
-endif
-
-ifneq "$(XMLDocWays)" ""
-# TODO: The following could be an entry for an Obfuscated Makefile Contest...
-install-docs:: $(foreach i,$(XMLDocWays),$(INSTALL_XML_DOC)$(patsubst %.html-no-chunks,%.html,$(patsubst %.html,%/index.html,.$(i))))
-
-install-docs:: $(foreach i,$(XMLDocWays),install-docs-$i)
-
-install-docs-html:
- $(INSTALL_DIR) $(DESTDIR)$(htmldir)
- $(INSTALL_DIR) $(DESTDIR)$(htmldir)/$(INSTALL_XML_DOC)
- $(CP) $(INSTALL_XML_DOC)/* $(DESTDIR)$(htmldir)/$(INSTALL_XML_DOC)
-
-install-docs-html-no-chunks:
- $(INSTALL_DIR) $(DESTDIR)$(htmldir)
- $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC).html $(DESTDIR)$(htmldir)
- $(CP) $(FPTOOLS_CSS_ABS) $(DESTDIR)$(htmldir)
-
-install-docs-%:
- $(INSTALL_DIR) $(DESTDIR)$($*dir)
- $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC).$* $(DESTDIR)$($*dir)
-endif
-endif
-
-#
-# install-strip is from the GNU Makefile standard.
-#
-ifneq "$(way)" ""
-install-strip::
- $(MAKE) EXTRA_INSTALL_OPTS='-s' install
-endif
-
--- /dev/null
+# -*-makefile-*-
+# @configure_input@
+#
+################################################################################
+#
+# config.mk.in
+#
+# This file supplies defaults for many tweakable build configuration
+# options. Some of the defaults are filled in by the autoconf-generated
+# configure script.
+#
+# DO NOT EDIT THIS FILE!
+#
+# - config.mk is auto-generated from config.mk.in by configure.
+# This may be triggered automatically by the build system (say
+# if config.mk.in has changed more recently than config.mk),
+# so if you edit config.mk your changes will be spammed.
+#
+# - Settings in this file may be overriden by giving replacement
+# definitions in build.mk. See build.mk.sample for a good
+# starting point for a build.mk file.
+#
+# If you don't have a build.mk file then you get defaults for everything.
+# The defaults should provide a reasonable vanilla build.
+#
+# This is one of only two files that configure generates (the other is config.h)
+#
+
+ifneq "$(findstring 3.7, $(MAKE_VERSION))" ""
+ifeq "$(findstring 3.79.1, $(MAKE_VERSION))" ""
+$(error GNU make version 3.79.1 or later is required.)
+endif
+endif
+
+################################################################################
+#
+# GHC Version
+#
+
+# ProjectVersion is treated as a *string*
+# ProjectVersionInt is treated as an *integer* (for cpp defines)
+
+# Versioning scheme: A.B.C
+# A: major version, decimal, any number of digits
+# B: minor version, decimal, any number of digits
+# C: patchlevel, one digit, omitted if zero.
+#
+# ProjectVersionInt does *not* contain the patchlevel (rationale: this
+# figure is used for conditional compilations, and library interfaces
+# etc. are not supposed to change between patchlevels).
+#
+# The ProjectVersionInt is included in interface files, and GHC
+# checks that it's reading interface generated by the same ProjectVersion
+# as itself. It does this even though interface file syntax may not
+# change between versions. Rationale: calling conventions or other
+# random .o-file stuff might change even if the .hi syntax doesn't
+
+ProjectName = @ProjectName@
+ProjectTags =
+ProjectVersion = @ProjectVersion@$(ProjectTags)
+ProjectVersionInt = @ProjectVersionInt@
+ProjectPatchLevel = @ProjectPatchLevel@
+
+################################################################################
+#
+# Platform variables
+#
+################################################################################
+
+# A "platform" is the GNU cpu-type/manufacturer/operating-system target machine
+# specifier. E.g. sparc-sun-solaris2
+#
+# Build platform: the platform on which we are doing this build
+# Host platform: the platform on which these binaries will run
+# Target platform: the platform for which this compiler will generate code
+#
+# We don't support build & host being different, because the build
+# process creates binaries that are run during the build, and also
+# installed.
+#
+# If host & target are different, then we are building a compiler
+# which will generate intermediate .hc files to port to the target
+# architecture for bootstrapping. The libraries and stage 2 compiler
+# will be built as HC files for the target system, and likely won't
+# build on this host platform.
+#
+# An important invariant is that for any piece of source code, the
+# platform on which the code is going to run is the HOST platform,
+# and the platform on which we are building is the BUILD platform.
+# Additionally for the compiler, the platform this compiler will
+# generate code for is the TARGET. TARGET is not meaningful outside
+# the compiler sources.
+#
+# Guidelines for when to use HOST vs. TARGET:
+#
+# - In the build system (Makefile, foo.mk), normally we should test
+# $(HOSTPLATFORM). There are some cases (eg. installation), where
+# we expect $(HOSTPLATFORM)==$(TARGETPLATFORM), so in those cases it
+# doesn't matter which is used.
+#
+# - In the compiler itself, we should test HOST or TARGET depending
+# on whether the conditional relates to the code being generated, or
+# the platform on which the compiler is running. See the section
+# on "Coding Style" in the commentary for more details.
+#
+# - In all other code, we should be testing HOST only.
+#
+# NOTE: cross-compiling is not well supported by the build system.
+# You have to do a lot of work by hand to cross compile: see the
+# section on "Porting GHC" in the Building Guide.
+
+HOSTPLATFORM = @HostPlatform@
+TARGETPLATFORM = @TargetPlatform@
+BUILDPLATFORM = @BuildPlatform@
+
+# Hack alert:
+# in one or two places, we need to get at the OS version (major and
+# perhaps even minor), HostOS_Full is the OS name reported by
+# AC_CANONICAL_SYSTEM.
+#
+HostPlatform_CPP = @HostPlatform_CPP@
+HostArch_CPP = @HostArch_CPP@
+HostOS_CPP = @HostOS_CPP@
+HostOS_Full = @HostOS_Full@
+HostVendor_CPP = @HostVendor_CPP@
+
+TargetPlatform_CPP = @TargetPlatform_CPP@
+TargetArch_CPP = @TargetArch_CPP@
+TargetOS_CPP = @TargetOS_CPP@
+TargetVendor_CPP = @TargetVendor_CPP@
+
+BuildPlatform_CPP = @BuildPlatform_CPP@
+BuildArch_CPP = @BuildArch_CPP@
+BuildOS_CPP = @BuildOS_CPP@
+BuildVendor_CPP = @BuildVendor_CPP@
+
+@HostPlatform_CPP@_HOST = 1
+@TargetPlatform_CPP@_TARGET = 1
+@BuildPlatform_CPP@_BUILD = 1
+
+@HostArch_CPP@_HOST_ARCH = 1
+@TargetArch_CPP@_TARGET_ARCH = 1
+@BuildArch_CPP@_BUILD_ARCH = 1
+
+@HostOS_CPP@_HOST_OS = 1
+@TargetOS_CPP@_TARGET_OS = 1
+@BuildOS_CPP@_BUILD_OS = 1
+
+@HostVendor_CPP@_HOST_VENDOR = 1
+@TargetVendor_CPP@_TARGET_VENDOR = 1
+@BuildVendor_CPP@_BUILD_VENDOR = 1
+
+################################################################################
+#
+# Global configuration options
+#
+################################################################################
+
+# Leading underscores on symbol names in object files
+# Valid options: YES/NO
+#
+LeadingUnderscore=@LeadingUnderscore@
+
+# Pin a suffix on executables? If so, what (Windows only).
+exeext=@exeext@
+soext=@soext@
+
+# Windows=YES if on a Windows platform
+ifneq "$(findstring $(HostOS_CPP), mingw32 cygwin32)" ""
+Windows=YES
+else
+Windows=NO
+endif
+
+# BootingFromHc - build GHC and the libraries from .hc files?
+BootingFromHc = @BootingFromHc@
+
+# BootingFromUnregisterisedHc - treat .hc files as containing unregisterised
+# rather than registerised code, i.e., disable the mangler?
+BootingFromUnregisterisedHc = @BootingFromUnregisterisedHc@
+
+#
+# Which ways should DocBook XML documents be built?
+# options are: dvi ps pdf html chm HxS
+#
+XMLDocWays=
+
+# Should we build latex docs?
+LATEX_DOCS = NO
+
+# Mac OS X deployment target (to cross-compile for older OS versions)
+#
+MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
+MACOSX_DEPLOYMENT_SDK = @MACOSX_DEPLOYMENT_SDK@
+
+ifneq "$(MACOSX_DEPLOYMENT_VERSION)" ""
+MACOSX_DEPLOYMENT_CC_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
+ -isysroot $(MACOSX_DEPLOYMENT_SDK) \
+ --no-builtin-fprintf
+MACOSX_DEPLOYMENT_LD_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
+ -Wl,-syslibroot,$(MACOSX_DEPLOYMENT_SDK)
+# We don't extend SRC_CC_OPTS and friends here directly, as (a) they may get
+# overwritten in build.mk and (b) we must not use the deployment options in
+# stage 1 or we get a linker error if the bootstrap compiler is for a more
+# recent OS version.
+#
+# We need --no-builtin-fprintf, as the use of the builtin function optimisation
+# for fprintf together with #include "PosixSource" in the RTS leads to the
+# use of fwrite$UNIX2003 (with GCC 4.0.1 on Mac OS X 10.5.2).
+endif
+
+################################################################################
+#
+# Variables that control how the compiler itself is built
+#
+################################################################################
+
+# The compiler used to build GHC is $(GHC). To change the actual compiler
+# used, re-configure with --with-ghc=<path-to-ghc>.
+
+# Extra ways in which to build the compiler (for example, you might want to
+# build a profiled compiler so you can see where it spends its time)
+GhcCompilerWays=
+
+# Extra option flags to pass to the compiler that compiles the compiler
+# (Ones that are essential are wired into compiler/Makefile)
+# Typical options to use here:
+#
+# -DDEBUG include debugging code and assertions (will make the
+# compiler slower and produce debugging output, but useful
+# for development)
+#
+# -dcore-lint check the types after every pass of the compiler;
+# a pretty strong internal check of the compiler being
+# used to compile GHC. Useful when bootstrapping.
+GhcHcOpts=-Rghc-timing
+
+# Extra options added to specific stages of the compiler bootstrap.
+# These are placed later on the command line, and may therefore
+# override options from $(GhcHcOpts).
+GhcStage1HcOpts=
+GhcStage2HcOpts=-O2
+GhcStage3HcOpts=-O2
+
+GhcProfiled=NO
+GhcDebugged=NO
+GhcLibProfiled=$(if $(filter p,$(GhcLibWays)),YES,NO)
+
+# Build shared and/or static libs?
+BuildSharedLibs=@BuildSharedLibs@
+# ToDo later:
+# BuildStaticLibs=@BuildStaticLibs@
+
+# Build a compiler that will build *unregisterised* libraries and
+# binaries by default. Unregisterised code is supposed to compile and
+# run without any support for architecture-specific assembly mangling,
+# register assignment or tail-calls, and is therefore a good way to get
+# started when porting GHC to new architectures.
+#
+# If this is set to NO, you can still use the unregisterised way
+# (way 'u') to get unregisterised code, but the default way will be
+# registerised.
+#
+# NOTE: the stage1 compiler will be a registerised binary (assuming
+# the compiler you build with is generating registerised binaries), but
+# the stage2 compiler will be an unregisterised binary.
+#
+ifneq "$(findstring $(HostArch_CPP), alpha hppa)" ""
+GhcUnregisterised=YES
+else
+GhcUnregisterised=NO
+endif
+
+# Build a compiler with a native code generator backend
+# (as well as a C backend)
+#
+# Target platforms supported:
+# i386, powerpc
+# AIX is not supported
+ArchSupportsNCG=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc)))
+OsSupportsNCG=$(strip $(patsubst $(HostOS_CPP), YES, $(patsubst aix,,$(HostOS_CPP))))
+
+# lazy test, because $(GhcUnregisterised) might be set in build.mk later.
+GhcWithNativeCodeGen=$(strip\
+ $(if $(filter YESYESNO,\
+ $(OsSupportsNCG)$(ArchSupportsNCG)$(GhcUnregisterised)),YES,NO))
+
+HaveLibDL = @HaveLibDL@
+
+# ArchSupportsSMP should be set iff there is support for that arch in
+# includes/SMP.h
+ArchSupportsSMP=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 sparc powerpc)))
+
+# lazy test, because $(GhcUnregisterised) might be set in build.mk later.
+GhcWithSMP=$(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
+
+# Whether to include GHCi in the compiler. Depends on whether the RTS linker
+# has support for this OS/ARCH combination.
+
+OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd netbsd openbsd darwin)))
+ArchSupportsGHCi=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc sparc64)))
+
+ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
+GhcWithInterpreter=YES
+else
+GhcWithInterpreter=NO
+endif
+
+# GhcEnableTablesNextToCode tells us whether the target architecture
+# supports placing info tables directly before the entry code
+# (see TABLES_NEXT_TO_CODE in the RTS). Whether we actually compile for
+# TABLES_NEXT_TO_CODE depends on whether we're building unregisterised
+# code or not, which may be decided by options to the compiler later.
+ifneq "$(findstring $(TargetArch_CPP)X, ia64X powerpc64X)" ""
+GhcEnableTablesNextToCode=NO
+else
+GhcEnableTablesNextToCode=YES
+endif
+
+# On Windows we normally want to make a relocatable bindist, to we
+# ignore flags like libdir
+ifeq "$(Windows)" "YES"
+RelocatableBuild = YES
+else
+RelocatableBuild = NO
+endif
+
+# When building bindists we set this to yes so that the binaries are as
+# portable as possible.
+BeConservative = NO
+
+#
+# Building various ways?
+# (right now, empty if not).
+BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
+BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
+
+# Interface file version (hi-boot files only)
+#
+# A GHC built with HscIfaceFileVersion=n will look for
+# M.hi-boot-n, and only then for
+# M.hi-boot.
+# (It'll be happy with the latter if the former doesn't exist.)
+#
+#
+# This variable is used ONLY for hi-boot files. Its only purpose is
+# to allow you to have a single directory with multiple .hi-boot files
+# for the same module, each corresponding to a different version of
+# GHC.
+#
+# HscIfaceFileVersion is propagated to hsc via
+# compiler/main/Config.hs, which is automatically generated by
+# compiler/Makefile.
+
+HscIfaceFileVersion=6
+
+#------------------------------------------------------------------------------
+# Options for Libraries
+
+# Which directory (in libraries/) contains the integer library?
+INTEGER_LIBRARY=integer-gmp
+
+# What extra ways to build the libraries in
+# In addition to the normal sequential way, the default is to also build
+# profiled prelude libraries.
+# When booting from .hc files, turn this off.
+ifeq "$(BootingFromHc)" "YES"
+GhcLibWays=
+else
+GhcLibWays=p
+endif
+
+ifeq "$(BuildSharedLibs)" "YES"
+GhcLibWays += dyn
+endif
+
+# In addition, the RTS is built in some further variations. Ways that
+# make sense here:
+#
+# thr : threaded
+# thr_p : threaded profiled
+# debug : debugging (compile with -g for the C compiler, and -DDEBUG)
+# debug_p : debugging profiled
+# thr_debug : debugging threaded
+# thr_debug_p : debugging threaded profiled
+# t : ticky-ticky profiling
+# debug_t : debugging ticky-ticky profiling
+# l : event logging
+# thr_l : threaded and event logging
+# thr_debug_l : threaded and debugging and event logging
+#
+GhcRTSWays=l
+
+# Usually want the debug version
+ifeq "$(BootingFromHc)" "NO"
+GhcRTSWays += debug
+endif
+
+ifeq "$(BuildSharedLibs)" "YES"
+GhcRTSWays += dyn debug_dyn thr_dyn thr_debug_dyn
+endif
+
+# Want the threaded versions unless we're unregisterised
+# Defer the check until later by using $(if..), because GhcUnregisterised might
+# be set in build.mk, which hasn't been read yet.
+GhcRTSWays += $(if $(findstring NO, $(GhcUnregisterised)),thr thr_debug thr_l,)
+GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),$(if $(findstring NO, $(GhcUnregisterised)),thr_p,),)
+
+# We can only build GHCi threaded if we have a threaded RTS:
+GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
+
+# Option flags to pass to GHC when it's compiling modules in
+# fptools/libraries. Typically these are things like -O or
+# -dcore-lint or -H32m. The ones that are *essential* are wired into
+# the build system.
+#
+# -O(2) is pretty desirable, otherwise no inlining of prelude
+# things (incl "+") happens when compiling with this compiler
+#
+# -XGenerics switches on generation of support code for
+# derivable type classes. This is now off by default,
+# but we switch it on for the libraries so that we generate
+# the code in case someone importing wants it
+
+GhcLibHcOpts=-O2 -Rghc-timing -XGenerics
+
+# Win32 only: Enable the RTS and libraries to be built as DLLs
+DLLized=@EnableWin32DLLs@
+
+# Strip local symbols from libraries? This can make the libraries smaller,
+# but makes debugging somewhat more difficult. Doesn't work with all ld's.
+#
+StripLibraries=NO
+
+# These are the URL patterns that Haddock uses to generate the "Source
+# File" links on each page.
+PackageSourceURL = http://darcs.haskell.org/packages/$(PACKAGE)/%{FILE}
+
+# ----------------------------------------------------------------------------
+# Object-file splitting
+#
+# Set SplitObjs=YES or NO in your build.mk
+#
+# Don't use -split-objs in in GhcLibHcOpts, because the build
+# system needs to do other special magic if you are
+# doing object-file splitting
+
+ArchSupportsSplitObjs=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64 powerpc sparc),YES,NO))
+
+# lazy test, so that $(GhcUnregisterised) can be set in build.mk
+SupportsSplitObjs=$(strip $(if $(filter YES,$(ArchSupportsSplitObjs)),\
+ $(if $(filter NO,$(BootingFromHc)),\
+ $(if $(filter NO,$(GhcUnregisterised)),\
+ YES,\
+ NO),\
+ NO),\
+ NO))
+
+# By default, enable SplitObjs for the libraries if this build supports it
+SplitObjs=$(SupportsSplitObjs)
+
+# Math library
+LIBM=@LIBM@
+
+# .NET interop support?
+#
+DotnetSupport=NO
+
+# Build unix package?
+#
+GhcLibsWithUnix=@GhcLibsWithUnix@
+
+# ----------------------------------------------------------------------------
+# Options for GHC's RTS
+
+# For an optimised RTS (you probably don't want to change these; we build
+# a debugging RTS by default now. Use -debug to get it).
+GhcRtsHcOpts=-optc-O2
+GhcRtsCcOpts=-fomit-frame-pointer
+
+# Include the front panel code? Needs GTK+.
+GhcRtsWithFrontPanel = NO
+
+# Include support for CPU performance counters via the PAPI library in the RTS?
+# (PAPI: http://icl.cs.utk.edu/papi/)
+GhcRtsWithPapi = NO
+PapiLibDir=
+PapiIncludeDir=
+
+################################################################################
+#
+# nofib
+#
+# nofib specific options
+#
+################################################################################
+
+WithNofibHc = $(GHC_INPLACE)
+
+# NoFibSubDirs controls which set of tests should be run
+# You can run one or more of
+# imaginary
+# spectral
+# real
+# parallel
+# PRIVATE
+# PENDING
+# UNUSED
+NoFibSubDirs = imaginary spectral real
+
+# The different ways to build nofib. Default is just to mirror
+# what is done for the ghc prelude libraries.
+#
+NoFibWays = $(GhcLibWays)
+
+# Haskell compiler options for nofib
+NoFibHcOpts = -O
+
+# Number of times to run each program
+NoFibRuns = 5
+
+################################################################################
+#
+# Paths (see paths.mk)
+#
+################################################################################
+
+# Directory used by GHC (and possibly other tools) for storing
+# temporary files. If your TMPDIR isn't big enough, either override
+# this in build.mk or set your environment variable "TMPDIR" to point
+# to somewhere with more space. (TMPDIR=. is a good choice).
+
+# DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
+# override an environment variable with the value of the make variable
+# of the same name (if it exists) when executing sub-processes, so
+# setting the TMPDIR env var would have no effect in the build tree.
+
+DEFAULT_TMPDIR = /tmp
+ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
+DEFAULT_TMPDIR = /C/TEMP
+endif
+ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
+DEFAULT_TMPDIR = /C/TEMP
+endif
+
+# FPTOOLS_TOP_ABS: the top of the fptools hierarchy, absolute path.
+# On Windows this is a c:/foo/bar style path.
+FPTOOLS_TOP_ABS = @hardtop@
+
+BIN_DIST_TOPDIR_ABS=$(FPTOOLS_TOP_ABS)
+BIN_DIST_DIR=$(BIN_DIST_TOPDIR_ABS)/$(BIN_DIST_NAME)
+
+BIN_DIST_NAME=ghc-$(ProjectVersion)
+BIN_DIST_TAR=$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
+BIN_DIST_TAR_BZ2=$(BIN_DIST_TAR).bz2
+BIN_DIST_PREP_DIR=$(FPTOOLS_TOP_ABS)/bindist-prep
+BIN_DIST_PREP=$(BIN_DIST_PREP_DIR)/$(BIN_DIST_NAME)
+BIN_DIST_LIST=$(FPTOOLS_TOP_ABS)/bindist-list
+
+# Definition of installation directories, we don't use half of these, but since
+# the configure script has them on offer while passing through, we might as well
+# set them. Note that we have to be careful, because the GNU coding standards
+# have changed a bit over the course of time, and autoconf development reflects
+# this.
+#
+# A little bit of history regarding autoconf and GNU coding standards, use this
+# as a cheat-sheet for the stuff below:
+#
+# variable | default < 2.60 | default >= 2.60
+# ------------+--------------------+--------------------------------------
+# exec_prefix | ${prefix} | ${prefix}
+# libdir | ${exec_prefix}/lib | ${exec_prefix}/lib
+# datarootdir | NONE! | ${prefix}/share
+# datadir | ${prefix}/share | ${datarootdir}
+# infodir | ${prefix}/info | ${datarootdir}/info
+# mandir | ${prefix}/man | ${datarootdir}/man
+# docdir | NONE! | ${datarootdir}/doc/${PACKAGE_TARNAME}
+# htmldir | NONE! | ${docdir}
+# dvidir | NONE! | ${docdir}
+# pdfdir | NONE! | ${docdir}
+# psdir | NONE! | ${docdir}
+#
+# NOTE: The default e.g. ${docdir} above means that autoconf substitutes the
+# string "${docdir}", not the value of docdir! This is crucial for the GNU
+# coding standards.
+
+# This gets used in the default docdir when autoconf >= 2.60 is used
+PACKAGE_TARNAME := @PACKAGE_TARNAME@
+
+prefix := @prefix@
+
+# New autoconf (>= 2.60?) make a configure with a --datarootdir=DIR flag.
+# However, in order to support older autoconf's we don't use it.
+# datarootdir is set lower down instead.
+# But, as datadir is defined in terms of datarootdir, we also need to
+# set it to the value (if any) that configure gives it here.
+datarootdir := @datarootdir@
+
+exec_prefix := @exec_prefix@
+bindir := @bindir@
+datadir0 := @datadir@
+libdir0 := @libdir@
+includedir := @includedir@
+mandir := @mandir@
+dynlibdir := @libdir@
+
+ifeq "$(RelocatableBuild)" "YES"
+
+# Hack: our directory layouts tend to be different on Windows, so
+# hack around configure's bogus assumptions here.
+datarootdir := $(prefix)
+datadir := $(prefix)
+libdir := $(prefix)
+
+docdir := $(prefix)/doc
+htmldir := $(docdir)
+dvidir := $(docdir)
+pdfdir := $(docdir)
+psdir := $(docdir)
+
+else
+
+# Unix: override libdir and datadir to put ghc-specific stuff in
+# a subdirectory with the version number included.
+#
+# datadir is set to libdir here as GHC needs package.conf and unlit
+# to be in the same place (and things like ghc-pkg need to agree on
+# where package.conf is, so we just set it globally).
+#
+datarootdir := $(datadir0)
+libdir := $(libdir0)/ghc-$(ProjectVersion)
+datadir := $(libdir)
+
+# New autoconf (>= 2.60?) make a configure with --docdir=DIR etc flags.
+# However, in order to support older autoconf's we don't use them.
+
+#docdir := @docdir@
+#htmldir := @htmldir@
+#dvidir := @dvidir@
+#pdfdir := @pdfdir@
+#psdir := @psdir@
+
+docdir := $(datarootdir)/doc/ghc
+htmldir := $(docdir)
+dvidir := $(docdir)
+pdfdir := $(docdir)
+psdir := $(docdir)
+
+endif # Windows
+
+headerdir := $(libdir)/include
+
+# Default place for putting interface files is $(libdir)
+# (overriden for packages in package.mk)
+ifacedir = $(libdir)
+
+# NOTE: by intention, libexecdir and libdir point to
+# the same place.
+# => Only way to override this is to set libexecdir= on the command line.
+# (NOTE: configure script setting is ignored).
+libexecdir = $(libdir)
+
+GHC_PKG_PROG = $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/install-inplace/bin/ghc-pkg
+
+#-----------------------------------------------------------------------------
+# install configuration
+
+#
+# Set this to have files installed with a specific owner
+#
+INSTALL_OWNER =
+
+#
+# Set this to have files installed with a specific group
+#
+INSTALL_GROUP =
+
+#
+# Invocations of `install' for the four different classes
+# of targets:
+#
+INSTALL_PROGRAM = $(INSTALL) -m 755
+INSTALL_SCRIPT = $(INSTALL) -m 755
+INSTALL_SHLIB = $(INSTALL) -m 755
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_HEADER = $(INSTALL) -m 644
+INSTALL_MAN = $(INSTALL) -m 644
+INSTALL_DIR = $(MKDIRHIER)
+
+#
+# runhaskell and hsc2hs are special, in that other compilers besides
+# GHC might provide them. Systems with a package manager often come
+# with tools to manage this kind of clash, e.g. RPM's
+# update-alternatives. When building a distribution for such a system,
+# we recommend setting both of the following to 'YES'.
+#
+# NO_INSTALL_RUNHASKELL = YES
+# NO_INSTALL_HSC2HS = YES
+#
+# NB. we use negative tests here because for binary-distributions we cannot
+# test build-time variables at install-time, so they must default to on.
+
+# -----------------------------------------------------------------------------
+# Utilities programs: flags
+
+# If you want to give any standard flags to pretty much any utility
+# (see utils.mk for a complete list), by adding a line here
+#
+# SRC_P_OPTS += ...
+#
+# where P is the utility. For example, to add -O to all Haskell
+# compilations,
+#
+# SRC_HC_OPTS += -O
+
+SRC_HC_OPTS += -H32m -O
+
+# These flags make flex 8-bit
+SRC_FLEX_OPTS += -8
+
+# lint gets all CPP's flags too
+SRC_LINT_OPTS += -axz -DLINT $(SRC_CPP_OPTS)
+WAY$(_way)_LINT_OPTS += WAY$(_way)_CPP_OPTS
+
+# Default fptools options for dllwrap.
+SRC_BLD_DLL_OPTS += --target=i386-mingw32
+
+# Flags for CPP when running GreenCard on .pgc files
+GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__
+
+
+################################################################################
+#
+# Layout of the source tree
+#
+################################################################################
+
+# Here we provide defines for the various directories in the source tree,
+# so we can move things around more easily. A define $(GHC_FOO_DIR_REL)
+# indicates a directory relative to the top of the source tree, whereas
+# $(GHC_FOO_DIR) is a directory relative to the current directory.
+# $(GHC_FOO_DIR_ABS) is the absolute path to the directory.
+
+GHC_UTILS_DIR_REL = utils
+GHC_INCLUDE_DIR_REL = includes
+GHC_COMPILER_DIR_REL = ghc
+GHC_RTS_DIR_REL = rts
+GHC_UTILS_DIR_REL = utils
+GHC_DRIVER_DIR_REL = driver
+GHC_COMPAT_DIR_REL = compat
+
+GHC_MKDEPENDC_DIR_REL = $(GHC_UTILS_DIR_REL)/mkdependC
+GHC_LTX_DIR_REL = $(GHC_UTILS_DIR_REL)/ltx
+GHC_RUNTEST_DIR_REL = $(GHC_UTILS_DIR_REL)/runstdtest
+GHC_LNDIR_DIR_REL = $(GHC_UTILS_DIR_REL)/lndir
+GHC_MKDIRHIER_DIR_REL = $(GHC_UTILS_DIR_REL)/mkdirhier
+GHC_DOCBOOK_DIR_REL = $(GHC_UTILS_DIR_REL)/docbook
+GHC_UNLIT_DIR_REL = $(GHC_UTILS_DIR_REL)/unlit
+GHC_HP2PS_DIR_REL = $(GHC_UTILS_DIR_REL)/hp2ps
+GHC_HSTAGS_DIR_REL = $(GHC_UTILS_DIR_REL)/hasktags
+GHC_GHCTAGS_DIR_REL = $(GHC_UTILS_DIR_REL)/ghctags
+GHC_HSC2HS_DIR_REL = $(GHC_UTILS_DIR_REL)/hsc2hs
+GHC_TOUCHY_DIR_REL = $(GHC_UTILS_DIR_REL)/touchy
+GHC_PKG_DIR_REL = $(GHC_UTILS_DIR_REL)/ghc-pkg
+GHC_GENPRIMOP_DIR_REL = $(GHC_UTILS_DIR_REL)/genprimopcode
+GHC_GENAPPLY_DIR_REL = $(GHC_UTILS_DIR_REL)/genapply
+
+GHC_MANGLER_DIR_REL = $(GHC_DRIVER_DIR_REL)/mangler
+GHC_SPLIT_DIR_REL = $(GHC_DRIVER_DIR_REL)/split
+GHC_SYSMAN_DIR_REL = $(GHC_RTS_DIR_REL)/parallel
+
+INPLACE_DATA_DIR = $(FPTOOLS_TOP_ABS)/inplace-datadir
+
+GHC_UTILS_DIR = $(FPTOOLS_TOP)/$(GHC_UTILS_DIR_REL)
+GHC_INCLUDE_DIR = $(FPTOOLS_TOP)/$(GHC_INCLUDE_DIR_REL)
+GHC_COMPILER_DIR = $(FPTOOLS_TOP)/$(GHC_COMPILER_DIR_REL)
+GHC_RTS_DIR = $(FPTOOLS_TOP)/$(GHC_RTS_DIR_REL)
+GHC_UTILS_DIR = $(FPTOOLS_TOP)/$(GHC_UTILS_DIR_REL)
+GHC_DRIVER_DIR = $(FPTOOLS_TOP)/$(GHC_DRIVER_DIR_REL)
+GHC_COMPAT_DIR = $(FPTOOLS_TOP)/$(GHC_COMPAT_DIR_REL)
+
+GHC_MKDEPENDC_DIR = $(FPTOOLS_TOP)/$(GHC_MKDEPENDC_DIR_REL)
+GHC_LTX_DIR = $(FPTOOLS_TOP)/$(GHC_LTX_DIR_REL)
+GHC_RUNTEST_DIR = $(FPTOOLS_TOP)/$(GHC_RUNTEST_DIR_REL)
+GHC_LNDIR_DIR = $(FPTOOLS_TOP)/$(GHC_LNDIR_DIR_REL)
+GHC_MKDIRHIER_DIR = $(FPTOOLS_TOP)/$(GHC_MKDIRHIER_DIR_REL)
+GHC_DOCBOOK_DIR = $(FPTOOLS_TOP)/$(GHC_DOCBOOK_DIR_REL)
+GHC_UNLIT_DIR = $(FPTOOLS_TOP)/$(GHC_UNLIT_DIR_REL)
+GHC_HP2PS_DIR = $(FPTOOLS_TOP)/$(GHC_HP2PS_DIR_REL)
+GHC_HSTAGS_DIR = $(FPTOOLS_TOP)/$(GHC_HSTAGS_DIR_REL)
+GHC_GHCTAGS_DIR = $(FPTOOLS_TOP)/$(GHC_GHCTAGS_DIR_REL)
+GHC_HSC2HS_DIR = $(FPTOOLS_TOP_ABS)/$(GHC_HSC2HS_DIR_REL)
+GHC_TOUCHY_DIR = $(FPTOOLS_TOP)/$(GHC_TOUCHY_DIR_REL)
+GHC_PKG_DIR = $(FPTOOLS_TOP)/$(GHC_PKG_DIR_REL)
+GHC_GENPRIMOP_DIR = $(FPTOOLS_TOP)/$(GHC_GENPRIMOP_DIR_REL)
+GHC_GENAPPLY_DIR = $(FPTOOLS_TOP)/$(GHC_GENAPPLY_DIR_REL)
+
+GHC_MANGLER_DIR = $(FPTOOLS_TOP)/$(GHC_MANGLER_DIR_REL)
+GHC_SPLIT_DIR = $(FPTOOLS_TOP)/$(GHC_SPLIT_DIR_REL)
+GHC_SYSMAN_DIR = $(FPTOOLS_TOP)/$(GHC_SYSMAN_DIR_REL)
+
+GHC_UTILS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_UTILS_DIR_REL)
+GHC_INCLUDE_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_INCLUDE_DIR_REL)
+GHC_COMPILER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)
+GHC_RTS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_RTS_DIR_REL)
+GHC_UTILS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_UTILS_DIR_REL)
+GHC_DRIVER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_DRIVER_DIR_REL)
+GHC_COMPAT_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_COMPAT_DIR_REL)
+
+GHC_MKDEPENDC_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_MKDEPENDC_DIR_REL)
+GHC_LTX_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_LTX_DIR_REL)
+GHC_RUNTEST_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_RUNTEST_DIR_REL)
+GHC_LNDIR_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_LNDIR_DIR_REL)
+GHC_MKDIRHIER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_MKDIRHIER_DIR_REL)
+GHC_DOCBOOK_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_DOCBOOK_DIR_REL)
+GHC_UNLIT_DIR = $(FPTOOLS_TOP_ABS)/$(GHC_UNLIT_DIR_REL)
+GHC_HP2PS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_HP2PS_DIR_REL)
+GHC_HSTAGS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_HSTAGS_DIR_REL)
+GHC_GHCTAGS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_GHCTAGS_DIR_REL)
+GHC_HSC2HS_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_HSC2HS_DIR_REL)
+GHC_TOUCHY_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_TOUCHY_DIR_REL)
+GHC_PKG_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)
+GHC_GENPRIMOP_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_GENPRIMOP_DIR_REL)
+GHC_GENAPPLY_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_GENAPPLY_DIR_REL)
+GHC_COMPILER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)
+
+GHC_MANGLER_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_MANGLER_DIR_REL)
+GHC_SYSMAN_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_SYSMAN_DIR_REL)
+GHC_SPLIT_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_SPLIT_DIR_REL)
+
+# -----------------------------------------------------------------------------
+# Names of programs in the GHC tree
+#
+# xxx_PGM the name of an executable, without the path
+# xxx the executable relative to the current dir
+
+GHC_UNLIT_PGM = unlit$(exeext)
+GHC_HP2PS_PGM = hp2ps
+GHC_HSTAGS_PGM = hasktags
+GHC_GHCTAGS_INPLACE_PGM = ghctags-inplace
+GHC_HSC2HS_INPLACE_PGM = hsc2hs
+GHC_TOUCHY_PGM = touchy$(exeext)
+GHC_MANGLER_PGM = ghc-asm
+GHC_SPLIT_PGM = ghc-split
+GHC_SYSMAN_PGM = SysMan
+GHC_GENPRIMOP_PGM = genprimopcode
+GHC_GENAPPLY_PGM = genapply
+GHC_MKDEPENDC_PGM = mkdependC
+GHC_LTX_PGM = ltx
+GHC_MKDIRHIER_PGM = mkdirhier
+GHC_LNDIR_PGM = lndir
+GHC_RUNTEST_PGM = runstdtest
+
+ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
+GHC_CP = "xcopy /y"
+GHC_PERL = perl
+else
+GHC_CP = $(CP)
+GHC_PERL = $(PERL)
+endif
+
+UNLIT = $(GHC_UNLIT_DIR)/$(GHC_UNLIT_PGM)
+HP2PS = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM)
+HSTAGS = $(GHC_HSTAGS_DIR)/$(GHC_HSTAGS_PGM)
+GHCTAGS_INPLACE = $(GHC_GHCTAGS_DIR)/$(GHC_GHCTAGS_INPLACE_PGM)
+HSC2HS_INPLACE = $(GHC_HSC2HS_DIR)/install-inplace/bin/$(GHC_HSC2HS_INPLACE_PGM)
+MANGLER = $(GHC_MANGLER_DIR)/$(GHC_MANGLER_PGM)
+SPLIT = $(GHC_SPLIT_DIR)/$(GHC_SPLIT_PGM)
+SYSMAN = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM)
+GHC_PKG_INPLACE = $(GHC_PKG_PROG)
+GENPRIMOP = $(GHC_GENPRIMOP_DIR)/$(GHC_GENPRIMOP_PGM)
+GENAPPLY = $(GHC_GENAPPLY_DIR)/$(GHC_GENAPPLY_PGM)
+MKDEPENDC = $(GHC_MKDEPENDC_DIR)/$(GHC_MKDEPENDC_PGM)
+LTX = $(GHC_LTX_DIR)/$(GHC_LTX_PGM)
+MKDIRHIER = $(GHC_MKDIRHIER_DIR)/$(GHC_MKDIRHIER_PGM)
+LNDIR = $(GHC_LNDIR_DIR)/$(GHC_LNDIR_PGM)
+RUNTEST = $(GHC_RUNTEST_DIR)/$(GHC_RUNTEST_PGM)
+
+GENERATED_FILE = chmod a-w
+EXECUTABLE_FILE = chmod +x
+
+#-----------------------------------------------------------------------------
+# Haskell compilers and mkdependHS
+
+# $(GHC), $(HBC) and $(NHC) point to installed versions of the relevant
+# compilers, if available.
+#
+# $(HC) is a generic Haskell 98 compiler, set to $(GHC) by default.
+# $(MKDEPENDHS) is the Haskell dependency generator (ghc -M).
+#
+# NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
+# (because the version numbers have to be calculated).
+
+GHC = @WithGhc@
+GhcDir = $(dir $(GHC))
+
+# Set to YES if $(GHC) has the editline package installed
+GhcHasEditline = @GhcHasEditline@
+
+HBC = @HBC@
+NHC = @NHC@
+
+# Sometimes we want to invoke ghc from the build tree in different
+# places (eg. it's handy to have a nofib & a ghc build in the same
+# tree). We can refer to "this ghc" as $(GHC_INPLACE):
+
+GHC_INPLACE = $(GHC_STAGE1)
+GHC_STAGE1 = $(GHC_COMPILER_DIR_ABS)/stage1-inplace/ghc
+GHC_STAGE2 = $(GHC_COMPILER_DIR_ABS)/stage2-inplace/ghc
+GHC_STAGE3 = $(GHC_COMPILER_DIR_ABS)/stage3-inplace/ghc
+# XXX All those used to have -no-user-package-conf, but then we can't
+# pass them to Cabal
+
+BOOTSTRAPPING_CONF = $(FPTOOLS_TOP_ABS)/libraries/bootstrapping.conf
+
+# NOTE: add -no-user-package-conf for stage 1-3 above, so that
+# we avoid picking up any packages the user might happen to have
+# installed for this GHC version. They are bound to be incompatible
+# with the packages we built in the tree.
+
+ifeq "$(stage)" "2"
+ UseStage1 = YES
+endif
+ifneq "$(findstring YES, $(UseStage1) $(BootingFromHc))" ""
+
+# We are using the stage1 compiler to compile Haskell code, set up
+# some variables appropriately:
+HC =$(GHC_STAGE1)
+MKDEPENDHS =$(GHC_STAGE1)
+USE_NEW_MKDEPEND_FLAGS = YES
+GhcVersion = @ProjectVersion@
+GhcPatchLevel = @ProjectPatchLevel@
+# oops, these are wrong:
+GhcMajVersion = @GhcMajVersion@
+GhcMinVersion = @GhcMinVersion@
+
+ghc_ge_607 = YES
+ghc_ge_609 = YES
+
+else # not UseStage1 or BootingFromHc
+
+# Some useful GHC version predicates:
+ghc_ge_607 = @ghc_ge_607@
+ghc_ge_609 = @ghc_ge_609@
+
+HC = @WithHc@
+MKDEPENDHS = $(GHC)
+USE_NEW_MKDEPEND_FLAGS = $(ghc_ge_609)
+GhcVersion = @GhcVersion@
+GhcPatchLevel = @GhcPatchLevel@
+GhcMajVersion = @GhcMajVersion@
+GhcMinVersion = @GhcMinVersion@
+
+# We build a few packages using the installed GHC as part of the
+# bootstrapping process. These are installed into a local
+# package.conf file, $(BOOTSTRAPPING_CONF). When we invoke the
+# installed GHC we need to pass it -package-conf $(BOOTSTRAPPING_CONF).
+# So the following variables expand to -package-conf $(BOOTSTRAPPING_CONF)
+# when $(HC) does *not* point to one of the GHC binaries built in
+# the local tree.
+#
+BOOTSTRAPPING_PACKAGE_CONF_HC_OPTS =$(if $(findstring inplace, $(HC)),,-package-conf $(BOOTSTRAPPING_CONF))
+BOOTSTRAPPING_PACKAGE_CONF_MKDEPENDHS_OPTS =$(if $(findstring inplace, $(MKDEPENDHS)),,-package-conf $(BOOTSTRAPPING_CONF))
+endif
+
+# Canonicalised ghc version number, used for easy (integer) version
+# comparisons. We must expand $(GhcMinVersion) to two digits by
+# adding a leading zero if necessary:
+ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
+GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
+else
+GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
+endif
+
+#-----------------------------------------------------------------------------
+# C compiler
+#
+# NB. Don't override $(WhatGccIsCalled) using build.mk, re-configure using
+# the flag --with-gcc=<blah> instead. The reason is that the configure script
+# needs to know which gcc you're using in order to perform its tests.
+
+HaveGcc = @HaveGcc@
+UseGcc = YES
+WhatGccIsCalled = @WhatGccIsCalled@
+GccVersion = @GccVersion@
+ifeq "$(strip $(HaveGcc))" "YES"
+ifneq "$(strip $(UseGcc))" "YES"
+ CC = cc
+else
+ CC = $(WhatGccIsCalled)
+ GccDir = $(dir $(WhatGccIsCalled))
+endif
+endif
+
+# default C compiler flags
+SRC_CC_OPTS = @SRC_CC_OPTS@
+
+ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
+SRC_CC_OPTS += -G0
+endif
+
+SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS)))
+SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
+
+#-----------------------------------------------------------------------------
+# GMP Library (version 2.0.x or above)
+#
+HaveLibGmp = @HaveLibGmp@
+LibGmp = @LibGmp@
+
+GMP_INCLUDE_DIRS=@GMP_INCLUDE_DIRS@
+GMP_LIB_DIRS=@GMP_LIB_DIRS@
+
+#-----------------------------------------------------------------------------
+# GMP framework (Mac OS X)
+#
+HaveFrameworkGMP = @HaveFrameworkGMP@
+
+#-----------------------------------------------------------------------------
+# Mingwex Library
+#
+HaveLibMingwEx = @HaveLibMingwEx@
+
+#-----------------------------------------------------------------------------
+# Flex (currently unused, could be moved to glafp-utils)
+
+# FLEX = @LEX@
+# Don't bother with -lfl, we define our own yywrap()s anyway.
+# FLEX_LIB =
+#WAS:FLEX_LIB = @LEXLIB@
+
+#-----------------------------------------------------------------------------
+# Other standard (ha!) Unix utilities
+
+AR = @ArCmd@
+ArSupportsInput = @ArSupportsInput@
+# Yuckage: for ghc/utils/parallel -- todo: nuke this dependency!!
+BASH = /usr/local/bin/bash
+
+CONTEXT_DIFF = @ContextDiffCmd@
+CP = cp
+CPP = @CPP@ @CPPFLAGS@
+CTAGS = $(ETAGS)
+#
+# RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
+# behave plausibly on Haskell sources.
+#
+RAWCPP_FLAGS = -undef -traditional
+FIND = @FindCmd@
+SORT = @SortCmd@
+INSTALL = @INSTALL@
+#
+# Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
+# install-sh script (if chosen). This not terribly useful to us, so we convert
+# it into an abs. path.
+#
+INSTALL := $(subst .././install-sh,$(FPTOOLS_TOP_ABS)/install-sh,$(INSTALL))
+LATEX = latex
+HEVEA = hevea
+HACHA = hacha
+LN_S = @LN_S@
+MANMACROS = -man
+MSMACROS = -ms
+MV = mv
+NROFF = nroff
+PERL = @PerlCmd@
+PYTHON = @PythonCmd@
+PIC = pic
+PREPROCESSCMD = $(CC) -E
+RANLIB = @RANLIB@
+RM = rm -f
+SED = @SedCmd@
+SHELL = /bin/sh
+
+LD = @LdCmd@
+
+# Some ld's support the -x flag and some don't, so the configure
+# script detects which we have and sets LdXFlag to "-x" or ""
+# respectively.
+LD_X = @LdXFlag@
+
+# GNU ld supports input via a linker script, which is useful to avoid
+# overflowing command-line length limits.
+LdIsGNULd = @LdIsGNULd@
+
+#
+# In emergency situations, REAL_SHELL is used to perform shell commands
+# from within the ghc driver script, by scribbling the command line to
+# a temp file and then having $(REAL_SHELL) execute it.
+#
+# The reason for having to do this is that overly long command lines
+# cause unnecessary trouble with some shells (e.g., /bin/sh on Solaris
+# 2.5.1), which is why this backdoor is provided. The situation of overly
+# long command lines is either encountered while doing `make boot' in compiler/,
+# or when linking the compiler binary (`hsc').
+#
+# We do not use SHELL to execute long commands, as `make' will more than likely
+# override whatever setting you have in your environment while executing.
+
+# By default, REAL_SHELL is set equal to SHELL, which is not really a smart move
+# as it is SHELL that will show up the bogosity in the first place, but setting
+# it to anything else isn't really portable.
+#
+# ====> If long command lines cause you trouble, invoke `ghc' (via `make' or otherwise)
+# with REAL_SHELL set to something else than /bin/sh, for instance, your favourite
+# command shell.
+#
+REAL_SHELL=$(SHELL)
+SIZE = size
+STRIP = strip
+TAR = @TarCmd@
+ZIP = zip
+
+HSCOLOUR = @HSCOLOUR@
+
+#
+# This is special to literate/, ToDo: add literate-specific
+# configure setup to literate/.
+#
+TBL = tbl
+TEX = tex
+TGRIND = tgrind
+TGRIND_HELPER = /usr/local/lib/tgrind/tfontedpr # XXX
+TIB = tib
+
+TIME = @TimeCmd@
+TROFF = troff
+UNAME = uname
+
+# GTK+
+GTK_CONFIG = @GTK_CONFIG@
+
+# Set this if you want to use Inno Setup to build a Windows installer
+# when you make a bindist
+ISCC =
+
+#-----------------------------------------------------------------------------
+# DocBook XML stuff
+
+XSLTPROC = @XsltprocCmd@
+XMLLINT = @XmllintCmd@
+FOP = @FopCmd@
+XMLTEX = @XmltexCmd@
+PDFXMLTEX = @PdfxmltexCmd@
+DVIPS = @DvipsCmd@
+
+DIR_DOCBOOK_XSL = @DIR_DOCBOOK_XSL@
+
+XSLTPROC_LABEL_OPTS = --stringparam toc.section.depth 3 \
+ --stringparam section.autolabel 1 \
+ --stringparam section.label.includes.component.label 1
+
+#-----------------------------------------------------------------------------
+# FPtools support software
+
+BLD_DLL = dllwrap
+
+#
+# .NET support software
+#
+ILX2IL = ilx2il
+ILASM = ilasm
+
+#
+# ghc-pkg
+#
+GHC_PKG = @GhcPkgCmd@
+
+#
+# GreenCard
+#
+GREENCARD = @GreenCardCmd@
+GREENCARD_VERSION = @GreenCardVersion@
+
+#
+# Happy
+#
+HAPPY = @HappyCmd@
+HAPPY_VERSION = @HappyVersion@
+#
+# Options to pass to Happy when we're going to compile the output with GHC
+#
+GHC_HAPPY_OPTS = -agc --strict
+
+# Temp. to work around performance problems in the HEAD around 8/12/2003,
+# A Happy compiled with this compiler needs more stack.
+SRC_HAPPY_OPTS = +RTS -K2m -RTS
+
+#
+# Alex
+#
+ALEX = @AlexCmd@
+ALEX_VERSION = @AlexVersion@
+#
+# Options to pass to Happy when we're going to compile the output with GHC
+#
+GHC_ALEX_OPTS = -g
+
+# Should we build haddock docs?
+HADDOCK_DOCS = YES
+# And HsColour the sources?
+ifeq "$(HSCOLOUR)" ""
+HSCOLOUR_SRCS = NO
+else
+HSCOLOUR_SRCS = YES
+endif
+
+#
+# Options for compiling in different `ways'.
+#
+# To configure up your own way, have a look at some of the standard ways
+# such as profiling, and create your own set of WAY_*_OPTS defs below.
+# After having done that, add your way string to WAYS, and after having
+# run the configure script, the different projects will add the new way
+# to the list of ways they support.
+#
+
+#
+# Definitions of the different ways:
+#
+# * their name:
+# - tag, e.g., p
+# - description, e.g., profiling
+# * what they mean to the driver:
+# - WAY_p_HC_OPTS gives the list of command-line options
+# to the driver.
+#
+
+#
+# The ways currently defined.
+#
+ALL_WAYS=p t s mp mg a b c d e f g h i j k l m n o A B
+USER_WAYS=a b c d e f g h j k l m n o A B
+
+#
+# The following ways currently have treated specially, p t mg,
+# as the driver script treats these guys specially and needs to carefully be told
+# about the options for these. Hence, we hide the required command line options
+# for these in the driver, as this is the only place they are needed.
+#
+# If you want to add to these default options, fill in the variables below:
+
+# Way 'i':
+WAY_i_NAME=ILX
+WAY_i_HC_OPTS= -filx -fruntime-types
+
+# Way 'p':
+WAY_p_NAME=profiling
+WAY_p_HC_OPTS= -prof
+
+# Way 't':
+WAY_t_NAME=ticky-ticky profiling
+WAY_t_HC_OPTS= -ticky
+
+# Way 'l':
+WAY_l_NAME=event logging
+WAY_l_HC_OPTS= -eventlog
+
+# Way `mp':
+WAY_mp_NAME=parallel
+WAY_mp_HC_OPTS=-parallel
+
+# Way `mg':
+WAY_mg_NAME=GranSim
+WAY_mg_HC_OPTS=-gransim
+
+#
+# These ways apply to the RTS only:
+#
+
+# Way 'thr':
+WAY_thr_NAME=threaded
+WAY_thr_HC_OPTS=-optc-DTHREADED_RTS
+
+# Way 'thr_p':
+WAY_thr_p_NAME=threaded profiled
+WAY_thr_p_HC_OPTS=-optc-DTHREADED_RTS -prof
+
+# Way 'thr_l':
+WAY_thr_l_NAME=threaded event logging
+WAY_thr_l_HC_OPTS=-optc-DTHREADED_RTS -eventlog
+
+# Way 'debug':
+WAY_debug_NAME=debug
+WAY_debug_HC_OPTS=-optc-DDEBUG
+
+# Way 'debug_p':
+WAY_debug_p_NAME=debug profiled
+WAY_debug_p_HC_OPTS=-optc-DDEBUG -prof
+
+# Way 'debug_t':
+WAY_debug_t_NAME=debug ticky-ticky profiling
+WAY_debug_t_HC_OPTS= -ticky -optc-DDEBUG
+
+# Way 'thr_debug':
+WAY_thr_debug_NAME=threaded
+WAY_thr_debug_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG
+
+# Way 'thr_debug_p':
+WAY_thr_debug_p_NAME=threaded debug profiling
+WAY_thr_debug_p_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG -prof
+
+# Way 'thr_debug_l':
+WAY_thr_debug_l_NAME=threaded debug event logging
+WAY_thr_debug_l_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG -eventlog
+
+# Way 'dyn': build dynamic shared libraries
+WAY_dyn_NAME=dyn
+WAY_dyn_HC_OPTS=-fPIC -dynamic
+WAY_dyn_LIB_TARGET=libHSrts-gcc661.so
+
+# Way 'thr_dyn':
+WAY_thr_dyn_NAME=thr_dyn
+WAY_thr_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS
+
+# Way 'thr_debug_dyn':
+WAY_thr_debug_dyn_NAME=thr_dyn
+WAY_thr_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS -optc-DDEBUG
+
+# Way 'debug_dyn':
+WAY_debug_dyn_NAME=thr_dyn
+WAY_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DDEBUG
+
+#
+# Add user-way configurations here:
+#
+WAY_A_NAME=
+WAY_A_HC_OPTS=
+
+WAY_B_NAME=
+WAY_B_HC_OPTS=
+
+WAY_a_NAME=
+WAY_a_HC_OPTS=
+
+WAY_b_NAME=
+WAY_b_HC_OPTS=
+
+WAY_c_NAME=
+WAY_c_HC_OPTS=
+
+WAY_d_NAME=
+WAY_d_HC_OPTS=
+
+WAY_e_NAME=
+WAY_e_HC_OPTS=
+
+WAY_f_NAME=
+WAY_f_HC_OPTS=
+
+WAY_g_NAME=
+WAY_g_HC_OPTS=
+
+WAY_h_NAME=
+WAY_h_HC_OPTS=
+
+WAY_j_NAME=
+WAY_j_HC_OPTS=
+
+WAY_k_NAME=
+WAY_k_HC_OPTS=
+
+WAY_l_NAME=
+WAY_l_HC_OPTS=
+
+WAY_m_NAME=
+WAY_m_HC_OPTS=
+
+WAY_n_NAME=
+WAY_n_HC_OPTS=
+
+WAY_o_NAME=
+WAY_o_HC_OPTS=
+
+################################################################################
+#
+# 31-bit-Int Core files
+#
+################################################################################
+
+#
+# It is possible to configure the compiler and prelude to support 31-bit
+# integers, suitable for a back-end and RTS using a tag bit on a 32-bit
+# architecture. Currently the only useful output from this option is external Core
+# files. The following additions to your build.mk will produce the
+# 31-bit core output. Note that this is *not* just a library "way"; the
+# compiler must be built a special way too.
+
+# GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
+# GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
+# GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
+# SplitObjs=NO
+
+################################################################################
+#
+# Library configure arguments
+#
+################################################################################
+
+CONFIGURE_ARGS = @CONFIGURE_ARGS@
+
+################################################################################
+#
+# Bindist testing directory
+#
+################################################################################
+
+ifeq "$(Windows)" "YES"
+BIN_DIST_INST_SUBDIR = "install dir"
+else
+# I very much doubt that paths with spaces will work on Unix
+BIN_DIST_INST_SUBDIR = installed
+endif
+
+BIN_DIST_INST_DIR = $(FPTOOLS_TOP_ABS)/bindisttest/$(BIN_DIST_INST_SUBDIR)
+
+++ /dev/null
-#################################################################################
-#
-# opts.mk
-#
-# This file defines Make variables for the
-# option flags for each utility program
-#
-# $Id: opts.mk,v 1.36 2004/08/26 20:08:54 panne Exp $
-#
-#################################################################################
-
-#
-# N.B. This is *NOT* the place to put extra options of ANY SORT!
-#
-
-# Exports: Define P_OPTS for the most important utility programs, P, namely
-#
-# AR AS CPP CTAGS C FLEX HC HSTAGS LD LINT
-# LIT2CHANGELOG LIT2HTML LIT2LATEX LIT2PGM
-# MKDEPENDC MKDEPENDHS MKDEPENDLIT RUNTEST
-# UNLIT
-
-
-# For each such utility program P, this file defines
-#
-# $(P) The pathname to invoke the utility
-# P_OPTS Options to pass to P
-#
-# P_OPTS is always defined like this:
-#
-# P_OPTS = SRC_P_OPTS WAY$(_way)_P_OPTS EXTRA_P_OPTS
-#
-# where the variables on the right hand side are set by the user or
-# some other Makefile. They have the following intended uses:
-#
-# SRC_P_OPTS Source-tree options for P
-# WAY$(_way)_P_OPTS Source-tree options for P specific to $(way)
-# EXTRA_P_OPTS Command-line options for P
-#
-# and for some programs
-#
-# $(HcFlavour)_P_OPTS Compiler-specific options for P
-# $($*_P_OPTS) Target specific options for P
-#
-# All these options should be set with
-# thing += extra-options
-# in case someone higher up the include hierarchy has already added some
-
-# Which class of compiler are we aiming at? (GHC, NHC or HUGS)
-ifeq "$(HcFlavour)" ""
-HcFlavour = GHC
-endif
-
-#################################################################################
-#
-# Absolutely standard glue
-#
-#################################################################################
-
-# All the standard gluing together, as in the comment right at the front
-
-
-HC_OPTS = $(BOOTSTRAPPING_PACKAGE_CONF_HC_OPTS) $(SRC_HC_OPTS) $(WAY$(_way)_HC_OPTS) $($*_HC_OPTS) $(EXTRA_HC_OPTS)
-HC_POST_OPTS = $(SRC_HC_POST_OPTS) $(WAY$(_way)_HC_POST_OPTS) $($*_HC_POST_OPTS) $(EXTRA_HC_POST_OPTS)
-HC_PRE_OPTS = $(SRC_HC_PRE_OPTS) $(WAY$(_way)_HC_PRE_OPTS) $($*_HC_PRE_OPTS) $(EXTRA_HC_PRE_OPTS)
-
-ILX2IL_OPTS = $(SRC_ILX2IL_OPTS) $(WAY$(_way)_ILX2IL_OPTS) $($*_ILX2IL_OPTS) $(EXTRA_ILX2IL_OPTS)
-ILASM_OPTS = $(SRC_ILASM_OPTS) $(WAY$(_way)_ILASM_OPTS) $($*_ILASM_OPTS) $(EXTRA_ILASM_OPTS)
-
-RUNTEST_OPTS = $(SRC_RUNTEST_OPTS) $(WAY$(_way)_RUNTEST_OPTS) \
- $($*_RUNTEST_OPTS) $(EXTRA_RUNTEST_OPTS)
-
-ALEX_OPTS = $(SRC_ALEX_OPTS) $($(HcFlavour)_ALEX_OPTS) $(WAY$(_way)_ALEX_OPTS) $($*_ALEX_OPTS) $(EXTRA_ALEX_OPTS)
-AR_OPTS = $(SRC_AR_OPTS) $(WAY$(_way)_AR_OPTS) $(EXTRA_AR_OPTS)
-AS_OPTS = $(SRC_AS_OPTS) $(WAY$(_way)_AS_OPTS) $(EXTRA_AS_OPTS)
-BLD_DLL_OPTS = $(SRC_BLD_DLL_OPTS) $(WAY$(_way)_BLD_DLL_OPTS) $($*_HC_OPTS) $(EXTRA_BLD_DLL_OPTS)
-CPP_OPTS = $(SRC_CPP_OPTS) $(WAY$(_way)_CPP_OPTS) $(EXTRA_CPP_OPTS)
-CTAGS_OPTS = $(SRC_CTAGS_OPTS) $(WAY$(_way)_CTAGS_OPTS) $(EXTRA_CTAGS_OPTS)
-CC_OPTS = $(SRC_CC_OPTS) $(WAY$(_way)_CC_OPTS) $($*_CC_OPTS) $(EXTRA_CC_OPTS)
-FLEX_OPTS = $(SRC_FLEX_OPTS) $(WAY$(_way)_FLEX_OPTS) $(EXTRA_FLEX_OPTS)
-HADDOCK_OPTS = $(SRC_HADDOCK_OPTS) $(WAY$(_way)_HADDOCK_OPTS) $($*_HADDOCK_OPTS) $(EXTRA_HADDOCK_OPTS)
-HAPPY_OPTS = $(SRC_HAPPY_OPTS) $($(HcFlavour)_HAPPY_OPTS) $(WAY$(_way)_HAPPY_OPTS) $($*_HAPPY_OPTS) $(EXTRA_HAPPY_OPTS)
-GC_OPTS = $(SRC_GC_OPTS) $(WAY$(_way)_GC_OPTS) $($*_GC_OPTS) $(EXTRA_GC_OPTS)
-HSTAGS_OPTS = $(SRC_HSTAGS_OPTS) $(WAY$(_way)_HSTAGS_OPTS) $(EXTRA_HSTAGS_OPTS)
-HSC2HS_OPTS = $(SRC_HSC2HS_OPTS) $($(HcFlavour)_HSC2HS_OPTS) $(WAY$(_way)_HSC2HS_OPTS) $(EXTRA_HSC2HS_OPTS)
-INSTALL_OPTS = $(SRC_INSTALL_OPTS) $(WAY$(_way)_INSTALL_OPTS) $(EXTRA_INSTALL_OPTS)
-INSTALL_BIN_OPTS = $(INSTALL_OPTS) $(SRC_INSTALL_BIN_OPTS)
-LD_OPTS = $(SRC_LD_OPTS) $(WAY$(_way)_LD_OPTS) $(EXTRA_LD_OPTS)
-LINT_OPTS = $(SRC_LINT_OPTS) $(WAY$(_way)_LINT_OPTS) $(EXTRA_LINT_OPTS)
-HEVEA_OPTS = $(SRC_HEVEA_OPTS) $(WAY$(_way)_HEVEA_OPTS) $(EXTRA_HEVEA_OPTS)
-HACHA_OPTS = $(SRC_HACHA_OPTS) $(WAY$(_way)_HACHA_OPTS) $(EXTRA_HACHA_OPTS)
-LIT2CHANGELOG_OPTS = $(SRC_LIT2CHANGELOG_OPTS) $(WAY$(_way)_LIT2CHANGELOG_OPTS) \
- $(EXTRA_LIT2CHANGELOG_OPTS)
-LIT2HTML_OPTS = $(SRC_LIT2HTML_OPTS) $(WAY$(_way)_LIT2HTML_OPTS) $(EXTRA_LIT2HTML_OPTS)
-LIT2LATEX_OPTS = $(SRC_LIT2LATEX_OPTS) $(WAY$(_way)_LIT2LATEX_OPTS) $(EXTRA_LIT2LATEX_OPTS)
-LIT2PGM_OPTS = $(SRC_LIT2PGM_OPTS) $(WAY$(_way)_LIT2PGM_OPTS) $(EXTRA_LIT2PGM_OPTS)
-MKDEPENDC_OPTS = $(SRC_MKDEPENDC_OPTS) $(WAY$(_way)_MKDEPENDC_OPTS) $(EXTRA_MKDEPENDC_OPTS)
-MKDEPENDHS_OPTS = $(BOOTSTRAPPING_PACKAGE_CONF_MKDEPENDHS_OPTS) \
- $(SRC_MKDEPENDHS_OPTS) $(WAY$(_way)_MKDEPENDHS_OPTS) \
- $(EXTRA_MKDEPENDHS_OPTS)
-MKDEPENDLIT_OPTS = $(SRC_MKDEPENDLIT_OPTS) $(WAY$(_way)_MKDEPENDLIT_OPTS) \
- $(EXTRA_MKDEPENDLIT_OPTS)
-XSLTPROC_OPTS = $(WAY$(_way)_XSLTPROC_OPTS) $(EXTRA_XSLTPROC_OPTS)
-FOP_OPTS = $(WAY$(_way)_FOP_OPTS) $(EXTRA_FOP_OPTS)
-UNLIT_OPTS = $(SRC_UNLIT_OPTS) $(WAY$(_way)_UNLIT_OPTS) $(EXTRA_UNLIT_OPTS)
-ZIP_OPTS = $(SRC_ZIP_OPTS) $(EXTRA_ZIP_OPTS)
-
-# Version of CC_OPTS to use when GHC is the C compiler
-GHC_CC_OPTS = $(addprefix -optc, $(CC_OPTS)) $(HC_OPTS)
+++ /dev/null
-# -----------------------------------------------------------------------------
-# $Id: package.mk,v 1.55 2005/05/13 10:05:33 krasimir Exp $
-
-ifneq "$(PACKAGE)" ""
-
-# -----------------------------------------------------------------------------
-# Directory layouts, installation etc.
-
-# Here Windows & Unix differ. On Windows, the value of $(prefix) is known
-# to the compiler, and spliced into package.conf in place of $topdir at
-# runtime.
-#
-# On Unix, we only use absolute paths in package.conf.
-#
-
-ifeq "$(Windows)" "YES"
-
-PKG_LIBDIR = $$topdir
-PKG_DATADIR = $$topdir
-
-else
-
-PKG_LIBDIR = $(libdir)
-PKG_DATADIR = $(datadir)
-
-endif # Unix
-
-IMPORT_DIR_INSTALLED = $(PKG_LIBDIR)/imports
-IMPORT_DIR_INPLACE = $(FPTOOLS_TOP_ABS)/libraries/$(PACKAGE)
-
-INCLUDE_DIR_INSTALLED = $(PKG_LIBDIR)/include
-INCLUDE_DIR_INPLACE = $(FPTOOLS_TOP_ABS)/libraries/$(PACKAGE)/include
-
-LIB_DIR_INSTALLED = $(PKG_LIBDIR)
-LIB_DIR_INPLACE = $(FPTOOLS_TOP_ABS)/libraries/$(PACKAGE)
-
-DATA_DIR_INSTALLED = $(PKG_DATADIR)
-DATA_DIR_INPLACE = $(FPTOOLS_TOP_ABS)/libraries/$(PACKAGE)
-
-HTML_DIR_INPLACE = $(FPTOOLS_TOP_ABS)/libraries/$(PACKAGE)/html
-HTML_DIR_INSTALLED = $(PKG_DATADIR)/html/libraries/$(PACKAGE)
-
-HADDOCK_IFACE_INPLACE = $(HTML_DIR_INPLACE)/$(PACKAGE).haddock
-HADDOCK_IFACE_INSTALLED = $(HTML_DIR_INSTALLED)/$(PACKAGE).haddock
-
-# -----------------------------------------------------------------------------
-# Build the package configuration file and tell the compiler about it.
-
-# We want to build two versions of the package configuration: one for use
-# in the
-
-ifeq "$(way)" ""
-
-PACKAGE_CPP_OPTS += -I$(GHC_INCLUDE_DIR) -Iinclude
-
-PACKAGE_CPP_OPTS += -DPACKAGE=${PACKAGE}
-PACKAGE_CPP_OPTS += -DVERSION=${VERSION}
-
-PACKAGE_CPP_OPTS += -DPKG_LIBDIR='"$(PKG_LIBDIR)"'
-PACKAGE_CPP_OPTS += -DPKG_DATADIR='"$(PKG_DATADIR)"'
-
-package.conf.inplace : package.conf.in
- $(CPP) $(RAWCPP_FLAGS) -P \
- -DIMPORT_DIR='"$(IMPORT_DIR_INPLACE)"' \
- -DLIB_DIR='"$(LIB_DIR_INPLACE)"' \
- -DINCLUDE_DIR='"$(INCLUDE_DIR_INPLACE)"' \
- -DDATA_DIR='"$(DATA_DIR_INPLACE)"' \
- -DHTML_DIR='"$(HTML_DIR_INPLACE)"' \
- -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INPLACE)"' \
- -DFPTOOLS_TOP_ABS='"${FPTOOLS_TOP_ABS}"' \
- -x c $(PACKAGE_CPP_OPTS) $< | \
- grep -v '^#pragma GCC' | \
- sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$@