From: simonmar Date: Tue, 15 Feb 2005 11:24:51 +0000 (+0000) Subject: [project @ 2005-02-15 11:24:51 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~1068 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=ec1c2c022c729c9efe695d540dd585a5b2b08bab [project @ 2005-02-15 11:24:51 by simonmar] Fix endMkDependHS --- diff --git a/ghc/compiler/main/DriverMkDepend.hs b/ghc/compiler/main/DriverMkDepend.hs index dfcbe0f..bb00efe 100644 --- a/ghc/compiler/main/DriverMkDepend.hs +++ b/ghc/compiler/main/DriverMkDepend.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $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 -----------------------------------------------------------------