cmmTopCodeGen no longer takes DynFlags as an argument
[ghc-hetmet.git] / compiler / Makefile
index dbc4725..f099ab7 100644 (file)
 # -----------------------------------------------------------------------------
-# Main compiler Makefile
-
-# Targets:
-#
-#      all     builds stage1 compiler
-#
-#      boot stage=N   generate build dirs and dependencies for stage N.
-#                     NB. Must be done before 'make stageN'.
-#                     NB. Cannot 'make boot stage=2' until stage1 has
-#                         been built (similarly for stage3).
 #
-#      stage1  (or stage=1) builds stage1 compiler
-#      stage2  (or stage=2) builds stage2 compiler
-#      stage3  (or stage=3) builds stage3 compiler
+# (c) 2009 The University of Glasgow
 #
-
-TOP = ..
-
-ifeq "$(stage)" ""
-stage=1
-endif
-
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/cabal-flags.mk
-
-ifeq "$(GhcThreaded) $(GhcProfiled)" "YES YES"
-$(error Cannot make GHC both threaded and profiled)
-endif
-
-CONFIG_HS      = main/Config.hs
-PRIMOP_BITS = primop-data-decl.hs-incl        \
-              primop-tag.hs-incl              \
-              primop-list.hs-incl             \
-              primop-has-side-effects.hs-incl \
-              primop-out-of-line.hs-incl      \
-              primop-commutable.hs-incl       \
-              primop-needs-wrapper.hs-incl    \
-              primop-can-fail.hs-incl         \
-              primop-strictness.hs-incl       \
-              primop-primop-info.hs-incl
-
-all:: build.stage$(stage)
-
-stage1 ::
-       $(MAKE) stage=1
-
-stage2 ::
-       $(MAKE) stage=2
-
-stage3 ::
-       $(MAKE) stage=3
-
-clean distclean::
-       -$(CABAL) clean --distpref dist-stage1
-       -$(CABAL) clean --distpref dist-stage2
-       $(RM) -f Makefile-stage1
-       $(RM) -f Makefile-stage2
-       $(RM) -f prelude/primops.txt
-       $(RM) -f $(PRIMOP_BITS)
-       $(RM) -f $(CONFIG_HS)
-
-ifeq "$(GhcWithInterpreter)" "YES"
-CONFIGURE_FLAGS_STAGE2 += --flags=ghci
-
-# If we are going to use dynamic libraries instead of .o files for ghci,
-# we will need to always retain CAFs in the compiler.
-# ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
-# function which sets the keepCAFs flag for the RTS before any Haskell
-# code is run.
-ifeq "$(GhcBuildDylibs)" "YES"
-CONFIGURE_FLAGS_STAGE2 += --flags=dynlibs
-else
-CONFIGURE_FLAGS_STAGE2 += --flags=-dynlibs
-endif
-
-ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
-# Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
-# or not?
-# XXX This should logically be a CPP option, but there doesn't seem to
-# be a flag for that
-CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DGHCI_TABLES_NEXT_TO_CODE
-endif
-
-# Should the debugger commands be enabled?
-ifeq "$(GhciWithDebugger)" "YES"
-CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DDEBUGGER
-endif
-
-# Enable editline if either:
-#   - we're building stage 1 and $(GhcHasEditline)="YES"
-#   - we're building stage 2/3, and we have built the editline package
+# This file is part of the GHC build system.
 #
-# But we don't enable editline on Windows, as Windows terminals have
-# editline-like support builtin.
+# To understand how the build system works and how to modify it, see
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
 #
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-CONFIGURE_FLAGS_STAGE1 += --flags=-editline
-CONFIGURE_FLAGS_STAGE2 += --flags=-editline
-else
-ifeq "$(GhcHasEditline)" "YES"
-CONFIGURE_FLAGS_STAGE1 += --flags=editline
-else
-CONFIGURE_FLAGS_STAGE1 += --flags=-editline
-endif
-ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/editline/unbuildable)" ""
-CONFIGURE_FLAGS_STAGE2 += --flags=editline
-else
-CONFIGURE_FLAGS_STAGE2 += --flags=-editline
-endif
-endif
-
-else
-CONFIGURE_FLAGS_STAGE2 += --flags=-ghci
-endif
-
-ifeq "$(GhcWithNativeCodeGen)" "NO"
-# XXX This should logically be a CPP option, but there doesn't seem to
-# be a flag for that
-CONFIGURE_FLAGS_STAGE1 += --ghc-option=-DOMIT_NATIVE_CODEGEN
-CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DOMIT_NATIVE_CODEGEN
-endif
-
-ifeq "$(TargetOS_CPP)" "openbsd"
-CONFIGURE_FLAGS_STAGE1 += --ld-options="-Xlinker -E"
-CONFIGURE_FLAGS_STAGE2 += --ld-options="-Xlinker -E"
-endif
-
-ifeq "$(GhcUnregisterised)" "NO"
-ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
-# needed for generating proper relocation in large binaries: trac #856
-CONFIGURE_FLAGS_STAGE1 += --ld-option=-Wl,--relax
-CONFIGURE_FLAGS_STAGE2 += --ld-option=-Wl,--relax
-endif
-endif
-
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-# The #include is vital for the via-C route with older compilers, else the C
-# compiler doesn't realise that the stcall foreign imports are indeed
-# stdcall, and doesn't generate the Foo@8 name for them
-# As it's only important for older compilers we don't need to do anything
-# for stage2+.
-CONFIGURE_FLAGS_STAGE1 += --ghc-options='-\#include <windows.h> -\#include <process.h>'
-endif
-
-# ghc_strlen percolates through so many modules that it is easier to get its
-# prototype via a global option instead of a myriad of per-file OPTIONS.
-# Again, this is only important for older compilers, so we don't do it in
-# stage 2+.
-CONFIGURE_FLAGS_STAGE1 += --ghc-options='-\#include "cutils.h"'
-
-build.stage1: $(PRIMOP_BITS)
-       $(CABAL) configure --distpref dist-stage1 \
-                          $(CONFIGURE_FLAGS_STAGE1) \
-                          $(INSTALL_DIRS_CONFIGURE_FLAGS) \
-                          $(USE_BOOT_CONFIGURE_FLAGS) \
-                          $(COMMON_CONFIGURE_FLAGS) \
-                          --flags=-ghci \
-                          --flags=stage1 \
-                          --ghc-option=-DSTAGE=1
-       $(RM) -f Makefile-stage1
-       $(CABAL) makefile  --distpref dist-stage1 -f Makefile-stage1
-       $(MAKE) -f Makefile-stage1 stage=1
-       $(CABAL) register  --distpref dist-stage1 --inplace
-
-build.stage2: $(PRIMOP_BITS)
-       $(CABAL) configure --distpref dist-stage2 \
-                          $(CONFIGURE_FLAGS_STAGE2) \
-                          $(INSTALL_DIRS_CONFIGURE_FLAGS) \
-                          $(USE_STAGE1_CONFIGURE_FLAGS) \
-                          $(COMMON_CONFIGURE_FLAGS) \
-                          --flags=-stage1 \
-                          --ghc-option=-DSTAGE=2
-       $(RM) -f Makefile-stage2
-       $(CABAL) makefile  --distpref dist-stage2 -f Makefile-stage2
-       $(MAKE) -f Makefile-stage2 stage=2
-       $(CABAL) register  --distpref dist-stage2 --inplace
-
-stage_dirs :
-       $(MKDIRHIER) stage$(stage)
-
-boot :: stage_dirs
-
 # -----------------------------------------------------------------------------
-# Create compiler configuration
-#
-# The 'echo' commands simply spit the values of various make variables
-# into Config.hs, whence they can be compiled and used by GHC itself
-
-boot :: $(CONFIG_HS)
 
-$(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
-       @$(RM) -f $(CONFIG_HS)
-       @echo "Creating $(CONFIG_HS) ... "
-       @echo "module Config where" >>$(CONFIG_HS)
-       @echo "cProjectName          :: String" >> $(CONFIG_HS)
-       @echo "cProjectName          = \"$(ProjectName)\"" >> $(CONFIG_HS)
-       @echo "cProjectVersion       :: String" >> $(CONFIG_HS)
-       @echo "cProjectVersion       = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
-       @echo "cProjectVersionInt    :: String" >> $(CONFIG_HS)
-       @echo "cProjectVersionInt    = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
-       @echo "cProjectPatchLevel    :: String" >> $(CONFIG_HS)
-       @echo "cProjectPatchLevel    = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
-       @echo "cBooterVersion        :: String" >> $(CONFIG_HS)
-       @echo "cBooterVersion        = \"$(GhcVersion)\"" >> $(CONFIG_HS)
-       @echo "cStage                :: String" >> $(CONFIG_HS)
-       @echo "cStage                = show (STAGE :: Int)" >> $(CONFIG_HS)
-       @echo "cHscIfaceFileVersion  :: String" >> $(CONFIG_HS)
-       @echo "cHscIfaceFileVersion  = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
-       @echo "cSplitObjs            :: String" >> $(CONFIG_HS)
-       @echo "cSplitObjs            = \"$(SplitObjs)\"" >> $(CONFIG_HS)
-       @echo "cGhcWithInterpreter   :: String" >> $(CONFIG_HS)
-       @echo "cGhcWithInterpreter   = \"$(GhcWithInterpreter)\"" >> $(CONFIG_HS)
-       @echo "cGhcWithNativeCodeGen :: String" >> $(CONFIG_HS)
-       @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
-       @echo "cGhcWithSMP           :: String" >> $(CONFIG_HS)
-       @echo "cGhcWithSMP           = \"$(GhcWithSMP)\"" >> $(CONFIG_HS)
-       @echo "cGhcRTSWays           :: String" >> $(CONFIG_HS)
-       @echo "cGhcRTSWays           = \"$(GhcRTSWays)\"" >> $(CONFIG_HS)
-       @echo "cGhcUnregisterised    :: String" >> $(CONFIG_HS)
-       @echo "cGhcUnregisterised    = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
-       @echo "cGhcEnableTablesNextToCode :: String" >> $(CONFIG_HS)
-       @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
-       @echo "cLeadingUnderscore    :: String" >> $(CONFIG_HS)
-       @echo "cLeadingUnderscore    = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
-       @echo "cRAWCPP_FLAGS         :: String" >> $(CONFIG_HS)
-       @echo "cRAWCPP_FLAGS         = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
-       @echo "cGCC                  :: String" >> $(CONFIG_HS)
-       @echo "cGCC                  = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
-       @echo "cMKDLL                :: String" >> $(CONFIG_HS)
-       @echo "cMKDLL                = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
-       @echo "cLdIsGNULd            :: String" >> $(CONFIG_HS)
-       @echo "cLdIsGNULd            = \"$(LdIsGNULd)\"" >> $(CONFIG_HS)
-       @echo "cLD_X                 :: String" >> $(CONFIG_HS)
-       @echo "cLD_X                 = \"$(LD_X)\"" >> $(CONFIG_HS)
-       @echo "cGHC_DRIVER_DIR_REL   :: String" >> $(CONFIG_HS)
-       @echo "cGHC_DRIVER_DIR_REL   = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
-       @echo "cGHC_TOUCHY_PGM       :: String" >> $(CONFIG_HS)
-       @echo "cGHC_TOUCHY_PGM       = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
-       @echo "cGHC_TOUCHY_DIR_REL   :: String" >> $(CONFIG_HS)
-       @echo "cGHC_TOUCHY_DIR_REL   = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
-       @echo "cGHC_UNLIT_PGM        :: String" >> $(CONFIG_HS)
-       @echo "cGHC_UNLIT_PGM        = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
-       @echo "cGHC_UNLIT_DIR_REL    :: String" >> $(CONFIG_HS)
-       @echo "cGHC_UNLIT_DIR_REL    = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
-       @echo "cGHC_MANGLER_PGM      :: String" >> $(CONFIG_HS)
-       @echo "cGHC_MANGLER_PGM      = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
-       @echo "cGHC_MANGLER_DIR_REL  :: String" >> $(CONFIG_HS)
-       @echo "cGHC_MANGLER_DIR_REL  = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
-       @echo "cGHC_SPLIT_PGM        :: String" >> $(CONFIG_HS)
-       @echo "cGHC_SPLIT_PGM        = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
-       @echo "cGHC_SPLIT_DIR_REL    :: String" >> $(CONFIG_HS)
-       @echo "cGHC_SPLIT_DIR_REL    = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
-       @echo "cGHC_SYSMAN_PGM       :: String" >> $(CONFIG_HS)
-       @echo "cGHC_SYSMAN_PGM       = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
-       @echo "cGHC_SYSMAN_DIR_REL   :: String" >> $(CONFIG_HS)
-       @echo "cGHC_SYSMAN_DIR_REL   = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
-       @echo "cGHC_CP               :: String" >> $(CONFIG_HS)
-       @echo "cGHC_CP               = \"$(GHC_CP)\"" >> $(CONFIG_HS)
-       @echo "cGHC_PERL             :: String" >> $(CONFIG_HS)
-       @echo "cGHC_PERL             = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
-       @echo "cEnableWin32DLLs      :: String" >> $(CONFIG_HS)
-       @echo "cEnableWin32DLLs      = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
-       @echo "cCONTEXT_DIFF         :: String" >> $(CONFIG_HS)
-       @echo "cCONTEXT_DIFF         = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
-       @echo "cUSER_WAY_NAMES       :: String" >> $(CONFIG_HS)
-       @echo "cUSER_WAY_NAMES       = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
-       @echo "cUSER_WAY_OPTS        :: String" >> $(CONFIG_HS)
-       @echo "cUSER_WAY_OPTS        = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
-       @echo "cDEFAULT_TMPDIR       :: String" >> $(CONFIG_HS)
-       @echo "cDEFAULT_TMPDIR       = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
-       @echo "cRelocatableBuild     :: Bool"                 >> $(CONFIG_HS)
-ifeq "$(RelocatableBuild)" "YES"
-       @echo "cRelocatableBuild     = True"                  >> $(CONFIG_HS)
-else
-       @echo "cRelocatableBuild     = False"                 >> $(CONFIG_HS)
-endif
-       @echo "cLibFFI               :: Bool"                 >> $(CONFIG_HS)
-ifeq "$(UseLibFFIForAdjustors)" "YES"
-       @echo "cLibFFI               = True"                  >> $(CONFIG_HS)
-else
-       @echo "cLibFFI               = False"                 >> $(CONFIG_HS)
-endif
-       @echo done.
-
-# -----------------------------------------------------------------------------
-# Create platform includes
+# If the user says 'make' or 'make stage=2' here, we behave as if they were
+# in the ghc directory instead, so that the executable GHC gets built.
+.PHONY: default_to_ghc all_ghc
+default_to_ghc : all_ghc
 
-# Here we generate a little header file containing CPP symbols that GHC
-# uses to determine which platform it is building on/for.  The platforms
-# can differ between stage1 and stage2 if we're cross-compiling, so we
-# need one of these header files per stage.
+dir = compiler
 
-PLATFORM_H = ghc_boot_platform.h
+include ../mk/compiler-ghc.mk
 
-stage1/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
-       @echo "Creating $@..."
-       @$(RM) $@
-       @echo "#ifndef __PLATFORM_H__"  >$@
-       @echo "#define __PLATFORM_H__" >>$@
-       @echo >> $@
-       @echo "#define BuildPlatform_NAME  \"$(BUILDPLATFORM)\"" >> $@
-       @echo "#define HostPlatform_NAME   \"$(HOSTPLATFORM)\"" >> $@
-       @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
-       @echo >> $@
-       @echo "#define $(BuildPlatform_CPP)_BUILD       1" >> $@
-       @echo "#define $(HostPlatform_CPP)_HOST         1" >> $@
-       @echo "#define $(TargetPlatform_CPP)_TARGET     1" >> $@
-       @echo >> $@
-       @echo "#define $(BuildArch_CPP)_BUILD_ARCH      1" >> $@
-       @echo "#define $(HostArch_CPP)_HOST_ARCH        1" >> $@
-       @echo "#define $(TargetArch_CPP)_TARGET_ARCH    1" >> $@
-       @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
-       @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
-       @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
-       @echo >> $@
-       @echo "#define $(BuildOS_CPP)_BUILD_OS          1" >> $@
-       @echo "#define $(HostOS_CPP)_HOST_OS            1" >> $@
-       @echo "#define $(TargetOS_CPP)_TARGET_OS        1" >> $@  
-       @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
-       @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
-       @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
-       @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
-       @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
-       @echo "#endif                                    " >> $@  
-endif
-       @echo >> $@
-       @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR  1" >> $@
-       @echo "#define $(HostVendor_CPP)_HOST_VENDOR    1" >> $@
-       @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
-       @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
-       @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
-       @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
-       @echo >> $@
-       @echo "#endif /* __PLATFORM_H__ */"          >> $@
-       @echo "Done."
-
-# For stage2 and above, the BUILD platform is the HOST of stage1, and
-# the HOST platform is the TARGET of stage1.  The TARGET remains the same
-# (stage1 is the cross-compiler, not stage2).
-stage2/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
-       @echo "Creating $@..."
-       @$(RM) $@
-       @echo "#ifndef __PLATFORM_H__"  >$@
-       @echo "#define __PLATFORM_H__" >>$@
-       @echo >> $@
-       @echo "#define BuildPlatform_NAME  \"$(HOSTPLATFORM)\"" >> $@
-       @echo "#define HostPlatform_NAME   \"$(TARGETPLATFORM)\"" >> $@
-       @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
-       @echo >> $@
-       @echo "#define $(HostPlatform_CPP)_BUILD        1" >> $@
-       @echo "#define $(TargetPlatform_CPP)_HOST               1" >> $@
-       @echo "#define $(TargetPlatform_CPP)_TARGET     1" >> $@
-       @echo >> $@
-       @echo "#define $(HostArch_CPP)_BUILD_ARCH       1" >> $@
-       @echo "#define $(TargetArch_CPP)_HOST_ARCH      1" >> $@
-       @echo "#define $(TargetArch_CPP)_TARGET_ARCH    1" >> $@
-       @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
-       @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
-       @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
-       @echo >> $@
-       @echo "#define $(HostOS_CPP)_BUILD_OS           1" >> $@
-       @echo "#define $(TargetOS_CPP)_HOST_OS          1" >> $@
-       @echo "#define $(TargetOS_CPP)_TARGET_OS        1" >> $@  
-       @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
-       @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
-       @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
-ifeq "$(HostOS_CPP)" "irix"
-       @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
-       @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
-       @echo "#endif                                    " >> $@  
-endif
-       @echo >> $@
-       @echo "#define $(HostVendor_CPP)_BUILD_VENDOR   1" >> $@
-       @echo "#define $(TargetVendor_CPP)_HOST_VENDOR  1" >> $@
-       @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
-       @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
-       @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
-       @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
-       @echo >> $@
-       @echo "#endif /* __PLATFORM_H__ */"          >> $@
-       @echo "Done."
-
-STAGE_PLATFORM_H = stage$(stage)/$(PLATFORM_H)
-
-boot :: $(STAGE_PLATFORM_H)
-
-# ----------------------------------------------------------------------------
-#              Generate supporting stuff for prelude/PrimOp.lhs 
-#              from prelude/primops.txt
-
-SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
-SRC_CPP_OPTS += ${GhcCppOpts}
-
-prelude/primops.txt parser/Parser.y: %: %.pp stage1/$(PLATFORM_H)
-       $(CPP) $(RAWCPP_FLAGS) -P $(CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
-
-primop-data-decl.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --data-decl          < $< > $@
-primop-tag.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --primop-tag         < $< > $@
-primop-list.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --primop-list        < $< > $@
-primop-has-side-effects.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --has-side-effects   < $< > $@
-primop-out-of-line.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --out-of-line        < $< > $@
-primop-commutable.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --commutable         < $< > $@
-primop-needs-wrapper.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --needs-wrapper      < $< > $@
-primop-can-fail.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --can-fail           < $< > $@
-primop-strictness.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --strictness         < $< > $@
-primop-primop-info.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --primop-primop-info < $< > $@
-
-# Usages aren't used any more; but the generator 
-# can still generate them if we want them back
-primop-usage.hs-incl: prelude/primops.txt
-       $(GENPRIMOP) --usage              < $< > $@
-
-# XXX:
-#-----------------------------------------------------------------------------
-# binary-dist
-#
-#binary-dist:
-#      $(INSTALL_DIR)                         $(BIN_DIST_DIR)/compiler
-#      $(INSTALL_DIR)                         $(BIN_DIST_DIR)/compiler/stage$(stage)
-#      echo "stage=$(stage)"                > $(BIN_DIST_DIR)/compiler/Makefile
-#      cat Makefile                        >> $(BIN_DIST_DIR)/compiler/Makefile
-#      $(INSTALL_DATA)    package.conf.in     $(BIN_DIST_DIR)/compiler/
-#      set -e; for d in stage$(stage)/*/; do $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/$$d; done
-#      set -e; for f in $(HS_IFACES); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-#ifneq "$(INSTALL_LIBS)" ""
-#      set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-#endif
-#ifneq "$(INSTALL_PROGS)" ""
-#      set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-#endif
-#ifneq "$(INSTALL_LIBEXECS)" ""
-#      set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
-#endif
+all_ghc :
+       +$(TOPMAKE) all_ghc $(EXTRA_MAKE_OPTS)