[project @ 2001-06-13 10:23:23 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverState.hs
index 62a7976..8cad99c 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.34 2001/03/22 03:51:08 hwloidl Exp $
+-- $Id: DriverState.hs,v 1.43 2001/06/13 10:23:23 simonmar Exp $
 --
 -- Settings for the driver
 --
@@ -9,6 +9,7 @@
 
 module DriverState where
 
+#include "../includes/config.h"
 #include "HsVersions.h"
 
 import CmStaticInfo
@@ -37,7 +38,7 @@ cHaskell1Version = "5" -- i.e., Haskell 98
 -- 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
@@ -92,10 +93,14 @@ defaultHscLang
   | 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
@@ -113,12 +118,6 @@ osuf_ify f = do
        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)
@@ -322,6 +321,8 @@ addToDirList ref path
   = do paths <- readIORef ref
        writeIORef ref (paths ++ split split_marker path)
 
+GLOBAL_VAR(v_HCHeader, "", String)
+
 -----------------------------------------------------------------------------
 -- Packages
 
@@ -334,7 +335,7 @@ addPackage :: String -> IO ()
 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
@@ -345,7 +346,7 @@ addPackage package
 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
@@ -361,7 +362,7 @@ getPackageCIncludes = 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
@@ -404,6 +405,7 @@ lookupPkg nm ps
    = case [p | p <- ps, name p == nm] of
         []    -> Nothing
         (p:_) -> Just p
+
 -----------------------------------------------------------------------------
 -- Ways
 
@@ -460,7 +462,7 @@ findBuildTag :: IO [String]  -- new options
 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
@@ -468,7 +470,7 @@ findBuildTag = do
               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))
@@ -597,6 +599,10 @@ GLOBAL_VAR(v_Pgm_a,   cGCC,          String)
 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])