1 -----------------------------------------------------------------------------
2 -- $Id: DriverPipeline.hs,v 1.13 2000/10/30 18:13:15 sewardj Exp $
6 -- (c) Simon Marlow 2000
8 -----------------------------------------------------------------------------
10 module DriverPipeline (
12 -- interfaces for the batch-mode driver
13 GhcMode(..), getGhcMode, v_GhcMode,
14 genPipeline, runPipeline,
16 -- interfaces for the compilation manager (interpreted/batch-mode)
19 -- batch-mode linking interface
23 #include "HsVersions.h"
50 -----------------------------------------------------------------------------
51 -- GHC modes of operation
54 = DoMkDependHS -- ghc -M
55 | DoMkDLL -- ghc -mk-dll
56 | StopBefore Phase -- ghc -E | -C | -S | -c
57 | DoMake -- ghc --make
58 | DoInteractive -- ghc --interactive
59 | DoLink -- [ the default ]
62 GLOBAL_VAR(v_GhcMode, error "todo", GhcMode)
64 modeFlag :: String -> Maybe GhcMode
65 modeFlag "-M" = Just $ DoMkDependHS
66 modeFlag "-E" = Just $ StopBefore Hsc
67 modeFlag "-C" = Just $ StopBefore HCc
68 modeFlag "-S" = Just $ StopBefore As
69 modeFlag "-c" = Just $ StopBefore Ln
70 modeFlag "--make" = Just $ DoMake
71 modeFlag "--interactive" = Just $ DoInteractive
74 getGhcMode :: [String]
75 -> IO ( [String] -- rest of command line
77 , String -- "GhcMode" flag
80 = case my_partition modeFlag flags of
81 ([] , rest) -> return (rest, DoLink, "") -- default is to do linking
82 ([(flag,one)], rest) -> return (rest, one, flag)
85 "only one of the flags -M, -E, -C, -S, -c, --make, --interactive is allowed")
87 -----------------------------------------------------------------------------
90 -- Herein is all the magic about which phases to run in which order, whether
91 -- the intermediate files should be in /tmp or in the current directory,
92 -- what the suffix of the intermediate files should be, etc.
94 -- The following compilation pipeline algorithm is fairly hacky. A
95 -- better way to do this would be to express the whole comilation as a
96 -- data flow DAG, where the nodes are the intermediate files and the
97 -- edges are the compilation phases. This framework would also work
98 -- nicely if a haskell dependency generator was included in the
101 -- It would also deal much more cleanly with compilation phases that
102 -- generate multiple intermediates, (eg. hsc generates .hc, .hi, and
103 -- possibly stub files), where some of the output files need to be
104 -- processed further (eg. the stub files need to be compiled by the C
107 -- A cool thing to do would then be to execute the data flow graph
108 -- concurrently, automatically taking advantage of extra processors on
109 -- the host machine. For example, when compiling two Haskell files
110 -- where one depends on the other, the data flow graph would determine
111 -- that the C compiler from the first comilation can be overlapped
112 -- with the hsc comilation for the second file.
114 data IntermediateFileType
120 :: GhcMode -- when to stop
121 -> String -- "stop after" flag (for error messages)
122 -> String -- original filename
123 -> IO [ -- list of phases to run for this file
125 IntermediateFileType, -- keep the output from this phase?
126 String) -- output file suffix
129 genPipeline todo stop_flag filename
131 split <- readIORef v_Split_object_files
132 mangle <- readIORef v_Do_asm_mangling
133 lang <- readIORef v_Hsc_Lang
134 keep_hc <- readIORef v_Keep_hc_files
135 keep_raw_s <- readIORef v_Keep_raw_s_files
136 keep_s <- readIORef v_Keep_s_files
139 ----------- ----- ---- --- -- -- - - -
140 (_basename, suffix) = splitFilename filename
142 start_phase = startPhase suffix
144 haskellish = haskellish_suffix suffix
145 cish = cish_suffix suffix
147 -- for a .hc file, or if the -C flag is given, we need to force lang to HscC
148 real_lang | suffix == "hc" = HscC
152 ----------- ----- ---- --- -- -- - - -
154 | todo == DoMkDependHS = [ Unlit, Cpp, MkDependHS ]
158 HscC | split && mangle -> [ Unlit, Cpp, Hsc, HCc, Mangle,
159 SplitMangle, SplitAs ]
160 | mangle -> [ Unlit, Cpp, Hsc, HCc, Mangle, As ]
162 | otherwise -> [ Unlit, Cpp, Hsc, HCc, As ]
164 HscAsm | split -> [ Unlit, Cpp, Hsc, SplitMangle, SplitAs ]
165 | otherwise -> [ Unlit, Cpp, Hsc, As ]
167 HscJava | split -> not_valid
168 | otherwise -> error "not implemented: compiling via Java"
172 | otherwise = [ ] -- just pass this file through to the linker
174 -- ToDo: this is somewhat cryptic
175 not_valid = throwDyn (OtherError ("invalid option combination"))
176 ----------- ----- ---- --- -- -- - - -
178 -- this shouldn't happen.
179 if start_phase /= Ln && start_phase `notElem` pipeline
180 then throwDyn (OtherError ("can't find starting phase for "
184 -- if we can't find the phase we're supposed to stop before,
185 -- something has gone wrong.
189 && phase `notElem` pipeline
190 && not (phase == As && SplitAs `elem` pipeline)) $
192 ("flag " ++ stop_flag
193 ++ " is incompatible with source file `" ++ filename ++ "'"))
197 ----------- ----- ---- --- -- -- - - -
199 :: [Phase] -- raw pipeline
200 -> Phase -- phase to stop before
201 -> [(Phase, IntermediateFileType, String{-file extension-})]
202 annotatePipeline [] _ = []
203 annotatePipeline (Ln:_) _ = []
204 annotatePipeline (phase:next_phase:ps) stop =
205 (phase, keep_this_output, phaseInputExt next_phase)
206 : annotatePipeline (next_phase:ps) stop
209 | next_phase == stop = Persistent
213 Mangle | keep_raw_s -> Persistent
214 As | keep_s -> Persistent
215 HCc | keep_hc -> Persistent
218 -- add information about output files to the pipeline
219 -- the suffix on an output file is determined by the next phase
220 -- in the pipeline, so we add linking to the end of the pipeline
221 -- to force the output from the final phase to be a .o file.
222 stop_phase = case todo of StopBefore phase -> phase
225 annotated_pipeline = annotatePipeline (pipeline ++ [ Ln ]) stop_phase
227 phase_ne p (p1,_,_) = (p1 /= p)
228 ----------- ----- ---- --- -- -- - - -
231 dropWhile (phase_ne start_phase) .
232 foldr (\p ps -> if phase_ne stop_phase p then p:ps else []) []
237 :: [ (Phase, IntermediateFileType, String) ] -- phases to run
238 -> String -- input file
239 -> Bool -- doing linking afterward?
240 -> Bool -- take into account -o when generating output?
241 -> IO String -- return final filename
243 runPipeline pipeline input_fn do_linking use_ofile
244 = pipeLoop pipeline input_fn do_linking use_ofile basename suffix
245 where (basename, suffix) = splitFilename input_fn
247 pipeLoop [] input_fn _ _ _ _ = return input_fn
248 pipeLoop ((phase, keep, o_suffix):phases)
249 input_fn do_linking use_ofile orig_basename orig_suffix
252 output_fn <- outputFileName (null phases) keep o_suffix
254 carry_on <- run_phase phase orig_basename orig_suffix input_fn output_fn
255 -- sometimes we bail out early, eg. when the compiler's recompilation
256 -- checker has determined that recompilation isn't necessary.
258 then do let (_,keep,final_suffix) = last phases
259 ofile <- outputFileName True keep final_suffix
261 else do -- carry on ...
263 -- sadly, ghc -E is supposed to write the file to stdout. We
264 -- generate <file>.cpp, so we also have to cat the file here.
265 when (null phases && phase == Cpp) $
266 run_something "Dump pre-processed file to stdout"
267 ("cat " ++ output_fn)
269 pipeLoop phases output_fn do_linking use_ofile orig_basename orig_suffix
272 outputFileName last_phase keep suffix
273 = do o_file <- readIORef v_Output_file
274 if last_phase && not do_linking && use_ofile && isJust o_file
277 Nothing -> error "outputFileName"
278 else if keep == Persistent
279 then do f <- odir_ify (orig_basename ++ '.':suffix)
281 else newTempName suffix
283 -------------------------------------------------------------------------------
286 run_phase Unlit _basename _suff input_fn output_fn
287 = do unlit <- readIORef v_Pgm_L
288 unlit_flags <- getOpts opt_L
289 run_something "Literate pre-processor"
290 ("echo '# 1 \"" ++input_fn++"\"' > "++output_fn++" && "
291 ++ unlit ++ ' ':input_fn ++ " - >> " ++ output_fn)
294 -------------------------------------------------------------------------------
297 run_phase Cpp _basename _suff input_fn output_fn
298 = do src_opts <- getOptionsFromSource input_fn
299 _ <- processArgs dynamic_flags src_opts []
301 do_cpp <- readState cpp_flag
304 cpp <- readIORef v_Pgm_P
305 hscpp_opts <- getOpts opt_P
306 hs_src_cpp_opts <- readIORef v_Hs_source_cpp_opts
308 cmdline_include_paths <- readIORef v_Include_paths
309 pkg_include_dirs <- getPackageIncludePath
310 let include_paths = map (\p -> "-I"++p) (cmdline_include_paths
314 run_something "C pre-processor"
316 (["echo '{-# LINE 1 \"" ++ input_fn ++ "\" -}'", ">", output_fn, "&&",
321 ++ [ "-x", "c", input_fn, ">>", output_fn ]
324 run_something "Ineffective C pre-processor"
325 ("echo '{-# LINE 1 \"" ++ input_fn ++ "\" -}' > "
326 ++ output_fn ++ " && cat " ++ input_fn
327 ++ " >> " ++ output_fn)
330 -----------------------------------------------------------------------------
333 run_phase MkDependHS basename suff input_fn _output_fn = do
334 src <- readFile input_fn
335 let imports = getImports src
337 deps <- mapM (findDependency basename) imports
339 osuf_opt <- readIORef v_Output_suf
340 let osuf = case osuf_opt of
344 extra_suffixes <- readIORef v_Dep_suffixes
345 let suffixes = osuf : map (++ ('_':osuf)) extra_suffixes
346 ofiles = map (\suf -> basename ++ '.':suf) suffixes
348 objs <- mapM odir_ify ofiles
350 hdl <- readIORef v_Dep_tmp_hdl
352 -- std dependeny of the object(s) on the source file
353 hPutStrLn hdl (unwords objs ++ " : " ++ basename ++ '.':suff)
355 let genDep (dep, False {- not an hi file -}) =
356 hPutStrLn hdl (unwords objs ++ " : " ++ dep)
357 genDep (dep, True {- is an hi file -}) = do
358 hisuf <- readIORef v_Hi_suf
359 let dep_base = remove_suffix '.' dep
360 deps = (dep_base ++ hisuf)
361 : map (\suf -> dep_base ++ suf ++ '_':hisuf) extra_suffixes
362 -- length objs should be == length deps
363 sequence_ (zipWith (\o d -> hPutStrLn hdl (o ++ " : " ++ d)) objs deps)
365 mapM genDep [ d | Just d <- deps ]
369 -- add the lines to dep_makefile:
373 -- if the dependency is on something other than a .hi file:
374 -- this.o this.p_o ... : dep
376 -- if the import is {-# SOURCE #-}
377 -- this.o this.p_o ... : dep.hi-boot[-$vers]
380 -- this.o ... : dep.hi
381 -- this.p_o ... : dep.p_hi
384 -- (where .o is $osuf, and the other suffixes come from
385 -- the cmdline -s options).
387 -----------------------------------------------------------------------------
390 -- Compilation of a single module, in "legacy" mode (_not_ under
391 -- the direction of the compilation manager).
392 run_phase Hsc basename suff input_fn output_fn
395 -- we add the current directory (i.e. the directory in which
396 -- the .hs files resides) to the import path, since this is
397 -- what gcc does, and it's probably what you want.
398 let current_dir = getdir basename
400 paths <- readIORef v_Include_paths
401 writeIORef v_Include_paths (current_dir : paths)
403 -- figure out where to put the .hi file
404 ohi <- readIORef v_Output_hi
405 hisuf <- readIORef v_Hi_suf
406 let hifile = case ohi of
407 Nothing -> current_dir ++ "/" ++ basename
411 -- figure out if the source has changed, for recompilation avoidance.
412 -- only do this if we're eventually going to generate a .o file.
413 -- (ToDo: do when generating .hc files too?)
415 -- Setting source_unchanged to "-fsource-unchanged" means that M.o seems
416 -- to be up to date wrt M.hs; so no need to recompile unless imports have
417 -- changed (which the compiler itself figures out).
418 -- Setting source_unchanged to "" tells the compiler that M.o is out of
419 -- date wrt M.hs (or M.o doesn't exist) so we must recompile regardless.
420 do_recomp <- readIORef v_Recomp
421 todo <- readIORef v_GhcMode
422 o_file <- odir_ify (basename ++ '.':phaseInputExt Ln)
424 if not (do_recomp && ( todo == DoLink || todo == StopBefore Ln ))
426 else do t1 <- getModificationTime (basename ++ '.':suff)
427 o_file_exists <- doesFileExist o_file
429 then return "" -- Need to recompile
430 else do t2 <- getModificationTime o_file
432 then return "-fsource-unchanged"
435 -- build a bogus ModuleLocation to pass to hscMain.
436 let location = ModuleLocation {
437 ml_hs_file = Nothing,
438 ml_hspp_file = Just input_fn,
439 ml_hi_file = Just hifile,
440 ml_obj_file = Just o_file
444 dyn_flags <- readIORef v_DynFlags
447 pcs <- initPersistentCompilerState
448 result <- hscMain dyn_flags{ hscOutName = output_fn }
449 (source_unchanged == "-fsource-unchanged")
452 emptyModuleEnv -- HomeSymbolTable
453 emptyModuleEnv -- HomeIfaceTable
458 HscFail pcs -> throwDyn (PhaseFailed "hsc" (ExitFailure 1));
460 HscOK details maybe_iface maybe_stub_h maybe_stub_c
461 _maybe_interpreted_code pcs -> do
464 maybe_stub_o <- dealWithStubs basename maybe_stub_h maybe_stub_c
467 Just stub_o -> add v_Ld_inputs stub_o
472 -----------------------------------------------------------------------------
475 -- we don't support preprocessing .c files (with -E) now. Doing so introduces
476 -- way too many hacks, and I can't say I've ever used it anyway.
478 run_phase cc_phase _basename _suff input_fn output_fn
479 | cc_phase == Cc || cc_phase == HCc
480 = do cc <- readIORef v_Pgm_c
481 cc_opts <- (getOpts opt_c)
482 cmdline_include_dirs <- readIORef v_Include_paths
484 let hcc = cc_phase == HCc
486 -- add package include paths even if we're just compiling
487 -- .c files; this is the Value Add(TM) that using
488 -- ghc instead of gcc gives you :)
489 pkg_include_dirs <- getPackageIncludePath
490 let include_paths = map (\p -> "-I"++p) (cmdline_include_dirs
493 c_includes <- getPackageCIncludes
494 cmdline_includes <- readState cmdline_hc_includes -- -#include options
496 let cc_injects | hcc = unlines (map mk_include
497 (c_includes ++ reverse cmdline_includes))
501 '"':_{-"-} -> "#include "++h_file
502 '<':_ -> "#include "++h_file
503 _ -> "#include \""++h_file++"\""
505 cc_help <- newTempName "c"
506 h <- openFile cc_help WriteMode
508 hPutStrLn h ("#include \"" ++ input_fn ++ "\"\n")
511 ccout <- newTempName "ccout"
513 mangle <- readIORef v_Do_asm_mangling
514 (md_c_flags, md_regd_c_flags) <- machdepCCOpts
518 o2 <- readIORef v_minus_o2_for_C
519 let opt_flag | o2 = "-O2"
522 pkg_extra_cc_opts <- getPackageExtraCcOpts
524 excessPrecision <- readIORef v_Excess_precision
526 run_something "C Compiler"
527 (unwords ([ cc, "-x", "c", cc_help, "-o", output_fn ]
529 ++ (if cc_phase == HCc && mangle
532 ++ [ verb, "-S", "-Wimplicit", opt_flag ]
533 ++ [ "-D__GLASGOW_HASKELL__="++cProjectVersionInt ]
535 #ifdef mingw32_TARGET_OS
538 ++ (if excessPrecision then [] else [ "-ffloat-store" ])
545 -- ToDo: postprocess the output from gcc
547 -----------------------------------------------------------------------------
550 run_phase Mangle _basename _suff input_fn output_fn
551 = do mangler <- readIORef v_Pgm_m
552 mangler_opts <- getOpts opt_m
554 if (prefixMatch "i386" cTARGETPLATFORM)
555 then do n_regs <- readState stolen_x86_regs
556 return [ show n_regs ]
558 run_something "Assembly Mangler"
561 ++ [ input_fn, output_fn ]
566 -----------------------------------------------------------------------------
569 run_phase SplitMangle _basename _suff input_fn _output_fn
570 = do splitter <- readIORef v_Pgm_s
572 -- this is the prefix used for the split .s files
573 tmp_pfx <- readIORef v_TmpDir
575 let split_s_prefix = tmp_pfx ++ "/ghc" ++ show x
576 writeIORef v_Split_prefix split_s_prefix
577 addFilesToClean [split_s_prefix ++ "__*"] -- d:-)
579 -- allocate a tmp file to put the no. of split .s files in (sigh)
580 n_files <- newTempName "n_files"
582 run_something "Split Assembly File"
589 -- save the number of split files for future references
590 s <- readFile n_files
591 let n = read s :: Int
592 writeIORef v_N_split_files n
595 -----------------------------------------------------------------------------
598 run_phase As _basename _suff input_fn output_fn
599 = do as <- readIORef v_Pgm_a
600 as_opts <- getOpts opt_a
602 cmdline_include_paths <- readIORef v_Include_paths
603 let cmdline_include_flags = map (\p -> "-I"++p) cmdline_include_paths
604 run_something "Assembler"
605 (unwords (as : as_opts
606 ++ cmdline_include_flags
607 ++ [ "-c", input_fn, "-o", output_fn ]
611 run_phase SplitAs basename _suff _input_fn _output_fn
612 = do as <- readIORef v_Pgm_a
613 as_opts <- getOpts opt_a
615 split_s_prefix <- readIORef v_Split_prefix
616 n <- readIORef v_N_split_files
618 odir <- readIORef v_Output_dir
619 let real_odir = case odir of
623 let assemble_file n = do
624 let input_s = split_s_prefix ++ "__" ++ show n ++ ".s"
625 let output_o = newdir real_odir
626 (basename ++ "__" ++ show n ++ ".o")
627 real_o <- osuf_ify output_o
628 run_something "Assembler"
629 (unwords (as : as_opts
630 ++ [ "-c", "-o", real_o, input_s ]
633 mapM_ assemble_file [1..n]
636 -----------------------------------------------------------------------------
639 doLink :: [String] -> IO ()
641 ln <- readIORef v_Pgm_l
643 o_file <- readIORef v_Output_file
644 let output_fn = case o_file of { Just s -> s; Nothing -> "a.out"; }
646 pkg_lib_paths <- getPackageLibraryPath
647 let pkg_lib_path_opts = map ("-L"++) pkg_lib_paths
649 lib_paths <- readIORef v_Library_paths
650 let lib_path_opts = map ("-L"++) lib_paths
652 pkg_libs <- getPackageLibraries
653 let pkg_lib_opts = map (\lib -> "-l"++lib) pkg_libs
655 libs <- readIORef v_Cmdline_libraries
656 let lib_opts = map ("-l"++) (reverse libs)
657 -- reverse because they're added in reverse order from the cmd line
659 pkg_extra_ld_opts <- getPackageExtraLdOpts
661 -- probably _stub.o files
662 extra_ld_inputs <- readIORef v_Ld_inputs
664 -- opts from -optl-<blah>
665 extra_ld_opts <- getStaticOpts v_Opt_l
667 run_something "Linker"
669 ([ ln, verb, "-o", output_fn ]
681 -----------------------------------------------------------------------------
682 -- Just preprocess a file, put the result in a temp. file (used by the
683 -- compilation manager during the summary phase).
685 preprocess :: FilePath -> IO FilePath
686 preprocess filename =
687 ASSERT(haskellish_file filename)
688 do pipeline <- genPipeline (StopBefore Hsc) ("preprocess") filename
689 runPipeline pipeline filename False{-no linking-} False{-no -o flag-}
692 -----------------------------------------------------------------------------
693 -- Compile a single module, under the control of the compilation manager.
695 -- This is the interface between the compilation manager and the
696 -- compiler proper (hsc), where we deal with tedious details like
697 -- reading the OPTIONS pragma from the source file, and passing the
698 -- output of hsc through the C compiler.
700 -- The driver sits between 'compile' and 'hscMain', translating calls
701 -- to the former into calls to the latter, and results from the latter
702 -- into results from the former. It does things like preprocessing
703 -- the .hs file if necessary, and compiling up the .stub_c files to
704 -- generate Linkables.
706 compile :: ModSummary -- summary, including source
707 -> Maybe ModIface -- old interface, if available
708 -> HomeSymbolTable -- for home module ModDetails
709 -> HomeIfaceTable -- for home module Ifaces
710 -> PersistentCompilerState -- persistent compiler state
714 = CompOK ModDetails -- new details (HST additions)
715 (Maybe (ModIface, Linkable))
716 -- summary and code; Nothing => compilation not reqd
717 -- (old summary and code are still valid)
718 PersistentCompilerState -- updated PCS
720 | CompErrs PersistentCompilerState -- updated PCS
723 compile summary old_iface hst hit pcs = do
724 verb <- readIORef v_Verbose
725 when verb (hPutStrLn stderr
726 (showSDoc (text "compile: compiling"
727 <+> ppr (name_of_summary summary))))
729 init_dyn_flags <- readIORef v_InitDynFlags
730 writeIORef v_DynFlags init_dyn_flags
732 let location = ms_location summary
733 let input_fn = unJust (ml_hs_file location) "compile:hs"
735 when verb (hPutStrLn stderr ("compile: input file " ++ input_fn))
737 opts <- getOptionsFromSource input_fn
738 processArgs dynamic_flags opts []
739 dyn_flags <- readIORef v_DynFlags
741 hsc_lang <- readIORef v_Hsc_Lang
742 output_fn <- case hsc_lang of
743 HscAsm -> newTempName (phaseInputExt As)
744 HscC -> newTempName (phaseInputExt HCc)
745 HscJava -> newTempName "java" -- ToDo
746 HscInterpreted -> return (error "no output file")
749 hsc_result <- hscMain dyn_flags{ hscOutName = output_fn }
750 (panic "compile:source_unchanged")
751 location old_iface hst hit pcs
754 HscFail pcs -> return (CompErrs pcs);
756 HscOK details maybe_iface
757 maybe_stub_h maybe_stub_c maybe_interpreted_code pcs -> do
759 -- if no compilation happened, bail out early
760 case maybe_iface of {
761 Nothing -> return (CompOK details Nothing pcs);
764 let (basename, _) = splitFilename input_fn
765 maybe_stub_o <- dealWithStubs basename maybe_stub_h maybe_stub_c
766 let stub_unlinked = case maybe_stub_o of
768 Just stub_o -> [ DotO stub_o ]
773 -- in interpreted mode, just return the compiled code
774 -- as our "unlinked" object.
776 case maybe_interpreted_code of
777 Just (code,itbl_env) -> return [Trees code itbl_env]
778 Nothing -> panic "compile: no interpreted code"
780 -- we're in batch mode: finish the compilation pipeline.
781 _other -> do pipe <- genPipeline (StopBefore Ln) "" output_fn
782 o_file <- runPipeline pipe output_fn False False
783 return [ DotO o_file ]
785 let linkable = LM (moduleName (ms_mod summary))
786 (hs_unlinked ++ stub_unlinked)
788 return (CompOK details (Just (iface, linkable)) pcs)
792 -----------------------------------------------------------------------------
793 -- stub .h and .c files (for foreign export support)
795 dealWithStubs basename maybe_stub_h maybe_stub_c
797 = do let stub_h = basename ++ "_stub.h"
798 let stub_c = basename ++ "_stub.c"
800 -- copy the .stub_h file into the current dir if necessary
803 Just tmp_stub_h -> do
804 run_something "Copy stub .h file"
805 ("cp " ++ tmp_stub_h ++ ' ':stub_h)
807 -- #include <..._stub.h> in .hc file
808 addCmdlineHCInclude tmp_stub_h -- hack
810 -- copy the .stub_c file into the current dir, and compile it, if necessary
812 Nothing -> return Nothing
813 Just tmp_stub_c -> do -- copy the _stub.c file into the current dir
814 run_something "Copy stub .c file"
816 "rm -f", stub_c, "&&",
817 "echo \'#include \""++stub_h++"\"\' >"++stub_c, " &&",
818 "cat", tmp_stub_c, ">> ", stub_c
821 -- compile the _stub.c file w/ gcc
822 pipeline <- genPipeline (StopBefore Ln) "" stub_c
823 stub_o <- runPipeline pipeline stub_c False{-no linking-}
824 False{-no -o option-}