>GHC without ––make

4.6. GHC without ––make

Without ––make, GHC will compile one or more source files given on the command line.

The first phase to run is determined by each input-file suffix, and the last phase is determined by a flag. If no relevant flag is present, then go all the way through linking. This table summarises:

Phase of the compilation systemSuffix saying “start here”Flag saying “stop after”(suffix of) output file
literate pre-processor.lhs-.hs
C pre-processor (opt.) .hs (with -cpp)-E.hspp
Haskell compiler.hs-C, -S.hc, .s
C compiler (opt.).hc or .c-S.s
assembler.s-c.o
linkerother-a.out

Thus, a common invocation would be: ghc -c Foo.hs

Note: What the Haskell compiler proper produces depends on whether a native-code generator is used (producing assembly language) or not (producing C). See Section 4.12.6 for more details.

Note: C pre-processing is optional, the -ccpflag turns it on. See Section 4.12.3 for more details.

Note: The option -E runs just the pre-processing passes of the compiler, dumping the result in a file. Note that this differs from the previous behaviour of dumping the file to standard output.