Commit ec1c2c02 authored by simonmar's avatar simonmar

[project @ 2005-02-15 11:24:51 by simonmar]

Fix endMkDependHS
parent 30841d13
-----------------------------------------------------------------------------
-- $Id: DriverMkDepend.hs,v 1.40 2005/02/04 15:43:32 simonpj Exp $
-- $Id: DriverMkDepend.hs,v 1.41 2005/02/15 11:24:51 simonmar Exp $
--
-- GHC Driver
--
......@@ -268,36 +268,36 @@ insertSuffixes file_name extras
endMkDependHS :: DynFlags -> MkDepFiles -> IO ()
endMkDependHS dflags
(MkDep { mkd_make_file = make_file, mkd_make_hdl = makefile_hdl,
mkd_tmp_file = tmp_file, mkd_tmp_hdl = tmp_hdl })
= do { -- write the magic marker into the tmp file
hPutStrLn tmp_hdl depEndMarker
; case makefile_hdl of {
Nothing -> return ();
Just hdl -> do
{
(MkDep { mkd_make_file = makefile, mkd_make_hdl = makefile_hdl,
mkd_tmp_file = tmp_file, mkd_tmp_hdl = tmp_hdl })
= do
-- write the magic marker into the tmp file
hPutStrLn tmp_hdl depEndMarker
case makefile_hdl of
Nothing -> return ()
Just hdl -> do
-- slurp the rest of the original makefile and copy it into the output
let slurp = do
let slurp = do
l <- hGetLine hdl
hPutStrLn tmp_hdl l
slurp
; catchJust ioErrors slurp
catchJust ioErrors slurp
(\e -> if isEOFError e then return () else ioError e)
; hClose hdl
hClose hdl
; hClose tmp_hdl -- make sure it's flushed
hClose tmp_hdl -- make sure it's flushed
-- Create a backup of the original makefile
; when (isJust makefile_hdl)
(SysTools.copy dflags ("Backing up " ++ make_file)
make_file (make_file++".bak"))
-- Create a backup of the original makefile
when (isJust makefile_hdl)
(SysTools.copy dflags ("Backing up " ++ makefile)
makefile (makefile++".bak"))
-- Copy the new makefile in place
; SysTools.copy dflags "Installing new makefile" tmp_file make_file
}}}
-- Copy the new makefile in place
SysTools.copy dflags "Installing new makefile" tmp_file makefile
-----------------------------------------------------------------
......
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