-----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.31 2001/03/01 17:07:49 simonpj Exp $
+-- $Id: DriverState.hs,v 1.43 2001/06/13 10:23:23 simonmar Exp $
--
-- Settings for the driver
--
module DriverState where
+#include "../includes/config.h"
#include "HsVersions.h"
import CmStaticInfo
-- Global compilation flags
-- location of compiler-related files
-GLOBAL_VAR(v_TopDir, clibdir, String)
+GLOBAL_VAR(v_TopDir, error "no TOPDIR", String)
-- Cpp-related flags
v_Hs_source_cpp_opts = global
| otherwise = HscC
GLOBAL_VAR(v_Output_dir, Nothing, Maybe String)
-GLOBAL_VAR(v_Object_suf, Nothing, Maybe String)
GLOBAL_VAR(v_Output_file, Nothing, Maybe String)
GLOBAL_VAR(v_Output_hi, Nothing, Maybe String)
+GLOBAL_VAR(v_Object_suf, Nothing, Maybe String)
+GLOBAL_VAR(v_HC_suf, Nothing, Maybe String)
+GLOBAL_VAR(v_Hi_dir, Nothing, Maybe String)
+GLOBAL_VAR(v_Hi_suf, "hi", String)
+
GLOBAL_VAR(v_Ld_inputs, [], [String])
odir_ify :: String -> IO String
Just s -> return (newsuf s f)
-----------------------------------------------------------------------------
--- Hi Files
-
-GLOBAL_VAR(v_Hi_on_stdout, False, Bool)
-GLOBAL_VAR(v_Hi_suf, "hi", String)
-
------------------------------------------------------------------------------
-- Compiler optimisation options
GLOBAL_VAR(v_OptLevel, 0, Int)
else
CoreDoNothing,
if opt_level >= 2 then
- CoreDoSimplify (isAmongSimpl [
- MaxSimplifierIterations max_iter
- -- No -finline-phase: allow all Ids to be inlined now
- ])
- else
- CoreDoNothing,
- -- Simplify before SpecConstr, because LiberateCase leaves
- -- case binders the wrong way round. E.g. it leaves it like
- -- case x of wild { ... f x .... }
- -- rather than
- -- case x of wild { ... f wild ... }
- -- The latter is better because 'wild' has the unfolding for
- -- x inside it.
- if opt_level >= 2 then
CoreDoSpecConstr
else
CoreDoNothing,
= do paths <- readIORef ref
writeIORef ref (paths ++ split split_marker path)
+GLOBAL_VAR(v_HCHeader, "", String)
+
-----------------------------------------------------------------------------
-- Packages
addPackage package
= do pkg_details <- readIORef v_Package_details
case lookupPkg package pkg_details of
- Nothing -> throwDyn (OtherError ("unknown package name: " ++ package))
+ Nothing -> throwDyn (CmdLineError ("unknown package name: " ++ package))
Just details -> do
ps <- readIORef v_Packages
unless (package `elem` ps) $ do
getPackageImportPath :: IO [String]
getPackageImportPath = do
ps <- getPackageInfo
- return (nub (concat (map import_dirs ps)))
+ return (nub (filter (not.null) (concatMap import_dirs ps)))
getPackageIncludePath :: IO [String]
getPackageIncludePath = do
getPackageLibraryPath :: IO [String]
getPackageLibraryPath = do
ps <- getPackageInfo
- return (nub (concat (map library_dirs ps)))
+ return (nub (filter (not.null) (concatMap library_dirs ps)))
getPackageLibraries :: IO [String]
getPackageLibraries = do
ps <- getPackageInfo
return (concatMap extra_ld_opts ps)
-getPackageInfo :: IO [Package]
+getPackageInfo :: IO [PackageConfig]
getPackageInfo = do
ps <- readIORef v_Packages
getPackageDetails ps
-getPackageDetails :: [String] -> IO [Package]
+getPackageDetails :: [String] -> IO [PackageConfig]
getPackageDetails ps = do
pkg_details <- readIORef v_Package_details
return [ pkg | p <- ps, Just pkg <- [ lookupPkg p pkg_details ] ]
-GLOBAL_VAR(v_Package_details, (error "package_details"), [Package])
+GLOBAL_VAR(v_Package_details, (error "package_details"), [PackageConfig])
-lookupPkg :: String -> [Package] -> Maybe Package
+lookupPkg :: String -> [PackageConfig] -> Maybe PackageConfig
lookupPkg nm ps
= case [p | p <- ps, name p == nm] of
[] -> Nothing
(p:_) -> Just p
+
-----------------------------------------------------------------------------
-- Ways
findBuildTag = do
way_names <- readIORef v_Ways
case sort way_names of
- [] -> do writeIORef v_Build_tag ""
+ [] -> do -- writeIORef v_Build_tag ""
return []
[w] -> do let details = lkupWay w
return (wayOpts details)
ws -> if not (allowed_combination ws)
- then throwDyn (OtherError $
+ then throwDyn (CmdLineError $
"combination not supported: " ++
foldr1 (\a b -> a ++ '/':b)
(map (wayName . lkupWay) ws))
(WayUnreg, Way "u" "Unregisterised"
unregFlags ),
+ -- optl's below to tell linker where to find the PVM library -- HWL
(WayPar, Way "mp" "Parallel"
[ "-fparallel"
, "-D__PARALLEL_HASKELL__"
, "-optc-DPAR"
, "-package concurrent"
+ , "-optc-w"
+ , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
+ , "-optl-lpvm3"
+ , "-optl-lgpvm3"
, "-fvia-C" ]),
- (WayGran, Way "mg" "Gransim"
+ -- at the moment we only change the RTS and could share compiler and libs!
+ (WayPar, Way "mt" "Parallel ticky profiling"
+ [ "-fparallel"
+ , "-D__PARALLEL_HASKELL__"
+ , "-optc-DPAR"
+ , "-optc-DPAR_TICKY"
+ , "-package concurrent"
+ , "-optc-w"
+ , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
+ , "-optl-lpvm3"
+ , "-optl-lgpvm3"
+ , "-fvia-C" ]),
+
+ (WayPar, Way "md" "Distributed"
+ [ "-fparallel"
+ , "-D__PARALLEL_HASKELL__"
+ , "-D__DISTRIBUTED_HASKELL__"
+ , "-optc-DPAR"
+ , "-optc-DDIST"
+ , "-package concurrent"
+ , "-optc-w"
+ , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}"
+ , "-optl-lpvm3"
+ , "-optl-lgpvm3"
+ , "-fvia-C" ]),
+
+ (WayGran, Way "mg" "GranSim"
[ "-fgransim"
, "-D__GRANSIM__"
, "-optc-DGRAN"
GLOBAL_VAR(v_Pgm_l, cGCC, String)
GLOBAL_VAR(v_Pgm_dll, cMkDLL, String)
+#if defined(mingw32_TARGET_OS) && defined(MINIMAL_UNIX_DEPS)
+GLOBAL_VAR(v_Pgm_T, cTOUCH, String)
+#endif
+
GLOBAL_VAR(v_Opt_dep, [], [String])
GLOBAL_VAR(v_Anti_opt_C, [], [String])
GLOBAL_VAR(v_Opt_C, [], [String])