-runPhase SplitAs stop dflags basename _suff _input_fn get_output_fn maybe_loc
- = do
- output_fn <- get_output_fn dflags StopLn maybe_loc
-
- let (base_o, _) = splitFilename output_fn
- split_odir = base_o ++ "_split"
- osuf = objectSuf dflags
-
- createDirectoryHierarchy split_odir
-
- -- remove M_split/ *.o, because we're going to archive M_split/ *.o
- -- later and we don't want to pick up any old objects.
- fs <- getDirectoryContents split_odir
- mapM_ removeFile $ map (split_odir `joinFileName`)
- $ filter (osuf `isSuffixOf`) fs
-
- let as_opts = getOpts dflags opt_a
-
- (split_s_prefix, n) <- readIORef v_Split_info
-
- let split_s n = split_s_prefix ++ "__" ++ show n `joinFileExt` "s"
- split_obj n = split_odir `joinFileName`
- filenameOf base_o ++ "__" ++ show n
- `joinFileExt` osuf
-
- let assemble_file n
- = SysTools.runAs dflags
- (map SysTools.Option as_opts ++
- [ SysTools.Option "-c"
- , SysTools.Option "-o"
- , SysTools.FileOption "" (split_obj n)
- , SysTools.FileOption "" (split_s n)
- ])
-
- mapM_ assemble_file [1..n]
-
- -- and join the split objects into a single object file:
- let ld_r args = SysTools.runLink dflags ([
- SysTools.Option "-nostdlib",
- SysTools.Option "-nodefaultlibs",
- SysTools.Option "-Wl,-r",
- SysTools.Option ld_x_flag,
- SysTools.Option "-o",
- SysTools.FileOption "" output_fn ] ++ args)
+runPhase SplitAs _stop dflags _basename _suff _input_fn get_output_fn maybe_loc
+ = do
+ output_fn <- get_output_fn dflags StopLn maybe_loc
+
+ let base_o = dropExtension output_fn
+ split_odir = base_o ++ "_split"
+ osuf = objectSuf dflags
+
+ createDirectoryHierarchy split_odir
+
+ -- remove M_split/ *.o, because we're going to archive M_split/ *.o
+ -- later and we don't want to pick up any old objects.
+ fs <- getDirectoryContents split_odir
+ mapM_ removeFile $ map (split_odir </>) $ filter (osuf `isSuffixOf`) fs
+
+ let as_opts = getOpts dflags opt_a
+
+ (split_s_prefix, n) <- readIORef v_Split_info
+
+ let split_s n = split_s_prefix ++ "__" ++ show n <.> "s"
+ split_obj n = split_odir </>
+ takeFileName base_o ++ "__" ++ show n <.> osuf
+
+ let assemble_file n
+ = SysTools.runAs dflags
+ (map SysTools.Option as_opts ++
+ [ SysTools.Option "-c"
+ , SysTools.Option "-o"
+ , SysTools.FileOption "" (split_obj n)
+ , SysTools.FileOption "" (split_s n)
+ ])
+
+ mapM_ assemble_file [1..n]
+
+ -- and join the split objects into a single object file:
+ let ld_r args = SysTools.runLink dflags ([
+ SysTools.Option "-nostdlib",
+ SysTools.Option "-nodefaultlibs",
+ SysTools.Option "-Wl,-r",
+ SysTools.Option ld_x_flag,
+ SysTools.Option "-o",
+ SysTools.FileOption "" output_fn ] ++ args)