-----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.26 2001/02/01 11:47:53 simonmar 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)
-
------------------------------------------------------------------------------
--- Warnings & sanity checking
-
--- Warning packages that are controlled by -W and -Wall. The 'standard'
--- warnings that you get all the time are
---
--- -fwarn-overlapping-patterns
--- -fwarn-missing-methods
--- -fwarn-missing-fields
--- -fwarn-deprecations
--- -fwarn-duplicate-exports
---
--- these are turned off by -Wnot.
-
-
-standardWarnings = [ "-fwarn-overlapping-patterns"
- , "-fwarn-missing-methods"
- , "-fwarn-missing-fields"
- , "-fwarn-deprecations"
- , "-fwarn-duplicate-exports"
- ]
-minusWOpts = standardWarnings ++
- [ "-fwarn-unused-binds"
- , "-fwarn-unused-matches"
- , "-fwarn-incomplete-patterns"
- , "-fwarn-unused-imports"
- ]
-minusWallOpts = minusWOpts ++
- [ "-fwarn-type-defaults"
- , "-fwarn-name-shadowing"
- , "-fwarn-missing-signatures"
- , "-fwarn-hi-shadowing"
- ]
-
-data WarningState = W_default | W_ | W_all | W_not
-GLOBAL_VAR(v_Warning_opt, W_default, WarningState)
-
------------------------------------------------------------------------------
-- Compiler optimisation options
GLOBAL_VAR(v_OptLevel, 0, Int)
[
"-fignore-interface-pragmas",
"-fomit-interface-pragmas",
+ "-fdo-lambda-eta-expansion", -- This one is important for a tiresome reason:
+ -- we want to make sure that the bindings for data
+ -- constructors are eta-expanded. This is probably
+ -- a good thing anyway, but it seems fragile.
"-flet-no-escape"
]
-- these are the static flags you get when -O is on.
hsc_minusO_flags =
[
+ "-fignore-asserts",
"-ffoldr-build-on",
"-fdo-eta-reduction",
"-fdo-lambda-eta-expansion",
- "-fcase-of-case",
"-fcase-merge",
"-flet-to-case",
"-flet-no-escape"
CoreLiberateCase
else
CoreDoNothing,
+ if opt_level >= 2 then
+ CoreDoSpecConstr
+ else
+ CoreDoNothing,
-- Final clean-up simplification:
CoreDoSimplify (isAmongSimpl [
= 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])