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
@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)
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
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