-# Compile GMP only if we don't have it already
-#
-# We use GMP's own configuration stuff, because it's all rather hairy
-# and not worth re-implementing in our Makefile framework.
-
-ifneq "$(HaveLibGmp)" "YES"
-ifneq "$(HaveFrameworkGMP)" "YES"
-boot ::
- if [ -f gmp/config.status ]; then \
- cd gmp && CC=$(WhatGccIsCalled) ./config.status; \
- else \
- cd gmp && CC=$(WhatGccIsCalled) $(SHELL) configure --enable-shared=no \
- --host=`echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g'`; \
- fi
-
-# Slight cheatage here to pass host as target, but x-compilation isn't supported by ghc.
-
-ifeq "$(way)" ""
-all :: gmp/libgmp.a
-
-ifeq "$(DLLized)" "YES"
-all :: $(DLL_PEN)/gmp.dll
-
-$(DLL_PEN)/gmp.dll:
- $(MAKE) -C gmp gmp.dll
- $(MV) gmp/gmp.dll $(DLL_PEN)
-endif
-endif
-
-install :: gmp/libgmp.a
-
-ifeq "$(way)" ""
-clean distclean maintainer-clean ::
- -$(MAKE) -C gmp MAKEFLAGS= $@
-
-INSTALL_LIBS += gmp/libgmp.a
-endif
-endif
-
-gmp/libgmp.a ::
- $(MAKE) -C gmp MAKEFLAGS=
- @$(CP) gmp/.libs/libgmp.a gmp
- @$(RANLIB) gmp/libgmp.a
-endif
-
-CLEAN_FILES += gmp/libgmp.a
-
-# Need to get the GMP vars in through CPP to package.conf.in, and put
-# quotes around each element.
-
-empty =
-space = $(empty) $(empty)
-comma = ,
-PACKAGE_CPP_OPTS += -DGMP_INCLUDE_DIRS='$(subst $(space),$(comma),$(patsubst %,"%",$(strip $(GMP_INCLUDE_DIRS))))'
-PACKAGE_CPP_OPTS += -DGMP_LIB_DIRS='$(subst $(space),$(comma),$(patsubst %,"%",$(strip $(GMP_LIB_DIRS))))'
-
-ifneq "$(GMP_INCLUDE_DIRS)" ""
-SRC_HC_OPTS += -I$(GMP_INCLUDE_DIRS)
-SRC_CC_OPTS += -I$(GMP_INCLUDE_DIRS)
-SRC_HSC2HS_OPTS += -I$(GMP_INCLUDE_DIRS)
-endif
-ifneq "$(GMP_LIB_DIRS)" ""
-SRC_LD_OPTS += -L$(GMP_LIB_DIRS)
-endif
-
-#-----------------------------------------------------------------------------
-#
-# Building the GUM SysMan
-#
-
-ifeq "$(way)" "mp"
-all :: parallel/SysMan
-
-ifdef solaris2_TARGET_OS
-__socket_libs = -lsocket -lnsl
-else
-__socket_libs =
-endif
-
-parallel/SysMan : parallel/SysMan.mp_o parallel/LLComms.mp_o RtsUtils.mp_o RtsFlags.mp_o
- $(RM) $@
- gcc -o $@ parallel/SysMan.mp_o parallel/LLComms.mp_o -L$$PVM_ROOT/lib/$$PVM_ARCH -lgpvm3 -lpvm3 $(__socket_libs)
-
-CLEAN_FILES += parallel/SysMan.mp_o parallel/SysMan
-INSTALL_LIBEXECS += parallel/SysMan
-endif
-
-#-----------------------------------------------------------------------------
-# Compiling the cmm files
-
-# ToDo: should we really include Rts.h here? Required for GNU_ATTRIBUTE().
-SRC_HC_OPTS += -I. -\#include HCIncludes.h
-
-ifeq "$(Windows)" "YES"
-PrimOps_HC_OPTS += -\#include '<windows.h>' -\#include win32/AsyncIO.h
-else
-PrimOps_HC_OPTS += -\#include posix/Itimer.h
-endif
-
-# Otherwise the stack-smash handler gets triggered.
-ifeq "$(TargetOS_CPP)" "openbsd"
-SRC_HC_OPTS += -optc-fno-stack-protector
-endif
-
-# -O3 helps unroll some loops (especially in copy() with a constant argument).
-sm/Evac_HC_OPTS += -optc-funroll-loops
-
-# Without this, thread_obj will not be inlined (at least on x86 with GCC 4.1.0)
-sm/Compact_HC_OPTS += -optc-finline-limit=2500
-
-# -fno-strict-aliasing is required for the runtime, because we often
-# use a variety of types to represent closure pointers (StgPtr,
-# StgClosure, StgMVar, etc.), and without -fno-strict-aliasing gcc is
-# allowed to assume that these pointers do not alias. eg. without
-# this flag we get problems in GC.c:copy() with gcc 3.4.3, the
-# upd_evacee() assigments get moved before the object copy.
-SRC_CC_OPTS += -fno-strict-aliasing
-
-# Cmm must be compiled via-C for now, because the NCG can't handle loops
-SRC_HC_OPTS += -fvia-C
-
-# We *want* type-checking of hand-written cmm.
-SRC_HC_OPTS += -dcmm-lint
-
-ifneq "$(BootingFromHc)" "YES"
-# .cmm files depend on all the .h files, to a first approximation.
-%.$(way_)o : %.cmm $(H_FILES)
- $(HC_PRE_OPTS)
- $(HC) $(HC_OPTS) -c $< -o $@
- $(HC_POST_OPTS)
-
-%.$(way_)hc : %.cmm $(H_FILES)
- $(HC) $(HC_OPTS) -C $< -o $@
-
-%.$(way_)s : %.cmm $(H_FILES)
- $(HC) $(HC_OPTS) -S $< -o $@
-endif
-
-include $(TOP)/mk/package.mk
-
-#-----------------------------------------------------------------------------
-#
-# Files to install
-#
-# Just libHSrts is installed uniformly across ways
-#
-ifeq "$(DLLized)" "YES"
-INSTALL_PROGS += gmp/gmp.dll
-INSTALL_LIBS += gmp/libgmp_imp.a Main.dll_o
-endif
-
-#-----------------------------------------------------------------------------
-#
-# binary-dist