Commit 153b9cb9 authored by simonmar's avatar simonmar

[project @ 2005-01-28 12:55:17 by simonmar]

Rationalise the BUILD,HOST,TARGET defines.

Recall that:

  - build is the platform we're building on
  - host is the platform we're running on
  - target is the platform we're generating code for

The change is that now we take these definitions as applying from the
point of view of the particular source code being built, rather than
the point of view of the whole build tree.

For example, in RTS and library code, we were previously testing the
TARGET platform.  But under the new rule, the platform on which this
code is going to run is the HOST platform.  TARGET only makes sense in
the compiler sources.

In practical terms, this means that the values of BUILD, HOST & TARGET
may vary depending on which part of the build tree we are in.

Actual changes:

 - new file: includes/ghcplatform.h contains platform defines for
   the RTS and library code.

 - new file: includes/ghcautoconf.h contains the autoconf settings
   only (HAVE_BLAH).  This is so that we can get hold of these
   settings independently of the platform defines when necessary
   (eg. in GHC).

 - ghcconfig.h now #includes both ghcplatform.h and ghcautoconf.h.

 - MachRegs.h, which is included into both the compiler and the RTS,
   now has to cope with the fact that it might need to test either
   _TARGET_ or _HOST_ depending on the context.

 - the compiler's Makefile now generates
     stage{1,2,3}/ghc_boot_platform.h
   which contains platform defines for the compiler.  These differ
   depending on the stage, of course: in stage2, the HOST is the
   TARGET of stage1.  This was wrong before.

 - The compiler doesn't get platform info from Config.hs any more.
   Previously it did (sometimes), but unless we want to generate
   a new Config.hs for each stage we can't do this.

 - GHC now helpfully defines *_{BUILD,HOST}_{OS,ARCH} automatically
   in CPP'd Haskell source.

 - ghcplatform.h defines *_TARGET_* for backwards compatibility
   (ghcplatform.h is included by ghcconfig.h, which is included by
   config.h, so code which still #includes config.h will get the TARGET
   settings as before).

 - The Users's Guide is updated to mention *_HOST_* rather than
   *_TARGET_*.

 - coding-style.html in the commentary now contains a section on
   platform defines.  There are further doc updates to come.

Thanks to Wolfgang Thaller for pointing me in the right direction.
parent bfdd44b2
...@@ -10,6 +10,18 @@ you will screw up the layout where they are used in case expressions! ...@@ -10,6 +10,18 @@ you will screw up the layout where they are used in case expressions!
#endif #endif
/* Useful in the headers that we share with the RTS */
#define COMPILING_GHC 1
/* Pull in all the platform defines for this build (foo_TARGET_ARCH etc.) */
#include "ghc_boot_platform.h"
/* Pull in the autoconf defines (HAVE_FOO), but don't include
* ghcconfig.h, because that will include ghcplatform.h which has the
* wrong platform settings for the compiler (it has the platform
* settings for the target plat instead). */
#include "../includes/ghcautoconf.h"
#if __GLASGOW_HASKELL__ >= 504 #if __GLASGOW_HASKELL__ >= 504
#define CONCURRENT Control.Concurrent #define CONCURRENT Control.Concurrent
......
...@@ -194,9 +194,6 @@ $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile ...@@ -194,9 +194,6 @@ $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile
@echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS) @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
@echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS) @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
@echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS) @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
@echo "cTARGETPLATFORM = \"$(TARGETPLATFORM)\"" >> $(CONFIG_HS)
@echo "cTARGETOS = \"$(TargetOS_CPP)\"" >> $(CONFIG_HS)
@echo "cTARGETARCH = \"$(TargetArch_CPP)\"" >> $(CONFIG_HS)
@echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS) @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
@echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS) @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
@echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS) @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
...@@ -230,6 +227,112 @@ endif ...@@ -230,6 +227,112 @@ endif
CLEAN_FILES += $(CONFIG_HS) CLEAN_FILES += $(CONFIG_HS)
# -----------------------------------------------------------------------------
# Create platform includes
# Here we generate a little header file containing CPP symbols that GHC
# uses to determine which platform it is building on/for. The platforms
# can differ between stage1 and stage2 if we're cross-compiling, so we
# need one of these header files per stage.
PLATFORM_H = ghc_boot_platform.h
stage1/$(PLATFORM_H) : $(FPTOOLS_TOP)/mk/config.mk Makefile
@echo "Creating $@..."
@$(RM) $@
@echo "#ifndef __PLATFORM_H__" >$@
@echo "#define __PLATFORM_H__" >>$@
@echo >> $@
@echo "#define BuildPlatform_TYPE $(BuildPlatform_CPP)" >> $@
@echo "#define HostPlatform_TYPE $(HostPlatform_CPP)" >> $@
@echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
@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) : $(FPTOOLS_TOP)/mk/config.mk Makefile
@echo "Creating $@..."
@$(RM) $@
@echo "#ifndef __PLATFORM_H__" >$@
@echo "#define __PLATFORM_H__" >>$@
@echo >> $@
@echo "#define BuildPlatform_TYPE $(HostPlatform_CPP)" >> $@
@echo "#define HostPlatform_TYPE $(TargetPlatform_CPP)" >> $@
@echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
@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."
stage3/$(PLATFORM_H) : stage2/$(PLATFORM_H)
$(CP) stage2/$(PLATFORM_H) stage3/$(PLATFORM_H)
boot :: stage$(stage)/$(PLATFORM_H)
SRC_HC_OPTS += -Istage$(stage)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Set SRCS etc. # Set SRCS etc.
# #
......
...@@ -98,7 +98,6 @@ module CLabel ( ...@@ -98,7 +98,6 @@ module CLabel (
#include "HsVersions.h" #include "HsVersions.h"
#include "../includes/ghcconfig.h"
import CmdLineOpts ( DynFlags, opt_Static, opt_DoTickyProfiling ) import CmdLineOpts ( DynFlags, opt_Static, opt_DoTickyProfiling )
import Packages ( isHomeModule, isDllName ) import Packages ( isHomeModule, isDllName )
......
...@@ -80,7 +80,6 @@ module MachOp ( ...@@ -80,7 +80,6 @@ module MachOp (
) where ) where
#include "HsVersions.h" #include "HsVersions.h"
#include "../includes/ghcconfig.h"
import Constants import Constants
import Outputable import Outputable
......
...@@ -24,8 +24,6 @@ module CgProf ( ...@@ -24,8 +24,6 @@ module CgProf (
) where ) where
#include "HsVersions.h" #include "HsVersions.h"
#include "../includes/ghcconfig.h"
-- Needed by Constants.h
#include "../includes/Constants.h" #include "../includes/Constants.h"
-- For LDV_CREATE_MASK, LDV_STATE_USE -- For LDV_CREATE_MASK, LDV_STATE_USE
-- which are StgWords -- which are StgWords
......
...@@ -60,9 +60,6 @@ import Char ( ord ) ...@@ -60,9 +60,6 @@ import Char ( ord )
import DATA_BITS import DATA_BITS
import Maybe ( isNothing ) import Maybe ( isNothing )
#include "../includes/ghcconfig.h"
-- For WORDS_BIGENDIAN
------------------------------------------------------------------------- -------------------------------------------------------------------------
-- --
-- Random small functions -- Random small functions
......
{-# OPTIONS -#include "Linker.h" #-} {-# OPTIONS -#include "Linker.h" #-}
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- $Id: InteractiveUI.hs,v 1.184 2005/01/26 12:58:09 simonmar Exp $ -- $Id: InteractiveUI.hs,v 1.185 2005/01/28 12:55:23 simonmar Exp $
-- --
-- GHC Interactive User Interface -- GHC Interactive User Interface
-- --
...@@ -12,7 +12,6 @@ module InteractiveUI ( ...@@ -12,7 +12,6 @@ module InteractiveUI (
ghciWelcomeMsg ghciWelcomeMsg
) where ) where
#include "../includes/ghcconfig.h"
#include "HsVersions.h" #include "HsVersions.h"
import CompManager import CompManager
......
...@@ -20,7 +20,6 @@ module Linker ( HValue, showLinkerState, ...@@ -20,7 +20,6 @@ module Linker ( HValue, showLinkerState,
linkPackages, linkPackages,
) where ) where
#include "../includes/ghcconfig.h"
#include "HsVersions.h" #include "HsVersions.h"
import ObjLink ( loadDLL, loadObj, unloadObj, resolveObjs, initObjLinker ) import ObjLink ( loadDLL, loadObj, unloadObj, resolveObjs, initObjLinker )
......
...@@ -348,11 +348,10 @@ data PackageFlag ...@@ -348,11 +348,10 @@ data PackageFlag
| IgnorePackage String | IgnorePackage String
defaultHscTarget defaultHscTarget
| cGhcWithNativeCodeGen == "YES" && #if defined(i386_TARGET_ARCH) || defined(sparc_TARGET_ARCH) || defined(powerpc_TARGET_ARCH)
(prefixMatch "i386" cTARGETPLATFORM || | cGhcWithNativeCodeGen == "YES" = HscAsm
prefixMatch "sparc" cTARGETPLATFORM || #endif
prefixMatch "powerpc" cTARGETPLATFORM) = HscAsm | otherwise = HscC
| otherwise = HscC
defaultDynFlags = DynFlags { defaultDynFlags = DynFlags {
coreToDo = Nothing, stgToDo = [], coreToDo = Nothing, stgToDo = [],
......
...@@ -12,7 +12,6 @@ module Constants (module Constants) where ...@@ -12,7 +12,6 @@ module Constants (module Constants) where
-- be in trouble. -- be in trouble.
#include "HsVersions.h" #include "HsVersions.h"
#include "../includes/ghcconfig.h"
#include "../includes/MachRegs.h" #include "../includes/MachRegs.h"
#include "../includes/Constants.h" #include "../includes/Constants.h"
#include "../includes/MachDeps.h" #include "../includes/MachDeps.h"
......
...@@ -18,7 +18,6 @@ module DriverFlags ( ...@@ -18,7 +18,6 @@ module DriverFlags (
) where ) where
#include "HsVersions.h" #include "HsVersions.h"
#include "../includes/ghcconfig.h"
import MkIface ( showIface ) import MkIface ( showIface )
import DriverState import DriverState
...@@ -639,7 +638,7 @@ setMainIs arg ...@@ -639,7 +638,7 @@ setMainIs arg
-- ) -- )
machdepCCOpts dflags machdepCCOpts dflags
| prefixMatch "alpha" cTARGETPLATFORM #if alpha_TARGET_ARCH
= return ( ["-w", "-mieee" = return ( ["-w", "-mieee"
#ifdef HAVE_THREADED_RTS_SUPPORT #ifdef HAVE_THREADED_RTS_SUPPORT
, "-D_REENTRANT" , "-D_REENTRANT"
...@@ -649,12 +648,12 @@ machdepCCOpts dflags ...@@ -649,12 +648,12 @@ machdepCCOpts dflags
-- register used for global register variable", we simply -- register used for global register variable", we simply
-- disable all warnings altogether using the -w flag. Oh well. -- disable all warnings altogether using the -w flag. Oh well.
| prefixMatch "hppa" cTARGETPLATFORM #elif hppa_TARGET_ARCH
-- ___HPUX_SOURCE, not _HPUX_SOURCE, is #defined if -ansi! -- ___HPUX_SOURCE, not _HPUX_SOURCE, is #defined if -ansi!
-- (very nice, but too bad the HP /usr/include files don't agree.) -- (very nice, but too bad the HP /usr/include files don't agree.)
= return ( ["-D_HPUX_SOURCE"], [] ) = return ( ["-D_HPUX_SOURCE"], [] )
| prefixMatch "m68k" cTARGETPLATFORM #elif m68k_TARGET_ARCH
-- -fno-defer-pop : for the .hc files, we want all the pushing/ -- -fno-defer-pop : for the .hc files, we want all the pushing/
-- popping of args to routines to be explicit; if we let things -- popping of args to routines to be explicit; if we let things
-- be deferred 'til after an STGJUMP, imminent death is certain! -- be deferred 'til after an STGJUMP, imminent death is certain!
...@@ -666,7 +665,7 @@ machdepCCOpts dflags ...@@ -666,7 +665,7 @@ machdepCCOpts dflags
-- as on iX86, where we *do* steal the frame pointer [%ebp].) -- as on iX86, where we *do* steal the frame pointer [%ebp].)
= return ( [], ["-fno-defer-pop", "-fno-omit-frame-pointer"] ) = return ( [], ["-fno-defer-pop", "-fno-omit-frame-pointer"] )
| prefixMatch "i386" cTARGETPLATFORM #elif i386_TARGET_ARCH
-- -fno-defer-pop : basically the same game as for m68k -- -fno-defer-pop : basically the same game as for m68k
-- --
-- -fomit-frame-pointer : *must* in .hc files; because we're stealing -- -fomit-frame-pointer : *must* in .hc files; because we're stealing
...@@ -692,22 +691,22 @@ machdepCCOpts dflags ...@@ -692,22 +691,22 @@ machdepCCOpts dflags
"-DSTOLEN_X86_REGS="++show n_regs ] "-DSTOLEN_X86_REGS="++show n_regs ]
) )
| prefixMatch "ia64" cTARGETPLATFORM #elif ia64_TARGET_ARCH
= return ( [], ["-fomit-frame-pointer", "-G0"] ) = return ( [], ["-fomit-frame-pointer", "-G0"] )
| prefixMatch "x86_64" cTARGETPLATFORM #elif x86_64_TARGET_ARCH
= return ( [], ["-fomit-frame-pointer"] ) = return ( [], ["-fomit-frame-pointer"] )
| prefixMatch "mips" cTARGETPLATFORM #elif mips_TARGET_ARCH
= return ( ["-static"], [] ) = return ( ["-static"], [] )
| prefixMatch "sparc" cTARGETPLATFORM #elif sparc_TARGET_ARCH
= return ( [], ["-w"] ) = return ( [], ["-w"] )
-- For now, to suppress the gcc warning "call-clobbered -- For now, to suppress the gcc warning "call-clobbered
-- register used for global register variable", we simply -- register used for global register variable", we simply
-- disable all warnings altogether using the -w flag. Oh well. -- disable all warnings altogether using the -w flag. Oh well.
| prefixMatch "powerpc-apple-darwin" cTARGETPLATFORM #elif powerpc_apple_darwin_TARGET
-- -no-cpp-precomp: -- -no-cpp-precomp:
-- Disable Apple's precompiling preprocessor. It's a great thing -- Disable Apple's precompiling preprocessor. It's a great thing
-- for "normal" programs, but it doesn't support register variable -- for "normal" programs, but it doesn't support register variable
...@@ -724,11 +723,12 @@ machdepCCOpts dflags ...@@ -724,11 +723,12 @@ machdepCCOpts dflags
else return ( ["-no-cpp-precomp", "-mdynamic-no-pic"], else return ( ["-no-cpp-precomp", "-mdynamic-no-pic"],
["-mdynamic-no-pic"] ) ["-mdynamic-no-pic"] )
| prefixMatch "powerpc" cTARGETPLATFORM && opt_PIC #elif powerpc_TARGET_ARCH
| opt_PIC
= return ( ["-fPIC"], ["-fPIC"] ) = return ( ["-fPIC"], ["-fPIC"] )
| otherwise | otherwise
= return ( [], [] ) = return ( [], [] )
#endif
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- local utils -- local utils
......
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- $Id: DriverPhases.hs,v 1.32 2005/01/27 10:44:27 simonpj Exp $ -- $Id: DriverPhases.hs,v 1.33 2005/01/28 12:55:33 simonmar Exp $
-- --
-- GHC Driver -- GHC Driver
-- --
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
-- --
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
#include "../includes/ghcconfig.h"
module DriverPhases ( module DriverPhases (
HscSource(..), isHsBoot, hscSourceString, HscSource(..), isHsBoot, hscSourceString,
HscTarget(..), Phase(..), HscTarget(..), Phase(..),
......
...@@ -816,10 +816,12 @@ runPhase cc_phase todo dflags basename suff input_fn get_output_fn maybe_loc ...@@ -816,10 +816,12 @@ runPhase cc_phase todo dflags basename suff input_fn get_output_fn maybe_loc
runPhase Mangle todo dflags _basename _suff input_fn get_output_fn maybe_loc runPhase Mangle todo dflags _basename _suff input_fn get_output_fn maybe_loc
= do let mangler_opts = getOpts dflags opt_m = do let mangler_opts = getOpts dflags opt_m
machdep_opts <- if (prefixMatch "i386" cTARGETPLATFORM)
then do let n_regs = stolen_x86_regs dflags #if i386_TARGET_ARCH
return [ show n_regs ] machdep_opts <- return [ show (stolen_x86_regs dflags) ]
else return [] #else
machdep_opts <- return []
#endif
split <- readIORef v_Split_object_files split <- readIORef v_Split_object_files
let next_phase let next_phase
...@@ -1253,8 +1255,12 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do ...@@ -1253,8 +1255,12 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do
| otherwise = SysTools.runCc dflags (SysTools.Option "-E" : args) | otherwise = SysTools.runCc dflags (SysTools.Option "-E" : args)
let target_defs = let target_defs =
[ "-D" ++ cTARGETOS ++ "_TARGET_OS=1", [ "-D" ++ HOST_OS ++ "BUILD_OS=1",
"-D" ++ cTARGETARCH ++ "_TARGET_ARCH=1" ] "-D" ++ HOST_ARCH ++ "BUILD_ARCH=1",
"-D" ++ TARGET_OS ++ "HOST_OS=1",
"-D" ++ TARGET_ARCH ++ "HOST_ARCH=1" ]
-- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST.
cpp_prog ([SysTools.Option verb] cpp_prog ([SysTools.Option verb]
++ map SysTools.Option include_paths ++ map SysTools.Option include_paths
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
module DriverState where module DriverState where
#include "../includes/ghcconfig.h"
#include "HsVersions.h" #include "HsVersions.h"
import CmdLineOpts import CmdLineOpts
...@@ -128,14 +127,19 @@ GLOBAL_VAR(v_Split_info, ("",0), (String,Int)) ...@@ -128,14 +127,19 @@ GLOBAL_VAR(v_Split_info, ("",0), (String,Int))
can_split :: Bool can_split :: Bool
can_split = prefixMatch "i386" cTARGETPLATFORM can_split =
|| prefixMatch "alpha" cTARGETPLATFORM #if defined(i386_TARGET_ARCH) \
|| prefixMatch "hppa" cTARGETPLATFORM || defined(alpha_TARGET_ARCH) \
|| prefixMatch "m68k" cTARGETPLATFORM || defined(hppa_TARGET_ARCH) \
|| prefixMatch "mips" cTARGETPLATFORM || defined(m68k_TARGET_ARCH) \
|| prefixMatch "powerpc" cTARGETPLATFORM || defined(mips_TARGET_ARCH) \
|| prefixMatch "rs6000" cTARGETPLATFORM || defined(powerpc_TARGET_ARCH) \
|| prefixMatch "sparc" cTARGETPLATFORM || defined(rs6000_TARGET_ARCH) \
|| defined(sparc_TARGET_ARCH)
True
#else
False
#endif
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Compiler output options -- Compiler output options
......
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- $Id: DriverUtil.hs,v 1.49 2005/01/11 16:21:53 simonmar Exp $ -- $Id: DriverUtil.hs,v 1.50 2005/01/28 12:55:37 simonmar Exp $
-- --
-- Utils for the driver -- Utils for the driver
-- --
...@@ -19,7 +19,6 @@ module DriverUtil ( ...@@ -19,7 +19,6 @@ module DriverUtil (
replaceFilenameDirectory, remove_spaces, escapeSpaces, replaceFilenameDirectory, remove_spaces, escapeSpaces,
) where ) where
#include "../includes/ghcconfig.h"
#include "HsVersions.h" #include "HsVersions.h"
import Util import Util
......
{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-} {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- $Id: Main.hs,v 1.143 2005/01/27 10:44:39 simonpj Exp $ -- $Id: Main.hs,v 1.144 2005/01/28 12:55:38 simonmar Exp $
-- --
-- GHC Driver program -- GHC Driver program
-- --
...@@ -9,14 +9,10 @@ ...@@ -9,14 +9,10 @@
-- --
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- with path so that ghc -M can find config.h
#include "../includes/ghcconfig.h"
module Main (main) where module Main (main) where
#include "HsVersions.h" #include "HsVersions.h"
#ifdef GHCI #ifdef GHCI
import InteractiveUI( ghciWelcomeMsg, interactiveUI ) import InteractiveUI( ghciWelcomeMsg, interactiveUI )
#endif #endif
......
...@@ -34,9 +34,6 @@ module Packages ( ...@@ -34,9 +34,6 @@ module Packages (
) )
where where
#include "../includes/ghcconfig.h"
-- Needed for mingw32_TARGET_OS defn
#include "HsVersions.h" #include "HsVersions.h"
import PackageConfig import PackageConfig
...@@ -44,7 +41,7 @@ import DriverState ( v_Build_tag, v_RTS_Build_tag, v_Static ) ...@@ -44,7 +41,7 @@ import DriverState ( v_Build_tag, v_RTS_Build_tag, v_Static )
import SysTools ( getTopDir, getPackageConfigPath ) import SysTools ( getTopDir, getPackageConfigPath )
import ParsePkgConf ( loadPackageConfig ) import ParsePkgConf ( loadPackageConfig )
import CmdLineOpts ( DynFlags(..), PackageFlag(..), opt_Static ) import CmdLineOpts ( DynFlags(..), PackageFlag(..), opt_Static )
import Config ( cTARGETARCH, cTARGETOS, cProjectVersion ) import Config ( cProjectVersion )
import Name ( Name, nameModule_maybe ) import Name ( Name, nameModule_maybe )
import Module ( Module, mkModule ) import Module ( Module, mkModule )
import UniqFM import UniqFM
...@@ -206,7 +203,7 @@ readPackageConfigs dflags = do ...@@ -206,7 +203,7 @@ readPackageConfigs dflags = do
-- (GHC >= 6.3). -- (GHC >= 6.3).
appdir <- getAppUserDataDirectory "ghc" appdir <- getAppUserDataDirectory "ghc"
let let
pkgconf = appdir ++ '/':cTARGETARCH ++ '-':cTARGETOS pkgconf = appdir ++ '/':TARGET_ARCH ++ '-':TARGET_OS
++ '-':cProjectVersion ++ "/package.conf" ++ '-':cProjectVersion ++ "/package.conf"
-- --
exists <- doesFileExist pkgconf exists <- doesFileExist pkgconf
......
...@@ -84,8 +84,6 @@ import IO ( try, catch, ...@@ -84,8 +84,6 @@ import IO ( try, catch,