Commit e3d95da8 authored by simonmar's avatar simonmar
Browse files

[project @ 2004-08-16 11:19:24 by simonmar]

Define <arch>_TARGET_ARCH and <os>_TARGET_OS by default when CPP'ing.
This avoids the main reason for needing to #include config.h into
Haskell source, so most files that previously just #include "config.h" can now

  #if __GLASGOW_HASKELL__ < 603
  #include "config.h"
  #endif
parent d6174f50
......@@ -192,6 +192,8 @@ $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile
@echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
@echo "cHOSTPLATFORM = \"$(HOSTPLATFORM)\"" >> $(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 "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
@echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
......
......@@ -41,7 +41,7 @@ module SMRep (
import Id ( Id, idType )
import Type ( Type, typePrimRep, PrimRep(..) )
import TyCon ( TyCon, tyConPrimRep )
import MachOp ( MachRep(..), MachHint(..), wordRep )
import MachOp-- ( MachRep(..), MachHint(..), wordRep )
import CmdLineOpts ( opt_SccProfilingOn, opt_GranMacros, opt_Unregisterised )
import Constants
import Outputable
......
......@@ -1167,11 +1167,16 @@ doCpp raw include_cc_opts input_fn output_fn = do
let cpp_prog args | raw = SysTools.runCpp args
| otherwise = SysTools.runCc (SysTools.Option "-E" : args)
let target_defs =
[ "-D" ++ cTARGETOS ++ "_TARGET_OS=1",
"-D" ++ cTARGETARCH ++ "_TARGET_ARCH=1" ]
cpp_prog ([SysTools.Option verb]
++ map SysTools.Option include_paths
++ map SysTools.Option hsSourceCppOpts
++ map SysTools.Option hscpp_opts
++ map SysTools.Option cc_opts
++ map SysTools.Option target_defs
++ [ SysTools.Option "-x"
, SysTools.Option "c"
, SysTools.Option input_fn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment