[project @ 2005-01-28 12:55:17 by simonmar]
authorsimonmar <unknown>
Fri, 28 Jan 2005 12:56:27 +0000 (12:56 +0000)
committersimonmar <unknown>
Fri, 28 Jan 2005 12:56:27 +0000 (12:56 +0000)
commit153b9cb9b11e05c4edb1b6bc0a7b972660e41f70
treed532c123fb777ec6710efc6df98443772a8b4b04
parentbfdd44b2bfec3d819fd5ce19279832c25f096bb4
[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.
67 files changed:
ghc/compiler/HsVersions.h
ghc/compiler/Makefile
ghc/compiler/cmm/CLabel.hs
ghc/compiler/cmm/MachOp.hs
ghc/compiler/codeGen/CgProf.hs
ghc/compiler/codeGen/CgUtils.hs
ghc/compiler/ghci/InteractiveUI.hs
ghc/compiler/ghci/Linker.lhs
ghc/compiler/main/CmdLineOpts.lhs
ghc/compiler/main/Constants.lhs
ghc/compiler/main/DriverFlags.hs
ghc/compiler/main/DriverPhases.hs
ghc/compiler/main/DriverPipeline.hs
ghc/compiler/main/DriverState.hs
ghc/compiler/main/DriverUtil.hs
ghc/compiler/main/Main.hs
ghc/compiler/main/Packages.lhs
ghc/compiler/main/SysTools.lhs
ghc/compiler/nativeGen/MachInstrs.hs
ghc/compiler/nativeGen/NCG.h
ghc/compiler/nativeGen/PositionIndependentCode.hs
ghc/compiler/nativeGen/RegisterAlloc.hs
ghc/compiler/typecheck/TcForeign.lhs
ghc/compiler/utils/Panic.lhs
ghc/compiler/utils/Util.lhs
ghc/docs/comm/rts-libs/coding-style.html
ghc/docs/comm/the-beast/coding-style.html
ghc/docs/users_guide/phases.xml
ghc/includes/MachRegs.h
ghc/includes/Makefile
ghc/includes/Rts.h
ghc/includes/RtsConfig.h
ghc/includes/SMP.h
ghc/includes/Signals.h
ghc/includes/Stg.h
ghc/includes/StgMiscClosures.h
ghc/includes/TSO.h
ghc/includes/TailCalls.h
ghc/includes/mkDerivedConstants.c
ghc/lib/compat/Compat/Directory.hs
ghc/lib/compat/Compat/RawSystem.hs
ghc/lib/compat/cbits/directory.c
ghc/lib/compat/cbits/rawSystem.c
ghc/rts/Adjustor.c
ghc/rts/AdjustorAsm.S
ghc/rts/Exception.h
ghc/rts/HeapStackCheck.cmm
ghc/rts/Linker.c
ghc/rts/LinkerInternals.h
ghc/rts/MBlock.c
ghc/rts/MBlock.h
ghc/rts/PrimOps.cmm
ghc/rts/RtsFlags.c
ghc/rts/RtsStartup.c
ghc/rts/RtsUtils.c
ghc/rts/Sanity.c
ghc/rts/Schedule.c
ghc/rts/Signals.c
ghc/rts/Signals.h
ghc/rts/Stats.c
ghc/rts/StgCRun.c
ghc/rts/Timer.c
ghc/rts/package.conf.in
ghc/rts/parallel/ParTicky.c
ghc/utils/ghc-pkg/Main.hs
ghc/utils/hsc2hs/Main.hs
ghc/utils/hsc2hs/Makefile