diff options
author | Ian Lynagh <igloo@earth.li> | 2009-04-26 11:42:15 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-04-26 11:42:15 +0000 |
commit | 34cc75e1a62638f2833815746ebce0a9114dc26b (patch) | |
tree | ef21e8fd7af1356beea9cce7d6efb8a65374e24c /mk | |
parent | 74e1368d4688ee16f6decdf2cd3ebe27506b26ba (diff) | |
download | haskell-34cc75e1a62638f2833815746ebce0a9114dc26b.tar.gz |
GHC new build system megapatch
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bindist.mk | 45 | ||||
-rw-r--r-- | mk/boilerplate.mk | 82 | ||||
-rw-r--r-- | mk/build.mk.sample | 8 | ||||
-rw-r--r-- | mk/cabal-flags.mk | 129 | ||||
-rw-r--r-- | mk/cabal.mk | 68 | ||||
-rw-r--r-- | mk/config.mk.in | 459 | ||||
-rw-r--r-- | mk/custom-settings.mk | 8 | ||||
-rw-r--r-- | mk/install.mk | 307 | ||||
-rw-r--r-- | mk/old-config.mk.in | 1416 | ||||
-rw-r--r-- | mk/opts.mk | 109 | ||||
-rw-r--r-- | mk/package.mk | 315 | ||||
-rw-r--r-- | mk/paths.mk | 277 | ||||
-rw-r--r-- | mk/project.mk.in | 143 | ||||
-rw-r--r-- | mk/recurse.mk | 101 | ||||
-rw-r--r-- | mk/sub-makefile.mk | 34 | ||||
-rw-r--r-- | mk/suffix.mk | 392 | ||||
-rw-r--r-- | mk/target.mk | 701 | ||||
-rw-r--r-- | mk/validate-settings.mk | 4 |
18 files changed, 1722 insertions, 2876 deletions
diff --git a/mk/bindist.mk b/mk/bindist.mk deleted file mode 100644 index c4ef66e290..0000000000 --- a/mk/bindist.mk +++ /dev/null @@ -1,45 +0,0 @@ - -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 - diff --git a/mk/boilerplate.mk b/mk/boilerplate.mk deleted file mode 100644 index 0e7e752020..0000000000 --- a/mk/boilerplate.mk +++ /dev/null @@ -1,82 +0,0 @@ -################################################################################# -# -# 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 diff --git a/mk/build.mk.sample b/mk/build.mk.sample index 911f5025ec..7368a22224 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -25,6 +25,8 @@ # 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" @@ -36,7 +38,7 @@ GhcStage1HcOpts = -O -fasm GhcStage2HcOpts = -O2 -fasm GhcHcOpts = -Rghc-timing GhcLibHcOpts = -O2 -XGenerics -GhcLibWays = p +GhcLibWays += p endif @@ -48,7 +50,6 @@ SRC_HC_OPTS = -H64m -O0 -fasm GhcStage1HcOpts = -O -fasm GhcStage2HcOpts = -O0 -fasm GhcLibHcOpts = -O0 -fasm -GhcLibWays = SplitObjs = NO endif @@ -61,7 +62,6 @@ SRC_HC_OPTS = -H64m -O0 -fasm GhcStage1HcOpts = -O -fasm GhcStage2HcOpts = -O0 -fasm GhcLibHcOpts = -O -fasm -GhcLibWays = SplitObjs = NO endif @@ -72,7 +72,6 @@ ifeq "$(BuildFlavour)" "devel1" 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 @@ -85,7 +84,6 @@ ifeq "$(BuildFlavour)" "devel2" 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 diff --git a/mk/cabal-flags.mk b/mk/cabal-flags.mk deleted file mode 100644 index 253a1e3f1f..0000000000 --- a/mk/cabal-flags.mk +++ /dev/null @@ -1,129 +0,0 @@ - -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 - diff --git a/mk/cabal.mk b/mk/cabal.mk deleted file mode 100644 index 3d525d7739..0000000000 --- a/mk/cabal.mk +++ /dev/null @@ -1,68 +0,0 @@ - -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 - diff --git a/mk/config.mk.in b/mk/config.mk.in index b83fb925dd..980e493f01 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -32,123 +32,11 @@ $(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 -# -################################################################################ +# 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 ################################################################################ # @@ -156,22 +44,6 @@ BuildVendor_CPP = @BuildVendor_CPP@ # ################################################################################ -# 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@ @@ -360,14 +232,13 @@ HscIfaceFileVersion=6 # 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" @@ -422,7 +293,7 @@ GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO) # 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@ @@ -543,19 +414,15 @@ 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_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 @@ -609,8 +476,8 @@ 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) +datadir := $(prefix)/lib +libdir := $(prefix)/lib docdir := $(prefix)/doc htmldir := $(docdir) @@ -660,8 +527,6 @@ ifacedir = $(libdir) # (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 @@ -718,10 +583,6 @@ 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 @@ -736,120 +597,62 @@ GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__ ################################################################################ # 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" @@ -859,23 +662,32 @@ 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) +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 @@ -891,7 +703,14 @@ 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 @@ -905,63 +724,31 @@ NHC = @NHC@ # 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 @@ -988,7 +775,6 @@ ifneq "$(strip $(UseGcc))" "YES" CC = cc else CC = $(WhatGccIsCalled) - GccDir = $(dir $(WhatGccIsCalled)) endif endif @@ -1054,7 +840,7 @@ INSTALL = @INSTALL@ # 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 @@ -1108,6 +894,7 @@ LdIsGNULd = @LdIsGNULd@ REAL_SHELL=$(SHELL) SIZE = size STRIP = strip +PATCH = @PatchCmd@ TAR = @TarCmd@ ZIP = zip @@ -1156,12 +943,6 @@ XSLTPROC_LABEL_OPTS = --stringparam toc.section.depth 3 \ BLD_DLL = dllwrap # -# .NET support software -# -ILX2IL = ilx2il -ILASM = ilasm - -# # ghc-pkg # GHC_PKG = @GhcPkgCmd@ @@ -1180,11 +961,11 @@ HAPPY_VERSION = @HappyVersion@ # # 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 @@ -1194,7 +975,7 @@ ALEX_VERSION = @AlexVersion@ # # 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 @@ -1229,7 +1010,7 @@ endif # # 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 # @@ -1240,9 +1021,9 @@ 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 @@ -1412,5 +1193,5 @@ else 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) diff --git a/mk/custom-settings.mk b/mk/custom-settings.mk index 1a01873d31..75c9d8940f 100644 --- a/mk/custom-settings.mk +++ b/mk/custom-settings.mk @@ -1,9 +1,9 @@ --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 diff --git a/mk/install.mk b/mk/install.mk deleted file mode 100644 index 1efb6958ef..0000000000 --- a/mk/install.mk +++ /dev/null @@ -1,307 +0,0 @@ -# -# 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 - diff --git a/mk/old-config.mk.in b/mk/old-config.mk.in new file mode 100644 index 0000000000..b83fb925dd --- /dev/null +++ b/mk/old-config.mk.in @@ -0,0 +1,1416 @@ +# -*-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) + diff --git a/mk/opts.mk b/mk/opts.mk deleted file mode 100644 index 08ec4b60a2..0000000000 --- a/mk/opts.mk +++ /dev/null @@ -1,109 +0,0 @@ -################################################################################# -# -# 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) diff --git a/mk/package.mk b/mk/package.mk deleted file mode 100644 index 079e4f6a53..0000000000 --- a/mk/package.mk +++ /dev/null @@ -1,315 +0,0 @@ -# ----------------------------------------------------------------------------- -# $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' >$@ - -install:: - $(CPP) $(RAWCPP_FLAGS) -P -DINSTALLING \ - -DIMPORT_DIR='"$(IMPORT_DIR_INSTALLED)"' \ - -DLIB_DIR='"$(LIB_DIR_INSTALLED)"' \ - -DINCLUDE_DIR='"$(INCLUDE_DIR_INSTALLED)"' \ - -DDATA_DIR='"$(DATA_DIR_INSTALLED)"' \ - -DHTML_DIR='"$(HTML_DIR_INSTALLED)"' \ - -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INSTALLED)"' \ - -I../includes \ - -x c $(PACKAGE_CPP_OPTS) package.conf.in \ - | grep -v '^#pragma GCC' \ - | sed -e 's/""//g' -e 's/:[ ]*,/: /g' \ - | $(GHC_PKG_INSTALL_PROG) --global-conf $(DESTDIR)$(datadir)/package.conf update - --force - -GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-install/build/ghc-pkg/ghc-pkg - -# we could be more accurate here and add a dependency on -# driver/package.conf, but that doesn't work too well because of -# make's limited accuracy with modification times: when doing 'make -# boot' in multiple packages, make won't detect that the package -# configuration needs updating if it was updated already in the last -# second. -# -# The stamp file goes in $(GHC_DRIVER_DIR), so that if someone happens -# to 'make clean' in ghc without cleaning in libraries too, the packages -# will be correctly re-installed. -# - -STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE) -CLEAN_FILES += $(STAMP_PKG_CONF) - -ifneq "$(BootingFromHc)" "YES" -boot all :: $(STAMP_PKG_CONF) -endif - -$(STAMP_PKG_CONF) : package.conf.inplace - $(GHC_PKG_INPLACE) update - --force-files <package.conf.inplace - @touch $(STAMP_PKG_CONF) - -CLEAN_FILES += package.conf.inplace - -endif # $(way) == "" - -# ----------------------------------------------------------------------------- -# Building the static library libHS<pkg>.a - -SRC_HSC2HS_OPTS += -I. - -ifneq "$(NO_SET_HC)" "YES" -HC = $(GHC_INPLACE) -BOOTSTRAPPING_PACKAGE_CONF_HC_OPTS = -endif -IGNORE_PACKAGE_FLAG = -package-name $(PACKAGE)-$(VERSION) - -ifeq "$(NON_HS_PACKAGE)" "" -SRC_HC_OPTS += $(IGNORE_PACKAGE_FLAG) -SRC_HC_OPTS += $(GhcLibHcOpts) -SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS)) -endif - -# -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. -ifeq "$(NON_HS_PACKAGE)" "" -SRC_HC_OPTS += -XGenerics -endif - -ifndef DONT_WANT_STD_LIBRARY -ifndef LIBRARY -ifeq "$(_way:%_dyn=YES)" "YES" -LIBRARY = libHS$(PACKAGE)$(_way:%_dyn=%)-ghc$(ProjectVersion)$(soext) -else -LIBRARY = libHS$(PACKAGE)$(_way).a -endif -endif -endif - -ifeq "$(WAYS)" "" -WAYS = $(GhcLibWays) -endif - -ifdef LIBRARY -all :: $(LIBRARY) - -# POSSIBLE alternative version using --make: -# -# lib : $(HS_SRCS) -# $(GHC_INPLACE) $(HC_OPTS) --make $(HS_SRCS) -# -# $(LIBNAME) : lib -# $(RM) $@ -# $(AR) $(AR_OPTS) $@ $(HS_OBJS) -# $(RANLIB) $@ -# -# %.o : %.hs -# $(GHC_INPLACE) $(HC_OPTS) --make $< -# %.o : %.lhs -# $(GHC_INPLACE) $(HC_OPTS) --make $< - -# ----------------------------------------------------------------------------- -# Installation; need to install .hi files as well as libraries - -ifeq "$(DLLized)" "YES" -INSTALL_PROGS += $(DLL_NAME) -INSTALL_LIBS += $(patsubst %.a,%_imp.a, $(LIBRARY)) -endif -endif - -# The interface files are put inside the $(libdir), since they -# might (potentially) be platform specific.. - -ifeq "$(HIERARCHICAL_LIB)" "YES" -ifacedir = $(libdir)/imports -else -ifacedir = $(libdir)/hslibs-imports/$(PACKAGE) -endif - -# If the lib consists of a hierachy of modules, we must retain the directory -# structure when we install the interfaces. -ifeq "$(HIERARCHICAL_LIB)" "YES" -INSTALL_IFACES_WITH_DIRS += $(HS_IFACES) -ifneq "$(ALL_DIRS)" "" -install :: - @for i in $(ALL_DIRS); do \ - $(INSTALL_DIR) $(ifacedir)/$$i; \ - done -endif -else -INSTALL_IFACES += $(HS_IFACES) -endif - -# ----------------------------------------------------------------------------- -# Dependencies - -MKDEPENDHS = $(GHC_INPLACE) - -SRC_MKDEPENDC_OPTS += $(addprefix -I,$(ALL_DIRS)) -SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR) - -endif # $(PACKAGE) != "" - -#-------------------------------------------------------------- -# Installation - -ifneq "$(NO_INSTALL_LIBRARY)" "YES" -INSTALL_LIBS += $(LIBRARY) $(GHCI_LIBRARY) -endif - -#-------------------------------------------------------------- -# Building dynamically-linkable libraries for GHCi -# -# Build $(GHCI_LIBRARY) whenever we build $(LIBRARY) -# -# Why? GHCi can only link .o files (at the moment), not .a files -# so we have to build libFoo.o as well as libFoo.a -# -# Furthermore, GHCi currently never loads -# profiling libraries (or other non-std ways) - -ifneq "$(LIBRARY)" "" - -ifeq "$(way)" "" -ifeq "$(GhcWithInterpreter)" "YES" - -ifndef GHCI_LIBRARY -GHCI_LIBRARY = $(patsubst lib%.a,%.o,$(LIBRARY)) -endif - -CLEAN_FILES += $(GHCI_LIBRARY) - -all :: $(GHCI_LIBRARY) - -ifneq "$(DONT_WANT_STD_GHCI_LIB_RULE)" "YES" -# If you don't want to build GHCI_LIBRARY the 'standard' way, -# set DONT_WANT_STD_GHCI_LIB_RULE to YES. The Prelude and -# hslibs/Win32 uses this 'feature', which will go away soon -# when we can use a "fixed" ld. -# -$(GHCI_LIBRARY) : $(LIBOBJS) - $(LD) -r $(LD_X) -o $@ $(STUBOBJS) $(LIBOBJS) - -endif # DONT_WANT_STD_GHCI_LIB_RULE -endif # GhcWithInterpreter -endif # way -endif # $(LIBRARY) /= "" - -# ----------------------------------------------------------------------------- -# Doc building with Haddock - -ifneq "$(PACKAGE)" "" -ifeq "$(HADDOCK_DOCS)" "YES" - -HS_PPS = $(addsuffix .raw-hs, $(basename $(filter-out $(EXCLUDED_HADDOCK_SRCS), $(HS_SRCS)))) $(EXTRA_HADDOCK_SRCS) - -HTML_DIR = ../html-docs/$(PACKAGE) -HTML_DOC = $(HTML_DIR)/haddock.css $(HTML_DIR)/haddock.js - -ifneq "$(HS_PPS)" "" - -CLEAN_FILES += $(HS_PPS) $(addsuffix .tmp, $(HS_SRCS)) - -html :: $(HTML_DOC) - -extraclean :: - $(RM) -rf $(HTML_DIR) - -$(HTML_DOC) : $(HS_PPS) - @$(INSTALL_DIR) $(HTML_DIR) - $(HADDOCK) $(HADDOCK_OPTS) -h -o $(HTML_DIR) $(HS_PPS) \ - --package=$(PACKAGE) \ - --dump-interface=$(PACKAGE).haddock \ - --use-index=../doc-index.html --use-contents=../index.html \ - --source-module=$(PackageSourceURL) \ - $(foreach pkg, $(PACKAGE_DEPS), \ - --read-interface=../$(pkg),../$(pkg)/$(pkg).haddock) - -CLEAN_FILES += $(PACKAGE).haddock - -%.raw-hs : %.lhs - $(HC) $(HC_OPTS) -D__HADDOCK__ -E $< -o $@ - -%.raw-hs : %.hs - $(HC) $(HC_OPTS) -D__HADDOCK__ -E $< -o $@ - -HTML_INSTALL_DIR = $(DESTDIR)$(htmldir)/libraries/html/$(PACKAGE) - -install-docs :: $(HTML_DOC) - @$(INSTALL_DIR) $(HTML_INSTALL_DIR) - for i in $(HTML_DIR)/*; do \ - echo $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(HTML_INSTALL_DIR); \ - $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(HTML_INSTALL_DIR); \ - done; \ - $(INSTALL_DATA) $(INSTALL_OPTS) $(PACKAGE).haddock $(HTML_INSTALL_DIR); \ - -endif # HS_PPS -endif # HADDOCK_DOCS -endif # $(PACKAGE) /= "" - -# ----------------------------------------------------------------------------- - diff --git a/mk/paths.mk b/mk/paths.mk deleted file mode 100644 index 4cb2bbf8c8..0000000000 --- a/mk/paths.mk +++ /dev/null @@ -1,277 +0,0 @@ -################################################################################ -# -# paths.mk -# -# This file defines Make variables for standard directories -# and file lists -# -################################################################################ - -################################################################################ -# -# Standard variable names -# -################################################################################ -# The fptools mk setup defines a set of standard names which are used -# by the standard targets provided by mk. One example of this is the -# use of standard names for specifying what files to compile, their -# intermediate/object code, and the name of the final -# executable. Based on the settings of these variables, the standard -# targets will generate/expand rules that automatically compile and -# link your program. -# -# The general rules: -# -# SRCS - sources, might be prefixed to indicate what type of source -# they are. -# OBJS - object files (possibly prefixed). -# -# PROG - name of final executable -# -# We attempt to automatically devine the list of sources $(SRCS) to -# compile by looking in the current directory (and possibly other -# directories which may be specified by setting the $(ALL_DIRS) -# variable). This is complicated by the fact that some files are -# derived from other files: eg. .hsc files give rise to -hsc.c and -# -hsc.h files, .ly files give rise to .hs files, and .hs files give -# rise to .hc files sometimes. - -# So we figure out the sources in three stages: first figure out what -# sources we can find (this is $(ALL_SRCS)). Then figure out all the -# "derived" sources (eg. A.hsc generates A.hs and A_hsc.c), and -# finally put all these together and remove duplicates (GNU make's -# handy sort function does the duplicate removing). - -# HS_SRCS: list of Haskell modules you want to compile. -# (also use by depend rule). -# HS_OBJS: list of corresponding object files -# HS_PROG: program that is ultimately linked. -# HS_IFACES: list of interface files generated -# (caveat: assuming no funny use of -hisuf and that -# file name and module name match) - -ALL_SRCS = $(wildcard $(patsubst ./%, %, \ - $(patsubst %,%/*.hs, . $(ALL_DIRS)) \ - $(patsubst %,%/*.lhs, . $(ALL_DIRS)) \ - $(patsubst %,%/*.hs-boot, . $(ALL_DIRS)) \ - $(patsubst %,%/*.lhs-boot, . $(ALL_DIRS)) \ - $(patsubst %,%/*.y, . $(ALL_DIRS)) \ - $(patsubst %,%/*.ly, . $(ALL_DIRS)) \ - $(patsubst %,%/*.x, . $(ALL_DIRS)) \ - $(patsubst %,%/*.c, . $(ALL_DIRS)) \ - $(patsubst %,%/*.hc, . $(ALL_DIRS)) \ - $(patsubst %,%/*.S, . $(ALL_DIRS)) \ - $(patsubst %,%/*.prl, . $(ALL_DIRS)) \ - $(patsubst %,%/*.lprl, . $(ALL_DIRS)) \ - $(patsubst %,%/*.lit, . $(ALL_DIRS)) \ - $(patsubst %,%/*.verb, . $(ALL_DIRS)) \ - $(patsubst %,%/*.hsc, . $(ALL_DIRS)) \ - $(patsubst %,%/*.gc, . $(ALL_DIRS)) \ - )) $(EXTRA_SRCS) - -# ALL_SRCS is computed once and for all into PRE_SRCS at the top of -# target.mk. Otherwise, we end up re-computing ALL_SRCS every time it -# is expanded (it is used in several variables below, and these -# variables are used in several others, etc.), which can really slow -# down make. - -PRE_HS_SRCS = $(filter %.hs, $(PRE_SRCS)) -PRE_LHS_SRCS = $(filter %.lhs, $(PRE_SRCS)) - -PRE_HS_BOOT_SRCS = $(filter %.hs-boot, $(PRE_SRCS)) \ - $(filter %.lhs-boot, $(PRE_SRCS)) - -GC_SRCS = $(filter %.gc, $(PRE_SRCS)) -HSC_SRCS = $(filter %.hsc, $(PRE_SRCS)) -HAPPY_Y_SRCS = $(filter %.y, $(PRE_SRCS)) -HAPPY_LY_SRCS = $(filter %.ly, $(PRE_SRCS)) -HAPPY_SRCS = $(HAPPY_Y_SRCS) $(HAPPY_LY_SRCS) -ALEX_SRCS = $(filter %.x, $(PRE_SRCS)) - -DERIVED_GC_SRCS = $(patsubst %.gc, %.hs, $(GC_SRCS)) \ - $(patsubst %.gc, %_stub_ffi.c, $(GC_SRCS)) \ - $(patsubst %.gc, %_stub_ffi.h, $(GC_SRCS)) - -DERIVED_HSC_SRCS = $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \ - $(patsubst %.hsc, %_hsc.c, $(HSC_SRCS)) \ - $(patsubst %.hsc, %_hsc.h, $(HSC_SRCS)) \ - $(patsubst %.hsc, %.hc, $(HSC_SRCS)) - -DERIVED_HAPPY_SRCS = $(patsubst %.y, %.hs, $(HAPPY_Y_SRCS)) \ - $(patsubst %.ly, %.hs, $(HAPPY_LY_SRCS)) - -DERIVED_ALEX_SRCS = $(patsubst %.x, %.hs, $(ALEX_SRCS)) - -DERIVED_HC_SRCS = $(patsubst %.hs, %.hc, $(PRE_HS_SRCS)) \ - $(patsubst %.lhs, %.hc, $(PRE_LHS_SRCS)) - -DERIVED_SRCS = $(DERIVED_GC_SRCS) \ - $(DERIVED_HSC_SRCS) \ - $(DERIVED_HAPPY_SRCS) \ - $(DERIVED_ALEX_SRCS) \ - $(DERIVED_HC_SRCS) - -# EXCLUDED_SRCS can be set in the Makefile, otherwise it defaults to empty. -EXCLUDED_GC_SRCS = $(filter %.gc, $(EXCLUDED_SRCS)) -EXCLUDED_HSC_SRCS = $(filter %.hsc, $(EXCLUDED_SRCS)) -EXCLUDED_HAPPY_Y_SRCS = $(filter %.y, $(EXCLUDED_SRCS)) -EXCLUDED_HAPPY_LY_SRCS = $(filter %.ly, $(EXCLUDED_SRCS)) -EXCLUDED_HAPPY_SRCS = $(EXCLUDED_HAPPY_Y_SRCS) $(EXCLUDED_HAPPY_LY_SRCS) -EXCLUDED_ALEX_SRCS = $(filter %.x, $(EXCLUDED_SRCS)) -EXCLUDED_HS_SRCS = $(filter %.hs, $(EXCLUDED_SRCS)) -EXCLUDED_LHS_SRCS = $(filter %.lhs, $(EXCLUDED_SRCS)) -EXCLUDED_DERIVED_SRCS = $(patsubst %.hsc, %.hs, $(EXCLUDED_HSC_SRCS)) \ - $(patsubst %.hsc, %_hsc.h, $(EXCLUDED_HSC_SRCS)) \ - $(patsubst %.hsc, %_hsc.c, $(EXCLUDED_HSC_SRCS)) \ - $(patsubst %.hsc, %.hc, $(EXCLUDED_HSC_SRCS)) \ - $(patsubst %.gc, %_stub_ffi.c, $(EXCLUDED_GC_SRCS)) \ - $(patsubst %.gc, %_stub_ffi.h, $(EXCLUDED_GC_SRCS)) \ - $(patsubst %.y, %.hs, $(EXCLUDED_HAPPY_Y_SRCS)) \ - $(patsubst %.ly, %.hs, $(EXCLUDED_HAPPY_LY_SRCS)) \ - $(patsubst %.x, %.hs, $(EXCLUDED_ALEX_SRCS)) \ - $(patsubst %.hs, %.hc, $(EXCLUDED_HS_SRCS)) \ - $(patsubst %.lhs, %.hc, $(EXCLUDED_LHS_SRCS)) \ - $(patsubst %.hs, %_stub.c, $(EXCLUDED_HS_SRCS)) \ - $(patsubst %.lhs, %_stub.c, $(EXCLUDED_LHS_SRCS)) - -# Exclude _hsc.c files; they get built as part of the cbits library, -# not part of the main library - -CLOSED_EXCLUDED_SRCS = $(sort $(EXCLUDED_SRCS) $(EXCLUDED_DERIVED_SRCS)) - -SRCS = $(filter-out $(CLOSED_EXCLUDED_SRCS), \ - $(sort $(PRE_SRCS) $(DERIVED_SRCS))) - -HS_SRCS = $(filter %.lhs %.hs, $(sort $(SRCS) $(BOOT_SRCS))) -HS_OBJS = $(addsuffix .$(way_)o,$(basename $(HS_SRCS))) -HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_SRCS))) - -HI_BOOTS = $(patsubst %.hs-boot, %.$(way_)hi-boot, \ - $(patsubst %.lhs-boot, %.$(way_)hi-boot, $(PRE_HS_BOOT_SRCS))) - -O_BOOTS = $(patsubst %.hs-boot, %.$(way_)o-boot, \ - $(patsubst %.lhs-boot, %.$(way_)o-boot, $(PRE_HS_BOOT_SRCS))) - -GC_C_OBJS = $(addsuffix _stub_ffi.$(way_)o,$(basename $(filter %.gc,$(SRCS)))) -HSC_C_OBJS = $(addsuffix _hsc.$(way_)o,$(basename $(filter %.hsc,$(SRCS)))) - -ifeq "$(BootingFromHc)" "NO" -# We don't want to build the _stub.c files ourselves, unless we're -# bootstrapping from .hc files. -EXCLUDED_C_SRCS = $(patsubst %.lhs, %_stub.c, $(HS_SRCS)) \ - $(patsubst %.hs, %_stub.c, $(HS_SRCS)) \ - $(patsubst %.gc, %_stub_ffi.c, $(GC_SRCS)) \ - $(patsubst %.gc, %_stub_ffi.h, $(GC_SRCS)) -endif - -# These are droppings from hsc2hs - ignore them if we see them. -EXCLUDED_C_SRCS += $(patsubst %.hsc, %_hsc_make.c, $(HSC_SRCS)) - -C_SRCS = $(filter-out $(EXCLUDED_C_SRCS),$(filter %.c %.S,$(SRCS))) -C_OBJS = $(addsuffix .$(way_)o,$(basename $(C_SRCS))) - -# SCRIPT_SRCS: list of raw script files (in literate form) -# SCRIPT_OBJS: de-litted scripts -SCRIPT_SRCS = $(filter %.lprl,$(SRCS)) -SCRIPT_OBJS = $(addsuffix .prl,$(basename $(SCRIPT_SRCS))) - -OBJS = $(HS_OBJS) $(C_OBJS) $(GC_C_OBJS) - -# The default is for $(LIBOBJS) to be the same as $(OBJS) -LIBOBJS = $(OBJS) - -# -# Note that as long as you use the standard variables for setting -# which C & Haskell programs you want to work on, you don't have -# to set any of the clean variables - the default should do the Right -# Thing. -# - -#------------------------------------------------------------------ -# -# make depend defaults -# -# The default set of files for the dependency generators to work on -# is just their source equivalents. -# - -ifneq "$(BootingFromHc)" "YES" -MKDEPENDHS_SRCS=$(HS_SRCS) -else -MKDEPENDHS_SRCS= -endif - -MKDEPENDC_SRCS=$(C_SRCS) - -#------------------------------------------------------------------ -# -# make TAGS defaults -# -# The default set of files for the TAGS file generators to work on -# is just their source equivalents. -# -TAGS_HS_SRCS=$(HS_SRCS) -TAGS_C_SRCS=$(C_SRCS) - -#------------------------------------------------------------------ -# Clean file make-variables. -# -# The following three variables are used to control -# what gets removed when doing `make clean' -# -# MOSTLYCLEAN_FILES object code etc., but not stuff -# that is slow to recompile and/or stable -# -# CLEAN_FILES all files that are created by running make. -# -# MAINTAINER_CLEAN_FILES also clean out machine-generated files -# that may require extra tools to create. -# -# -# NOTE: $(SCRIPT_OBJS) is not in MOSTLY_CLEAN_FILES, because in some -# places in the tree it appears that we have source files in $(SCRIPT_OBJS). -# Specifically glafp-utils/mkdependC/mkdependC.prl and others in driver/ and -# possibly others elsewhere in the tree. ToDo: fix this properly. -MOSTLY_CLEAN_FILES += $(HS_OBJS) $(C_OBJS) $(HSC_C_OBJS) $(GC_C_OBJS) -CLEAN_FILES += $(HS_PROG) $(C_PROG) $(SCRIPT_LINK) \ - $(PROG) $(LIBRARY) a.out \ - $(DERIVED_HSC_SRCS) \ - $(DERIVED_GC_SRCS) \ - $(patsubst %,%/*.$(way_)hi, . $(ALL_DIRS)) \ - $(HI_BOOTS) $(O_BOOTS) - -# we delete *all* the .hi files we can find, rather than just -# $(HS_IFACES), because stale interfaces left around by modules which -# don't exist any more can screw up the build. - -# Don't clean the .hc files if we're bootstrapping -ifneq "$(BootingFromHc)" "YES" -CLEAN_FILES += $(DERIVED_HC_SRCS) -endif - -DIST_CLEAN_FILES += .depend* *.hp *.prof - -MAINTAINER_CLEAN_FILES += $(BOOT_SRCS) $(DERIVED_HAPPY_SRCS) $(DERIVED_ALEX_SRCS) - -# -# `Standard' set of files to clean out. -# -MOSTLY_CLEAN_FILES += \ - *.CKP *.ln *.BAK *.bak .*.bak *.o core a.out errs ,* *.a .emacs_* \ - tags TAGS *.ind *.ilg *.idx *.idx-prev *.aux *.aux-prev *.dvi *.log \ - *.toc *.lot *.lof *.blg *.cb *_stub.c *_stub.h *.raw_s *.a.list - -#------------------------------------------------------------------ - -# Directory in which DLLs are dumped so as not to get picked up by running -# programs (e.g. ghc or hsc) that run in the build tree - -DLL_PEN = $(FPTOOLS_TOP)/dll - -#------------------------------------------------------------------ -# -# Stylesheet for HTML generated from DocBook XML -# - -FPTOOLS_CSS = fptools.css -FPTOOLS_CSS_ABS = $(FPTOOLS_TOP)/mk/$(FPTOOLS_CSS) diff --git a/mk/project.mk.in b/mk/project.mk.in new file mode 100644 index 0000000000..e5f64d01cf --- /dev/null +++ b/mk/project.mk.in @@ -0,0 +1,143 @@ +# WARNING: mk/project.mk is automatically generated from mk/project.mk.in by +# ./configure. Make sure you are editing mk/project.mk.in, not mk/project.mk. + +################################################################################ +# +# 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 + diff --git a/mk/recurse.mk b/mk/recurse.mk deleted file mode 100644 index 2bb370deeb..0000000000 --- a/mk/recurse.mk +++ /dev/null @@ -1,101 +0,0 @@ - -################################################################## -# -# Recursive stuff -# -################################################################## - -# Here are the diabolically clever rules that -# -# (a) for each "recursive target" <t> -# propagates "make <t>" to directories in SUBDIRS -# -# (b) when SUBDIRS is empty, -# for each "multi-way-target" <t> -# calls "make way=w <t>" for each w in $(WAYS) -# -# This has the effect of making the standard target -# in each of the specified ways (as well as in the normal way - -# Controlling variables -# WAYS = extra (beyond the normal way) ways to build things in -# SUBDIRS = subdirectories to recurse into - -# No ways, so iterate over the SUBDIRS - -# note about recursively invoking make: we'd like make to drop all the -# way back to the top level if it fails in any of the -# sub(sub-...)directories. This is done by setting the -e flag to the -# shell during the loop, which causes an immediate failure if any of -# the shell commands fail. - -# One exception: if the user gave the -i or -k flag to make in the -# first place, we'd like to reverse this behaviour. So we check for -# these flags, and set the -e flag appropriately. NOTE: watch out for -# the --no-print-directory flag which is passed to recursive -# invocations of make. -# -ifeq "$(way)" "" -ifneq "$(SUBDIRS)" "" - -# we override the 'boot', 'all' and 'install' targets in the top -# level Makefile. Some of the sub-projects also set 'boot' to empty. - -ifeq "$(NO_ALL_TARGET)" "YES" -ALL_TARGET = -else -ALL_TARGET = all -endif - -ifeq "$(NO_BOOT_TARGET)" "YES" -BOOT_TARGET = -else -BOOT_TARGET = boot -endif - -ifeq "$(NO_INSTALL_TARGET)" "YES" -INSTALL_TARGET = -INSTALL_DOCS_TARGET = -else -INSTALL_TARGET = install -INSTALL_DOCS_TARGET = install-docs -endif - -$(ALL_TARGET) docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt:: - @echo "------------------------------------------------------------------------" - @echo "== Recursively making \`$@' in $(SUBDIRS) ..." - @echo "PWD = $(shell pwd)" - @echo "------------------------------------------------------------------------" -# Don't rely on -e working, instead we check exit return codes from sub-makes. - @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ - if [ $$x_on_err -eq 0 ]; \ - then echo "Won't exit on error due to MFLAGS: ${MFLAGS}"; \ - fi; \ - for i in $(SUBDIRS); do \ - echo "------------------------------------------------------------------------"; \ - echo "== $(MAKE) $@ $(MFLAGS);"; \ - echo " in $(shell pwd)/$$i"; \ - echo "------------------------------------------------------------------------"; \ - $(MAKE) --no-print-directory -C $$i $(MFLAGS) $@ CLEAN_ALL_STAGES=YES; \ - if [ $$? -eq 0 -o $$x_on_err -eq 0 ]; \ - then echo "Finished making $@ in $$i": $$?; \ - else echo "Failed making $@ in $$i": $$?; exit 1; \ - fi; \ - done - @echo "------------------------------------------------------------------------" - @echo "== Finished making \`$@' in $(SUBDIRS) ..." - @echo "PWD = $(shell pwd)" - @echo "------------------------------------------------------------------------" - -endif -endif - -# -# Selectively building subdirectories. -# -# -ifneq "$(SUBDIRS)" "" -$(SUBDIRS) :: - $(MAKE) -C $@ $(MFLAGS) -endif - diff --git a/mk/sub-makefile.mk b/mk/sub-makefile.mk new file mode 100644 index 0000000000..1e9cf2265d --- /dev/null +++ b/mk/sub-makefile.mk @@ -0,0 +1,34 @@ +# This file is included by all the "stub makefiles" in every directory +# in the tree except the root. Its job is to invoke $(MAKE) on the +# top-level Makefile, but modifying the target so that it applies to +# the current directory only. +# +# eg. +# make foo.o ==> make -C $(TOP) dir/foo.o +# make all ==> make -C $(TOP) all_dir +# make clean ==> make -C $(TOP) clean_dir +# + +# Important, otherwise we get silly built-in rules: +.SUFFIXES: + +TOPMAKE = $(MAKE) -C $(TOP) + +default : + +$(TOPMAKE) all_$(dir) + +# We must not execute multiple recursive invocations of make in parallel. +.NOTPARALLEL: + +# all comes first, we want it to be the default target +STD_TARGETS = all clean distclean maintainer_clean install + +# The + tells make that we're recursively invoking make, otherwise 'make -j2' +# goes wrong. +$(STD_TARGETS): + +$(TOPMAKE) $@_$(dir) + +OTHERTARGETS=$(filter-out $(STD_TARGETS) $(SPEC_TARGETS),$(MAKECMDGOALS)) +.PHONY: $(OTHERTARGETS) +$(OTHERTARGETS): + +$(TOPMAKE) $(dir)/$@ diff --git a/mk/suffix.mk b/mk/suffix.mk deleted file mode 100644 index 762636aea1..0000000000 --- a/mk/suffix.mk +++ /dev/null @@ -1,392 +0,0 @@ -################################################################################# -# -# suffix.mk -# -# Suffix rules for fptools -# -################################################################################# - -# -# This file contain the default suffix rules for all the fptools projects. -# - - -# No need to define .SUFFIXES because we don't use any suffix rules -# Instead we use gmake's pattern rules exlusively - -.SUFFIXES: - -# This declaration tells GNU make to delete the target if it has -# changed and the command which created it exited with a non-zero exit -# code. - -.DELETE_ON_ERROR: - -#----------------------------------------------------------------------------- -# Haskell Suffix Rules - -# The $(odir) support is for building GHC, where we need to build three -# different versions from the same sources. See compiler/Makefile. -ifneq "$(odir)" "" -odir_ = $(odir)/ -else -odir_ = -endif - -# Turn off all the Haskell suffix rules if we're booting from .hc -# files. The file bootstrap.mk contains alternative suffix rules in -# this case. -ifneq "$(BootingFromHc)" "YES" - -$(odir_)%.$(way_)o : %.hs - $(HC_PRE_OPTS) - $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi - $(HC_POST_OPTS) - -$(odir_)%.$(way_)o : %.lhs - $(HC_PRE_OPTS) - $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi - $(HC_POST_OPTS) - -# Now the rules for hs-boot files. -# Note that they do *not* do teh HS_PRE_OPTS / HS_POST_OPTS stuff, -# (which concerns splitting) because they don't generate .o files -$(odir_)%.$(way_)o-boot : %.hs-boot - $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi-boot - -$(odir_)%.$(way_)o-boot : %.lhs-boot - $(HC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi-boot - -$(odir_)%.$(way_)hc : %.lhs - $(RM) $@ - $(HC) $(HC_OPTS) -C $< -o $@ - -$(odir_)%.$(way_)hc : %.hs - $(RM) $@ - $(HC) $(HC_OPTS) -C $< -o $@ - -$(odir_)%.$(way_)o : %.$(way_)hc - $(HC_PRE_OPTS) - $(HC) $(HC_OPTS) -c $< -o $@ - $(HC_POST_OPTS) - -$(odir_)%.$(way_)o : %.hc - $(HC_PRE_OPTS) - $(HC) $(HC_OPTS) -c $< -o $@ - $(HC_POST_OPTS) - -$(odir_)%.$(way_)s : %.$(way_)hc - $(HC_PRE_OPTS) - $(HC) $(HC_OPTS) -S $< -o $@ - $(HC_POST_OPTS) - -$(odir_)%.$(way_)hc : %.lhc - @$(RM) $@ - $(UNLIT) $< $@ - $(GENERATED_FILE) $@ - - -# Here's an interesting rule! -# The .hi file depends on the .o file, -# so if the .hi file is dated earlier than the .o file (commonly the case, -# when interfaces are stable) this rule just makes sure that the .o file, -# is up to date. Then it does nothing to generate the .hi file from the -# .o file, because the act of making sure the .o file is up to date also -# updates the .hi file (if necessary). - -%.$(way_)hi : %.$(way_)o - @if [ ! -f $@ ] ; then \ - echo Panic! $< exists, but $@ does not.; \ - exit 1; \ - else exit 0 ; \ - fi - -%.$(way_)hi-boot : %.$(way_)o-boot - @if [ ! -f $@ ] ; then \ - echo Panic! $< exists, but $@ does not.; \ - exit 1; \ - else exit 0 ; \ - fi - -$(odir_)%.$(way_)hi : %.$(way_)hc - @if [ ! -f $@ ] ; then \ - echo Panic! $< exists, but $@ does not.; \ - exit 1; \ - else exit 0 ; \ - fi - -else # BootingFromHc - -# ----------------------------------------------------------------------------- -# suffix rules for building a .o from a .hc file in bootstrap mode. - -ifeq "$(BootingFromUnregisterisedHc)" "YES" - -# without mangling - -$(odir_)%.o : %.hc - $(CC) -x c $< -o $@ -c -O $(HC_BOOT_CC_OPTS) -I. `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` - -else - -# with mangling - -$(odir_)%.raw_s : %.hc - $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` - -$(odir_)%.s : $(odir_)%.raw_s - $(MANGLER) $< $@ $(patsubst -monly-%-regs, %, $(filter -monly-%-regs, $($*_HC_OPTS))) - -$(odir_)%.o : $(odir_)%.s - $(CC) -c -o $@ $< - -endif # not BootingFromUnregisterisedHc - -endif # BootingFromHc - -#----------------------------------------------------------------------------- -# Happy Suffix Rules -# -%.hs : %.ly - $(HAPPY) $(HAPPY_OPTS) $< - -%.hs : %.y - $(HAPPY) $(HAPPY_OPTS) $< - -#----------------------------------------------------------------------------- -# Alex Suffix Rules -# - -%.hs : %.x - $(ALEX) $(ALEX_OPTS) $< - -#----------------------------------------------------------------------------- -# hsc2hs Suffix Rules -# -ifneq "$(BootingFromHc)" "YES" -%_hsc.c %_hsc.h %.hs : %.hsc - $(HSC2HS_INPLACE) $(HSC2HS_OPTS) $< - @touch $(patsubst %.hsc,%_hsc.c,$<) -endif - -#----------------------------------------------------------------------------- -# Green-card Suffix Rules -# - -%.hs %_stub_ffi.c %_stub_ffi.h : %.gc - $(GREENCARD) $(GC_OPTS) $< - -%.lhs : %.gc - $(GREENCARD) $(GC_OPTS) $< -o $@ - -%.gc : %.pgc - $(CPP) $(GC_CPP_OPTS) $< | perl -pe 's#\\n#\n#g' > $@ - -#----------------------------------------------------------------------------- -# C-related suffix rules - -# UseGhcForCc is only relevant when not booting from HC files. -ifeq "$(UseGhcForCc) $(BootingFromHc)" "YES NO" - -$(odir_)%.$(way_)o : %.c - @$(RM) $@ - $(HC) $(GHC_CC_OPTS) -c $< -o $@ - -$(odir_)%.$(way_)o : %.$(way_)s - @$(RM) $@ - $(HC) $(GHC_CC_OPTS) -c $< -o $@ - -$(odir_)%.$(way_)o : %.S - @$(RM) $@ - $(HC) $(GHC_CC_OPTS) -c $< -o $@ - -$(odir_)%.$(way_)s : %.c - @$(RM) $@ - $(HC) $(GHC_CC_OPTS) -S $< -o $@ - -else - -$(odir_)%.$(way_)o : %.c - @$(RM) $@ - $(CC) $(CC_OPTS) -c $< -o $@ - -$(odir_)%.$(way_)o : %.$(way_)s - @$(RM) $@ - $(AS) $(AS_OPTS) -o $@ $< - -$(odir_)%.$(way_)o : %.S - @$(RM) $@ - $(CC) $(CC_OPTS) -c $< -o $@ - -$(odir_)%.$(way_)s : %.c - @$(RM) $@ - $(CC) $(CC_OPTS) -S $< -o $@ - -endif - -# stubs are automatically generated and compiled by GHC -%_stub.$(way_)o: %.o - @: - -# ----------------------------------------------------------------------------- -# Flex/lex - -%.c : %.flex - @$(RM) $@ - $(FLEX) -t $(FLEX_OPTS) $< > $@ -%.c : %.lex - @$(RM) $@ - $(FLEX) -t $(FLEX_OPTS) $< > $@ - -#----------------------------------------------------------------------------- -# Runtest rules for calling $(HC) on a single-file Haskell program - -%.runtest : %.hs - $(TIME) $(RUNTEST) $(HC) $(RUNTEST_OPTS) $< - -#----------------------------------------------------------------------------- -# DocBook XML suffix rules -# - -%.html : %.xml - $(XSLTPROC) --output $@ \ - --stringparam html.stylesheet $(FPTOOLS_CSS) \ - $(XSLTPROC_LABEL_OPTS) $(XSLTPROC_OPTS) \ - $(DIR_DOCBOOK_XSL)/html/docbook.xsl $< - cp $(FPTOOLS_CSS_ABS) . - -%/index.html : %.xml - $(RM) -rf $(dir $@) - $(XSLTPROC) --stringparam base.dir $(dir $@) \ - --stringparam use.id.as.filename 1 \ - --stringparam html.stylesheet $(FPTOOLS_CSS) \ - $(XSLTPROC_LABEL_OPTS) $(XSLTPROC_OPTS) \ - $(DIR_DOCBOOK_XSL)/html/chunk.xsl $< - cp $(FPTOOLS_CSS_ABS) $(dir $@) - -# Note: Numeric labeling seems to be uncommon for HTML Help -%-htmlhelp/index.html : %.xml - $(RM) -rf $(dir $@) - $(XSLTPROC) --stringparam base.dir $(dir $@) \ - --stringparam manifest.in.base.dir 1 \ - --stringparam htmlhelp.chm "..\\"$(basename $<).chm \ - $(XSLTPROC_OPTS) \ - $(DIR_DOCBOOK_XSL)/htmlhelp/htmlhelp.xsl $< - -%-htmlhelp2/collection.HxC : %.xml - $(RM) -rf $(dir $@) - $(XSLTPROC) --stringparam base.dir $(dir $@) \ - --stringparam use.id.as.filename 1 \ - --stringparam manifest.in.base.dir 1 \ - $(XSLTPROC_OPTS) \ - $(DIR_DOCBOOK_XSL)/htmlhelp2/htmlhelp2.xsl $< - -# TODO: Detect hhc & Hxcomp via autoconf -# -# Two obstacles here: -# -# * The reason for the strange "if" below is that hhc returns 0 on error and 1 -# on success, the opposite of what shells and make expect. -# -# * There seems to be some trouble with DocBook indices, but the *.chm looks OK, -# anyway, therefore we pacify make by "|| true". Ugly... -# -%.chm : %-htmlhelp/index.html - ( cd $(dir $<) && if hhc htmlhelp.hhp ; then false ; else true ; fi ) || true - -%.HxS : %-htmlhelp2/collection.HxC - ( cd $(dir $<) && if Hxcomp -p collection.HxC -o ../$@ ; then false ; else true ; fi ) - -%.fo : %.xml - $(XSLTPROC) --output $@ \ - --stringparam draft.mode no \ - $(XSLTPROC_LABEL_OPTS) $(XSLTPROC_OPTS) \ - $(DIR_DOCBOOK_XSL)/fo/docbook.xsl $< - -ifeq "$(FOP)" "" -ifneq "$(PDFXMLTEX)" "" -%.pdf : %.fo - $(PDFXMLTEX) $< - if grep "LaTeX Warning: Label(s) may have changed.Rerun to get cross-references right." $(basename $@).log > /dev/null ; then \ - $(PDFXMLTEX) $< ; \ - $(PDFXMLTEX) $< ; \ - fi -endif -else -%.ps : %.fo - $(FOP) $(FOP_OPTS) -fo $< -ps $@ - -%.pdf : %.fo - $(FOP) $(FOP_OPTS) -fo $< -pdf $@ -endif - -ifneq "$(XMLTEX)" "" -%.dvi : %.fo - $(XMLTEX) $< - if grep "LaTeX Warning: Label(s) may have changed.Rerun to get cross-references right." $(basename $@).log > /dev/null ; then \ - $(XMLTEX) $< ; \ - $(XMLTEX) $< ; \ - fi -endif - -#----------------------------------------------------------------------------- -# Doc processing suffix rules -# -# ToDo: make these more robust -# -%.ps : %.dvi - @$(RM) $@ - $(DVIPS) $< -o $@ - -%.tex : %.tib - @$(RM) $*.tex $*.verb-t.tex - $(TIB) $*.tib - expand $*.tib-t.tex | $(VERBATIM) > $*.tex - @$(RM) $*.tib-t.tex - -%.ps : %.fig - @$(RM) $@ - fig2dev -L ps $< $@ - -%.tex : %.fig - @$(RM) $@ - fig2dev -L latex $< $@ - -#----------------------------------------------------------------------------- -# Literate suffix rules - -%.prl : %.lprl - @$(RM) $@ - $(UNLIT) $(UNLIT_OPTS) $< $@ - $(GENERATED_FILE) $@ - -%.c : %.lc - @$(RM) $@ - $(UNLIT) $(UNLIT_OPTS) $< $@ - $(GENERATED_FILE) $@ - -%.h : %.lh - @$(RM) $@ - $(UNLIT) $(UNLIT_OPTS) $< $@ - $(GENERATED_FILE) $@ - -#----------------------------------------------------------------------------- -# Win32 resource files -# -# The default is to use the GNU resource compiler. -# - -%.$(way_)o : %.$(way_)rc - @$(RM) $@ - windres --preprocessor="$(CPP) -xc -DRC_INVOKED" $< $@ - -#----------------------------------------------------------------------------- -# Preprocessor suffix rule - -# Note use of -P option to prevent #line pragmas being left in the CPP -# output. - -% : %.pp - @$(RM) $@ - $(CPP) $(RAWCPP_FLAGS) -P $(CPP_OPTS) -x c $< | \ - grep -v '^#pragma GCC' > $@ diff --git a/mk/target.mk b/mk/target.mk deleted file mode 100644 index 37a72bcc0c..0000000000 --- a/mk/target.mk +++ /dev/null @@ -1,701 +0,0 @@ -################################################################################# -# -# target.mk -# -# Standard targets for GHC -# -################################################################################# - -# -# This file contain three groups of target rules: -# -# 1. GHC targets -# depend* -# runtests* -# -# 2. GNU standard targets -# all* -# install* installcheck installdirs -# install-docs* -# clean* distclean* mostlyclean* maintainer-clean* -# tags* -# dvi ps (no info) GHC adds: pdf rtf html chm HxS -# check -# -# 3. 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 -# - -# -# -# - -################################################################## -# Pre-compute the list of sources so we don't have to do this -# multiple times. See paths.mk. - -PRE_SRCS := $(ALL_SRCS) - -################################################################## -# Include package building machinery -# NB. needs to be after PRE_SRCS setting above, because otherwise the -# rule dependencies won't be set correctly. - -include $(TOP)/mk/package.mk - -################################################################### -# Suffix rules for Haskell, C and literate - -include $(TOP)/mk/suffix.mk - -################################################################## -# GHC standard targets -# -# depend: -# -# The depend target has to cope with a set of files that may have -# different ways of computing their dependencies, i.e., a Haskell -# module's dependencies are computed differently from C files. -# -# Note that we don't compute dependencies automatically, i.e., have the -# .depend file be a target that is dependent on the Haskell+C sources, -# and then have the `depend' target depend on `.depend'. The reason for -# this is that when GNU make is processing the `include .depend' statement -# it records .depend as being a Makefile. Before doing any other processing, -# `make' will try to check to see if the Makefiles are up-to-date. And, -# surprisingly enough, .depend has a rule for it, so if any of the source -# files change, it will be invoked, *regardless* of what target you're making. -# -# So, for now, the dependencies has to be re-computed manually via `make depend' -# whenever a module changes its set of imports. Doing what was outlined above -# is only a small optimisation anyway, it would avoid the recomputation of -# dependencies if the .depend file was newer than any of the source modules. -# -.PHONY: depend - -# Compiler produced files that are targets of the source's imports. -MKDEPENDHS_OBJ_SUFFICES=o - -ifneq "$(BootingFromHc)" "YES" -PKGCONF_DEP = $(STAMP_PKG_CONF) -endif - -ifeq "$(USE_NEW_MKDEPEND_FLAGS)" "YES" -MKDEPENDHS_FLAGS = -dep-makefile .depend $(foreach way,$(WAYS),-dep-suffix $(way)) -else -MKDEPENDHS_FLAGS = -optdep-f -optdep.depend $(foreach way,$(WAYS),-optdep-s -optdep$(way)) -endif - -depend :: $(MKDEPENDHS_SRCS) $(MKDEPENDC_SRCS) $(PKGCONF_DEP) - @$(RM) .depend - @touch .depend -ifneq "$(DOC_SRCS)" "" - $(MKDEPENDLIT) -o .depend $(MKDEPENDLIT_OPTS) $(filter %.lit,$(DOC_SRCS)) -endif -ifneq "$(MKDEPENDC_SRCS)" "" - $(MKDEPENDC) -f .depend $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(MKDEPENDC_SRCS) -endif -ifneq "$(MKDEPENDHS_SRCS)" "" - $(MKDEPENDHS) -M $(MKDEPENDHS_FLAGS) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(HC_OPTS)) $(MKDEPENDHS_SRCS) -endif - - -################################################################## -# boot -# -# The boot target, at a minimum generates dependency information - -.PHONY: boot - -ifeq "$(NO_BOOT_TARGET)" "YES" -boot :: -else -boot :: depend -endif - -################################################################## -# GNU Standard targets -# -# Every Makefile should define the following targets -# -# `all' -# Compile the entire program. This should be the default target. -# This target need not rebuild any documentation files -# -# `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. -# -# `clean' -# -# Delete all files from the current directory that are normally -# created by building the program. Don't delete the files that -# record the configuration. Also preserve files that could be made -# by building, but normally aren't because the distribution comes -# with them. -# -# Delete `.dvi' files here if they are not part of the -# distribution. -# -# `distclean' -# Delete all files from the current directory that are created by -# configuring or building the program. If you have unpacked the -# source and built the program without creating any other files, -# `make distclean' should leave only the files that were in the -# distribution. -# -# `mostlyclean' -# Like `clean', but may refrain from deleting a few files that -# people normally don't want to recompile. For example, the -# `mostlyclean' target for GCC does not delete `libgcc.a', because -# recompiling it is rarely necessary and takes a lot of time. -# -# `maintainer-clean' -# Delete everything from the current directory that can be -# reconstructed with this Makefile. This typically includes -# everything deleted by distclean , plus more: C source files -# produced by Bison, tags tables, and so on. -# -# One exception, however: `make maintainer-clean' should not delete -# `configure' even if `configure' can be remade using a rule in the -# Makefile. More generally, `make maintainer-clean' should not delete -# anything that needs to exist in order to run `configure' and then -# begin to build the program. -# -# `TAGS' -# Update a tags table for this program. -# -# `dvi' `ps' `pdf' `html' `chm' `HxS' `rtf' -# Generate DVI/PS/PDF files for LaTeX/DocBook docs. Not everything is -# supported everywhere, but the intention is to standardise on DocBook -# producing all formats. -# -# `check' -# Perform self-tests (if any). The user must build the program -# before running the tests, but need not install the program; you -# should write the self-tests so that they work when the program is -# built but not 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) - - - - -########################################### -# -# Targets: "all" -# -########################################### - -# For each of these variables that is defined -# we generate one "all" rule and one rule for the variable itself: -# -# HS_PROG Haskell program -# C_PROG C program -# LIBRARY Library -# -# For details of exactly what rule is generated, see the -# relevant section below - -.PHONY: all - -#---------------------------------------- -# Haskell programs - -ifneq "$(HS_PROG)" "" -all :: $(HS_PROG) - -ifneq "$(BootingFromHc)" "YES" -$(HS_PROG) :: $(OBJS) - $(HC) -o $@ $(HC_OPTS) $(LD_OPTS) $(OBJS) -else -# see bootstrap.mk -$(HS_PROG) :: $(OBJS) - $(CC) -o $@ $(HC_BOOT_CC_OPTS) $(HC_BOOT_LD_OPTS) $(OBJS) $(HC_BOOT_LIBS) -endif -endif - -#---------------------------------------- -# C programs - -ifneq "$(C_PROG)" "" -all :: $(C_PROG) - -$(C_PROG) :: $(C_OBJS) - $(CC) -o $@ $(CC_OPTS) $(LD_OPTS) $(C_OBJS) $(LIBS) -endif - -#---------------------------------------- -# Libraries/archives -# -# Build $(LIBRARY) from $(LIBOBJS)+$(STUBOBJS) -# -# Inputs: -# $(LIBOBJS) -# $(STUBOBJS) -# -# Outputs: -# Rule to build $(LIBRARY) - -ifneq "$(LIBRARY)" "" -all :: $(LIBRARY) - -ifneq "$(way)" "i" -define BUILD_STATIC_LIB -$(RM) $@ -$(AR) $(AR_OPTS) $@ $(STUBOBJS) $(LIBOBJS) -$(RANLIB) $@ -endef -else -define BUILD_STATIC_LIB -$(RM) $@ -al -out:$@ $(STUBOBJS) $(LIBOBJS) -endef -endif - -# -# For Haskell object files, we might have chosen to split -# up the object files. Test for whether the library being -# built is consisting of Haskell files by (hackily) checking -# whether HS_SRCS is empty or not. -# - -# can't split objs in way 'u', so we disable it here -ifeq "$(way)" "u" -SplitObjs = NO -endif - -ifneq "$(HS_SRCS)" "" -ifeq "$(SplitObjs)" "YES" - -SRC_HC_OPTS += -split-objs - -# We generate the archive into a temporary file libfoo.a.tmp, then -# rename it at the end. This avoids the problem that ar may sometimes -# fail, leaving a partially built archive behind. -ifeq "$(ArSupportsInput)" "" -define BUILD_STATIC_LIB -$(RM) $@ $@.tmp -(echo $(STUBOBJS) $(C_OBJS) $(GC_C_OBJS); $(FIND) $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) -name '*.$(way_)o' -print) | xargs $(AR) $@ -$(RANLIB) $@ -endef -else -define BUILD_STATIC_LIB -$(RM) $@ $@.tmp -echo $(STUBOBJS) > $@.list -echo $(C_OBJS) >> $@.list -echo $(GC_C_OBJS) >> $@.list -$(FIND) $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) -name '*.$(way_)o' -print >> $@.list -$(AR) $(AR_OPTS) $@ $(ArSupportsInput) $@.list -$(RM) $@.list -$(RANLIB) $@ -endef -endif - -# Extra stuff for compiling Haskell files with $(SplitObjs): - -# -# If (Haskell) object files are split, cleaning up -# consist of descending into the directories where -# the myriads of object files have been put. -# - -extraclean :: - $(FIND) $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) -name '*.$(way_)o' -print -o -name ld.script -print | xargs $(RM) __rm_food - -rmdir $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) > /dev/null 2>&1 - -endif # $(SplitObjs) -endif # $(HS_SRCS) - -# -# Remove local symbols from library objects if requested. -# - -ifeq "$(StripLibraries)" "YES" -ifeq "$(SplitObjs)" "YES" -SRC_HC_POST_OPTS += \ - for i in $(basename $@)_split/*.$(way_)o; do \ - $(LD) -r $(LD_X) -o $$i.tmp $$i; \ - $(MV) $$i.tmp $$i; \ - done -else -SRC_HC_POST_OPTS += \ - $(LD) -r $(LD_X) -o $@.tmp $@; $(MV) $@.tmp $@ -endif # SplitObjs -endif # StripLibraries - -# Note: $(STUBOBJS) isn't depended on here, but included when building the lib. -# (i.e., the assumption is that $(STUBOBJS) are created as a side-effect -# of building $(LIBOBJS)). - -ifeq "$(LIBRARY:%.so=YES)" "YES" -# ELF styled DSO -$(LIBRARY): $(LIBOBJS) $(LIB_DEPS) - $(RM) $@ - $(HC) -shared -dynamic -o $@ $(STUBOBJS) $(LIBOBJS) $(LIB_LD_OPTS) -else -ifeq "$(LIBRARY:%.dylib=YES)" "YES" -$(LIBRARY): $(LIBOBJS) $(LIB_DEPS) - $(HC) -shared -dynamic -o $@ $(STUBOBJS) $(LIBOBJS) $(LIB_LD_OPTS) -else -ifeq "$(LIBRARY:%.dll=YES)" "YES" -#---------------------------------------- -# Building Win32 DLLs -# -$(LIBRARY): $(LIBOBJS) $(LIBRARY).o $(LIB_DEPS) - $(HC) -shared -dynamic -o $@ $(STUBOBJS) $(LIBOBJS) $(LIBRARY).o $(LIB_LD_OPTS) - -DLLTOOL=dlltool - -$(LIBRARY).def: $(LIBOBJS) - $(DLLTOOL) -D $(LIBRARY) --output-def $@ --export-all $(LIBOBJS) - -$(LIBRARY).o: - $(DLLTOOL) -D $(LIBRARY) --output-exp $(LIBRARY).o $(LIBOBJS) - -# Generates library.dll.a; by MinGW conventions, this is the dll's import library -$(LIBRARY).a: $(LIBOBJS) $(LIBRARY).def - $(DLLTOOL) -D $(LIBRARY) --def $(LIBRARY).def --output-lib $@ - -# -# Version information is baked into a DLL by having the DLL include DllVersionInfo.o. -# The version info contains two user tweakables: DLL_VERSION and DLL_VERSION_NAME. -# (both are given sensible defaults though.) -# -# Note: this will not work as expected with Cygwin B20.1; you need a more recent -# version of binutils (to pick up windres bugfixes.) - -ifndef DLL_VERSION -DLL_VERSION=$(ProjectVersion) -endif - -ifndef DLL_VERSION_NAME -DLL_VERSION_NAME="http://www.haskell.org/ghc" -endif - -ifndef DLL_DESCRIPTION -DLL_DESCRIPTION="A GHC-compiled DLL" -endif - -ifndef EXE_VERSION -EXE_VERSION=$(ProjectVersion) -endif - -ifndef EXE_VERSION_NAME -EXE_VERSION_NAME="http://www.haskell.org/ghc" -endif - -ifndef EXE_DESCRIPTION -EXE_DESCRIPTION="A GHC-compiled binary" -endif - -# -# Little bit of lo-fi mangling to get at the right set of settings depending -# on whether we're generating the VERSIONINFO for a DLL or EXE -# -DLL_OR_EXE=$(subst VersionInfo.$(way_)rc,,$@) -VERSION_FT=$(subst Dll, 0x2L, $(subst Exe, 0x1L, $(DLL_OR_EXE))) -VERSION_RES_NAME=$(subst Exe,$(EXE_VERSION_NAME), $(subst Dll, $(DLL_VERSION_NAME),$(DLL_OR_EXE))) -VERSION_RES=$(subst Exe,$(EXE_VERSION), $(subst Dll, $(DLL_VERSION),$(DLL_OR_EXE))) -VERSION_DESC=$(subst Exe,$(EXE_DESCRIPTION), $(subst Dll, $(DLL_DESCRIPTION),$(DLL_OR_EXE))) - -DllVersionInfo.$(way_)rc ExeVersionInfo.$(way_)rc: - $(RM) DllVersionInfo.$(way_)rc - echo "1 VERSIONINFO" > $@ - echo "FILEVERSION 1,0,0,1" >> $@ - echo "PRODUCTVERSION 1,0,0,1" >> $@ - echo "FILEFLAGSMASK 0x3fL" >> $@ - echo "FILEOS 0x4L" >> $@ - echo "FILETYPE $(VERSION_FT)" >> $@ - echo "FILESUBTYPE 0x0L" >> $@ - echo "BEGIN" >> $@ - echo " BLOCK \"StringFileInfo\"" >> $@ - echo " BEGIN" >> $@ - echo " BLOCK \"040904B0\"" >> $@ - echo " BEGIN" >> $@ - echo " VALUE \"CompanyName\", \"$(VERSION_RES_NAME)\\0\"" >> $@ - echo " VALUE \"FileVersion\", \"$(VERSION_RES)\\0\"" >> $@ - echo " VALUE \"ProductVersion\", \"$(VERSION_RES)\\0\"" >> $@ - echo " VALUE \"FileDescription\", \"$(VERSION_DESC)\\0\"" >> $@ - echo " END" >> $@ - echo " END" >> $@ - echo " BLOCK \"VarFileInfo\"" >> $@ - echo " BEGIN" >> $@ - echo " VALUE \"Translation\", 0x0409, 1200" >> $@ - echo " END" >> $@ - echo "END" >> $@ -else -# Regular static library -$(LIBRARY): $(LIBOBJS) - $(BUILD_STATIC_LIB) -endif # %.dll -endif # %.dylib -endif # %.so -endif # LIBRARY = "" - -include $(TOP)/mk/install.mk - -############################################################################## -# -# Targets: check tags show -# -############################################################################## - -#------------------------------------------------------------ -# Check - -.PHONY: check - -check:: $(TESTS) - @for i in $(filter-out %.lhs .hs, $(TESTS)) ''; do \ - if (test -f "$$i"); then \ - echo Running: `basename $$i` ; \ - cd test; `basename $$i` ; \ - fi; \ - done; - -#------------------------------------------------------------ -# Tags - -.PHONY: TAGS tags - -tags TAGS:: $(TAGS_HS_SRCS) $(TAGS_C_SRCS) - @$(RM) TAGS - @touch TAGS -ifneq "$(TAGS_HS_SRCS)" "" - $(HSTAGS) $(HSTAGS_OPTS) $(TAGS_HS_SRCS) -endif -ifneq "$(TAGS_C_SRCS)" "" - etags -a $(TAGS_C_SRCS) -endif - @( DEREFFED=`ls -l Makefile | sed -e 's/.*-> \(.*\)/\1/g'` && $(RM) `dirname $$DEREFFED`/TAGS && $(CP) TAGS `dirname $$DEREFFED` ) 2>/dev/null || echo TAGS file generated, perhaps copy over to source tree? - -################################################################################ -# -# DocBook XML Documentation -# -################################################################################ - -.PHONY: html html-no-chunks chm HxS fo dvi ps pdf - -ifneq "$(XML_DOC)" "" - -all :: $(XMLDocWays) - -# multi-file XML document: main document name is specified in $(XML_DOC), -# sub-documents (.xml files) listed in $(XML_SRCS). - -ifeq "$(XML_SRCS)" "" -XML_SRCS = $(wildcard *.xml) -endif - -XML_HTML = $(addsuffix /index.html,$(basename $(XML_DOC))) -XML_HTML_NO_CHUNKS = $(addsuffix .html,$(XML_DOC)) -XML_CHM = $(addsuffix .chm,$(XML_DOC)) -XML_HxS = $(addsuffix .HxS,$(XML_DOC)) -XML_FO = $(addsuffix .fo,$(XML_DOC)) -XML_DVI = $(addsuffix .dvi,$(XML_DOC)) -XML_PS = $(addsuffix .ps,$(XML_DOC)) -XML_PDF = $(addsuffix .pdf,$(XML_DOC)) - -$(XML_HTML) $(XML_NO_CHUNKS_HTML) $(XML_FO) $(XML_DVI) $(XML_PS) $(XML_PDF) :: $(XML_SRCS) - -html :: $(XML_HTML) -html-no-chunks :: $(XML_HTML_NO_CHUNKS) -chm :: $(XML_CHM) -HxS :: $(XML_HxS) -fo :: $(XML_FO) -dvi :: $(XML_DVI) -ps :: $(XML_PS) -pdf :: $(XML_PDF) - -CLEAN_FILES += $(XML_HTML_NO_CHUNKS) $(XML_FO) $(XML_DVI) $(XML_PS) $(XML_PDF) - -extraclean :: - $(RM) -rf $(XML_DOC).out $(FPTOOLS_CSS) $(basename $(XML_DOC)) $(basename $(XML_DOC))-htmlhelp - -validate :: - $(XMLLINT) --valid --noout $(XMLLINT_OPTS) $(XML_DOC).xml -endif - -############################################################################## -# -# Targets: clean -# -############################################################################## - -# we have to be careful about recursion here; since all the clean -# targets are recursive, we don't want to make eg. distclean depend on -# clean because that would result in far too many recursive calls. - -.PHONY: mostlyclean clean distclean maintainer-clean - -mostlyclean:: - rm -f $(MOSTLY_CLEAN_FILES) - -# extraclean is used for adding actions to the clean target. -extraclean:: - -clean:: extraclean - rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) - -distclean:: extraclean - rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) $(DIST_CLEAN_FILES) - -maintainer-clean:: extraclean - @echo 'This command is intended for maintainers to use; it' - @echo 'deletes files that may need special tools to rebuild.' - rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) $(DIST_CLEAN_FILES) $(MAINTAINER_CLEAN_FILES) - -################################################################################ -# -# Way management -# -################################################################################ - -# Here is the ingenious jiggery pokery that allows you to build multiple versions -# of a program in a single build tree. -# -# The ways setup requires the following variables to be set: -# -# Expects: $(WAYS) the possible "way" strings to one of -# which $(way) will be set - -ifneq "$(way)" "" -ifeq "$(findstring $(way), $(WAYS))" "" -$(error Unknown way $(way) of $(WAYS)) -endif -endif - -# So how does $(way) ever get set to anything? Answer, we recursively -# invoke make, setting $(way) on the command line. -# When do we do this recursion? Answer: whenever the programmer -# asks make to make a target that involves a way suffix. -# We must remember *not* to recurse again; but that's easy: we -# just see if $(way) is set: - -ifeq "$(way)" "" - -# If $(WAYS) = p mc, then WAY_TARGETS expands to -# %.p_lhs %.p_hs %.p_o ... %.mc_lhs %.p_hs ... -# and OTHER_WAY_TARGETS to -# %_p.a %_p %_mc.a %_mc -# where the suffixes are from $(SUFFIXES) -# -# We have to treat libraries and "other" targets differently, -# because their names are of the form -# libHS_p.a and Foo_p -# whereas everything else has names of the form -# Foo.p_o - -FPTOOLS_SUFFIXES := o hi hc - -WAY_TARGETS = $(foreach way,$(WAYS),$(foreach suffix, $(FPTOOLS_SUFFIXES), %.$(way)_$(suffix))) -LIB_WAY_TARGETS = $(foreach way,$(filter-out %dyn,$(WAYS)), %_$(way).a) -LIB_WAY_TARGETS_DYN = $(foreach way,$(filter %dyn,$(WAYS)), %$(subst dyn,-ghc$(ProjectVersion),$(subst _dyn,dyn,$(way)))$(soext)) - -# $@ will be something like Foo.p_o -# $(suffix $@) returns .p_o -# $(subst .,.p_o) returns p_o -# $(subst _,.,p_o) returns p.o (clever) -# $(basename p.o) returns p -# -$(WAY_TARGETS) : - $(MAKE) way=$(basename $(subst _,.,$(subst .,,$(suffix $@)))) $@ - -# $(@F) will be something like libHS_p.a, or Foo_p -# $(basename $(@F)) will be libHS_p, or Foo_p -# The sed script extracts the "p" part. - -$(LIB_WAY_TARGETS) : - $(MAKE) $(MFLAGS) $@ way=$(subst .,,$(suffix $(subst _,.,$(basename $@)))) - -$(LIB_WAY_TARGETS_DYN) : - $(MAKE) $(MFLAGS) $@ way=$(patsubst _dyn,dyn,$(subst .,,$(suffix $(subst _,.,$(basename $(subst -ghc$(ProjectVersion),,$@)))))_dyn) - -endif # if way - -# ------------------------------------------------------------------------- -# Object and interface files have suffixes tagged with their ways - -ifneq "$(way)" "" -SRC_HC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(way_)o -endif - -# ------------------------------------------------------------------------- -# Rules to invoke the current target recursively for each way - -ifneq "$(strip $(WAYS))" "" -ifeq "$(way)" "" - -# NB: the targets exclude -# boot runtests -# since these are way-independent -all docs TAGS clean distclean mostlyclean maintainer-clean install :: - @echo "------------------------------------------------------------------------" - @echo "== Recursively making \`$@' for ways: $(WAYS) ..." - @echo "PWD = $(shell pwd)" - @echo "------------------------------------------------------------------------" -# Don't rely on -e working, instead we check exit return codes from sub-makes. - case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ - for i in $(WAYS) ; do \ - echo "------------------------------------------------------------------------"; \ - echo "== $(MAKE) way=$$i $@;"; \ - echo "PWD = $(shell pwd)"; \ - echo "------------------------------------------------------------------------"; \ - $(MAKE) way=$$i --no-print-directory $(MFLAGS) $@ ; \ - if [ $$? -eq 0 ] ; then true; else exit $$x_on_err; fi; \ - done - @echo "------------------------------------------------------------------------" - @echo "== Finished recursively making \`$@' for ways: $(WAYS) ..." - @echo "PWD = $(shell pwd)" - @echo "------------------------------------------------------------------------" - -endif -endif - -include $(TOP)/mk/recurse.mk - -# ----------------------------------------------------------------------------- -# Further cleaning - -# Sometimes we want to clean things only after the recursve cleaning -# has heppened (eg. if the files we're about to remove would affect -# the recursive traversal). - -distclean:: - rm -f $(LATE_DIST_CLEAN_FILES) - -maintainer-clean:: - rm -f $(LATE_DIST_CLEAN_FILES) - diff --git a/mk/validate-settings.mk b/mk/validate-settings.mk index 7d647edfcc..53f635b3f8 100644 --- a/mk/validate-settings.mk +++ b/mk/validate-settings.mk @@ -14,14 +14,14 @@ GhcStage2HcOpts = -O -fasm # running of the tests, and faster building of the utils to be installed GhcLibHcOpts = -O -fasm -dcore-lint -GhcLibWays = +GhcLibWays = v SplitObjs = NO NoFibWays = STRIP = : GhcBootLibs = YES ifeq "$(ValidateHpc)" "YES" -GhcStage2HcOpts += -fhpc -hpcdir $(FPTOOLS_TOP_ABS)/testsuite/hpc_output/ +GhcStage2HcOpts += -fhpc -hpcdir $(TOP)/testsuite/hpc_output/ endif ifeq "$(ValidateSlow)" "YES" GhcStage2HcOpts += -XGenerics -DDEBUG |