summaryrefslogtreecommitdiff
path: root/ghc/compiler/main/MkIface.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/main/MkIface.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/main/MkIface.lhs')
-rw-r--r--ghc/compiler/main/MkIface.lhs7
1 files changed, 4 insertions, 3 deletions
diff --git a/ghc/compiler/main/MkIface.lhs b/ghc/compiler/main/MkIface.lhs
index f06c7c33a6..49d428f002 100644
--- a/ghc/compiler/main/MkIface.lhs
+++ b/ghc/compiler/main/MkIface.lhs
@@ -64,6 +64,7 @@ import Module ( Module, ModuleName, moduleNameFS, moduleName, isHomeModule,
extendModuleEnv_C, moduleEnvElts
)
import Outputable
+import DriverUtil ( createDirectoryHierarchy, directoryOf )
import Util ( sortLt, dropList, seqList )
import Binary ( getBinFileWithDict )
import BinIface ( writeBinIface, v_IgnoreHiVersion )
@@ -168,9 +169,9 @@ mkIface hsc_env location maybe_old_iface
; let (final_iface, maybe_diffs) = _scc_ "versioninfo" addVersionInfo maybe_old_iface iface_w_decls
-- Write the interface file, if necessary
- ; when (must_write_hi_file maybe_diffs)
- (writeBinIface hi_file_path final_iface)
--- (writeIface hi_file_path final_iface)
+ ; when (must_write_hi_file maybe_diffs) $ do
+ createDirectoryHierarchy (directoryOf hi_file_path)
+ writeBinIface hi_file_path final_iface
-- Debug printing
; write_diffs dflags final_iface maybe_diffs