3 $$ [command-line-options-and-input-files]
5 To compile and link a complete Haskell program, run the compiler like
10 where the module Main is in a file named Main.hs (or Main.lhs) in the
11 current directory. The other modules in the program will be located
12 and compiled automatically, and the linked program will be placed in
13 the file `a.out' (or `Main.exe' on Windows).
15 Alternatively, $$ can be used to compile files individually. Each
16 input file is guided through (some of the) possible phases of a
19 - unlit: extract code from a "literate program"
20 - hscpp: run code through the C pre-processor (if -cpp flag given)
21 - hsc: run the Haskell compiler proper
22 - gcc: run the C compiler (if compiling via C)
23 - as: run the assembler
26 For each input file, the phase to START with is determined by the
29 - .lhs literate Haskell unlit
30 - .hs plain Haskell ghc
31 - .hc C from the Haskell compiler gcc
32 - .c C not from the Haskell compiler gcc
33 - .s assembly language as
34 - other passed directly to the linker ld
36 The phase at which to STOP processing is determined by a command-line
39 -E stop after generating preprocessed, de-litted Haskell
40 (used in conjunction with -cpp)
41 -C stop after generating C (.hc output)
42 -S stop after generating assembler (.s output)
43 -c stop after generating object files (.o output)
45 Other commonly-used options are:
47 -v[n] Control verbosity (n is 0--5, normal verbosity level is 1,
48 -v alone is equivalent to -v3)
50 -fglasgow-exts Allow Glasgow extensions (unboxed types, etc.)
52 -O An `optimising' package of compiler flags, for faster code
54 -prof Compile for cost-centre profiling
55 (add -auto-all for automagic cost-centres on all
58 -H14m Increase compiler's heap size (might make compilation
59 faster, especially on large source files).
61 -M Output Makefile rules recording the
62 dependencies of a list of Haskell files.
64 The User's Guide has more information about GHC's *many* options.
66 Given the above, here are some TYPICAL invocations of $$:
68 # compile a Haskell module to a .o file, optimising:
70 # link three .o files into an executable called "test":
71 % $$ -o test Foo.o Bar.o Baz.o
72 # compile a Haskell module to C (a .hc file), using a bigger heap:
74 # compile Haskell-produced C (.hc) to assembly language:
76 ------------------------------------------------------------------------