Commit 6719dd92 authored by Alex Washburn's avatar Alex Washburn Committed by recursion-ninja

Correcting whitespace/alignment issues. Adding main source in more principled manner.

parent 6c6f2886
......@@ -1138,29 +1138,36 @@ gbuildSources verbosity specVer tmpDir bm =
return BuildSources {
cSourcesFiles = cSources bnfo,
cxxSourceFiles = cxxSources bnfo,
cxxSourceFiles = cxxSources bnfo,
inputSourceFiles = [main],
inputSourceModules = filter (/= mainModName) $ exeModules exe
}
else return BuildSources {
cSourcesFiles = cSources bnfo,
cxxSourceFiles = cxxSources bnfo,
cxxSourceFiles = cxxSources bnfo,
inputSourceFiles = [main],
inputSourceModules = exeModules exe
}
else return BuildSources {
cSourcesFiles = main : cSources bnfo,
cxxSourceFiles = main : cxxSources bnfo,
inputSourceFiles = [],
inputSourceModules = exeModules exe
}
else let (csf, cxxsf)
| isCxx main = ( cSources bnfo, main : cxxSources bnfo)
-- if main is not a Haskell source
-- and main is not a C++ source
-- then we assume that it is a C source
| otherwise = (main : cSources bnfo, cxxSources bnfo)
in return BuildSources {
cSourcesFiles = csf,
cxxSourceFiles = cxxsf,
inputSourceFiles = [],
inputSourceModules = exeModules exe
}
flibSources :: ForeignLib -> BuildSources
flibSources flib@ForeignLib{foreignLibBuildInfo = bnfo} =
BuildSources {
cSourcesFiles = cSources bnfo,
cxxSourceFiles = cxxSources bnfo,
cSourcesFiles = cSources bnfo,
cxxSourceFiles = cxxSources bnfo,
inputSourceFiles = [],
inputSourceModules = foreignLibModules flib
}
......@@ -1168,6 +1175,9 @@ gbuildSources verbosity specVer tmpDir bm =
isHaskell :: FilePath -> Bool
isHaskell fp = elem (takeExtension fp) [".hs", ".lhs"]
isCxx :: FilePath -> Bool
isCxx fp = elem (takeExtension fp) [".cpp", ".cxx", ".c++"]
-- | Generic build function. See comment for 'GBuildMode'.
gbuild :: Verbosity -> Cabal.Flag (Maybe Int)
-> PackageDescription -> LocalBuildInfo
......
......@@ -429,8 +429,10 @@ ppHsc2hs bi lbi clbi =
-- and C++ functions are exported via a C
-- interface and wrapped in a C source file.
-- Therefore we do not supply C++ flags
-- because there will not be C++ sources
{- ++ PD.cxxOptions bi -} ]
-- because there will not be C++ sources.
--
-- DO NOT add PD.cxxOptions unless this changes!
]
++ [ "--cflag=" ++ opt | opt <-
[ "-I" ++ autogenComponentModulesDir lbi clbi,
"-I" ++ autogenPackageModulesDir lbi,
......@@ -445,8 +447,7 @@ ppHsc2hs bi lbi clbi =
++ [ "--cflag=" ++ opt
| pkg <- pkgs
, opt <- [ "-I" ++ opt | opt <- Installed.includeDirs pkg ]
++ [ opt | opt <- Installed.ccOptions pkg
{- ++ Installed.cxxOptions pkg -} ] ]
++ [ opt | opt <- Installed.ccOptions pkg ] ]
++ [ "--lflag=" ++ opt
| pkg <- pkgs
, opt <- [ "-L" ++ opt | opt <- Installed.libraryDirs pkg ]
......@@ -515,9 +516,10 @@ ppC2hs bi lbi clbi =
-- and C++ functions are exported via a C
-- interface and wrapped in a C source file.
-- Therefore we do not supply C++ flags
-- because there will not be C++ sources
-- because there will not be C++ sources.
--
-- ++ Installed.cxxOptions pkg
--
-- DO NOT add Installed.cxxOptions unless this changes!
, c `elem` "DIU" ] ]
--TODO: install .chi files for packages, so we can --include
-- those dirs here, for the dependencies
......
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