summaryrefslogtreecommitdiff
path: root/ghc/compiler/compMan/CompManager.lhs
diff options
context:
space:
mode:
authorsimonmar <unknown>2003-07-17 12:04:54 +0000
committersimonmar <unknown>2003-07-17 12:04:54 +0000
commit6677029a5084f59b4cd35d76ce3f19b154f2ac87 (patch)
tree08da4b511244d9e7533255efc9ebc2134310df84 /ghc/compiler/compMan/CompManager.lhs
parent2a86ebc211c02271fa035f5834eb9f0b2e3bd6e5 (diff)
downloadhaskell-6677029a5084f59b4cd35d76ce3f19b154f2ac87.tar.gz
[project @ 2003-07-17 12:04:50 by simonmar]
Filename-related cleanup & fixes -------------------------------- This commit rationalises some of our filename policies. The new story is this: When compiling a Haskell module A.B.C: The object file is placed in <obj-path>/A/B/C.o The interface file is placed in <hi-path>/A/B/C.hi Where <objpath> is - the argument of the -odir flag, if one was given - the element of the search path in which the source file was found, when in --make mode. - "." otherwise. Where <hipath> is - the argument of the -hidir flag, if one was given - the element of the search path in which the source file was found, when in --make mode. - "." otherwise. NOTE, in particular, that the name of the source file has no bearing on the name of the object or interface file any more. This is a nchange from the previous semantics, where the name of the object file would, under certain circumstances, follow the name of the source file. eg. before, if you said ghc -c dir/foo.hs you would get dir/foo.o. Now, you get something like Main.o, depending on what module is in foo.hs. This means that the driver pipeline machinery now needs to pass around a Maybe ModLocation, which is filled in by the Hsc phase and used later on to figure out the name of the object file (this was fairly painful, but seems to be the only way to get the right behaviour).
Diffstat (limited to 'ghc/compiler/compMan/CompManager.lhs')
-rw-r--r--ghc/compiler/compMan/CompManager.lhs12
1 files changed, 8 insertions, 4 deletions
diff --git a/ghc/compiler/compMan/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs
index b0e13b9586..9f79a16abc 100644
--- a/ghc/compiler/compMan/CompManager.lhs
+++ b/ghc/compiler/compMan/CompManager.lhs
@@ -720,7 +720,12 @@ ppFilesFromSummaries summaries
-- better make extra sure 'a' and 'b' are in canonical form
-- before using this equality test.
- isSameFilePath a b = a == b
+ isSameFilePath a b = fmap normalise a == fmap normalise b
+
+ -- a hack, because sometimes we strip off the leading "./" from a
+ -- a filename.
+ normalise ('.':'/':f) = f
+ normalise f = f
-----------------------------------------------------------------------------
-- getValidLinkables
@@ -1230,12 +1235,11 @@ summariseFile file
= do hspp_fn <- preprocess file
(srcimps,imps,mod_name) <- getImportsFromFile hspp_fn
- let (path, basename, ext) = splitFilename3 file
+ let (basename, ext) = splitFilename file
-- GHC.Prim doesn't exist physically, so don't go looking for it.
the_imps = filter (/= gHC_PRIM_Name) imps
- (mod, location) <- mkHomeModLocation mod_name True{-is a root-}
- path basename ext
+ (mod, location) <- mkHomeModLocation mod_name "." basename ext
src_timestamp
<- case ml_hs_file location of