<para>You may specify that a different program be used for one
of the phases of the compilation system, in place of whatever
- the <Command>ghc</Command> has wired into it. For example, you
+ the <command>ghc</command> has wired into it. For example, you
might want to try a different assembler. The following options
allow you to change the external program used for a given
compilation phase:</para>
</indexterm>
<listitem>
<para>Pass <replaceable>option</replaceable> to the
- custom pre-processor (see <xref linkend="pre-processor">).</para>
+ custom pre-processor (see <xref linkend="pre-processor"/>).</para>
</listitem>
</varlistentry>
<varlistentry>
<para>GHC is itself a Haskell program, so if you need to pass
options directly to GHC's runtime system you can enclose them in
<literal>+RTS ... -RTS</literal> (see <xref
- linkend="runtime-control">).</para>
+ linkend="runtime-control"/>).</para>
</sect2>
<option>-D</option> macros passed to the C compiler
when compiling via C! For those, use the
<option>-optc-Dfoo</option> hack… (see <xref
- linkend="forcing-options-through">).</para>
+ linkend="forcing-options-through"/>).</para>
</listitem>
</varlistentry>
gaps vs -cpp</primary></indexterm>. In other words, strings
such as the following:</para>
-<ProgramListing>
+<programlisting>
strmod = "\
\ p \
\ "
-</ProgramListing>
+</programlisting>
<para>don't work with <option>-cpp</option>;
<filename>/usr/bin/cpp</filename> elides the backslash-newline
<listitem>
<para>A custom pre-processor is run over your Haskell
source file only if the <option>-F</option> option
- <indexterm><primary>-F</primary></indexterm> is given.
- </para>
- <para>
- Running a custom pre-processor at compile-time is in some
- settings appropriate and useful. The <option>-F</option>
- option lets you run a pre-processor as part of the overall
- GHC compilation pipeline, which has the advantage over
- running a Haskell pre-processor separately in that it
- works in interpreted mode and you can continue to take
- reap the benefits of GHC's recompilation checker.
- </para>
- <para>
- The pre-processor is run just before the Haskell
- compiler proper processes the Haskell input, but after
- the literate markup has been stripped away and (possibly)
- the C pre-processor has washed the Haskell input.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><option>-pgmF</option> <replaceable>cmd</replaceable></term>
- <indexterm><primary><option>-pgmF</option> <replaceable>cmd</replaceable></primary></indexterm>
- <listitem>
- <para>Use <replaceable>cmd</replaceable> as the Haskell
- pre-processor. When invoked, the
- <replaceable>cmd</replaceable> pre-processor is given at
- least three arguments on its command-line: the first
- argument is the name of the original source file, the second
- is the name of the file holding the input, and the third is
- the name of the file where
- <replaceable>cmd</replaceable> should write its output to.
- </para>
- <para>Additional arguments to the
- <replaceable>cmd</replaceable> pre-processor can be passed
- in using the <option>-optF</option> option. These are fed to
- <replaceable>cmd</replaceable> on the command line after the
- three standard input and output arguments.
- </para>
+ <indexterm><primary>-F</primary></indexterm> is
+ given.</para>
+
+ <para>Running a custom pre-processor at compile-time is in
+ some settings appropriate and useful. The
+ <option>-F</option> option lets you run a pre-processor as
+ part of the overall GHC compilation pipeline, which has
+ the advantage over running a Haskell pre-processor
+ separately in that it works in interpreted mode and you
+ can continue to take reap the benefits of GHC's
+ recompilation checker.</para>
+
+ <para>The pre-processor is run just before the Haskell
+ compiler proper processes the Haskell input, but after the
+ literate markup has been stripped away and (possibly) the
+ C pre-processor has washed the Haskell input.</para>
+
+ <para>Use
+ <option>-pgmF <replaceable>cmd</replaceable></option>
+ to select the program to use as the preprocessor. When
+ invoked, the <replaceable>cmd</replaceable> pre-processor
+ is given at least three arguments on its command-line: the
+ first argument is the name of the original source file,
+ the second is the name of the file holding the input, and
+ the third is the name of the file where
+ <replaceable>cmd</replaceable> should write its output
+ to.</para>
+
+ <para>Additional arguments to the pre-processor can be
+ passed in using the <option>-optF</option> option. These
+ are fed to <replaceable>cmd</replaceable> on the command
+ line after the three standard input and output
+ arguments.</para>
</listitem>
</varlistentry>
</variablelist>
way to do this, but you can use this hack from the
command-line:</para>
-<Screen>
+<screen>
% ghc -c '-#include <X/Xlib.h>' Xstuff.lhs
-</Screen>
+</screen>
</sect2>
fast), but may produce code that is slightly slower than
compiling via C. <option>-fasm</option> is the default
when optimisation is off (see <xref
- linkend="options-optimise">).</para>
+ linkend="options-optimise"/>).</para>
</listitem>
</varlistentry>
<indexterm><primary><option>-package</option></primary></indexterm>
<listitem>
<para>If you are using a Haskell “package”
- (see <xref linkend="packages">), don't forget to add the
+ (see <xref linkend="packages"/>), don't forget to add the
relevant <option>-package</option> option when linking the
program too: it will cause the appropriate libraries to be
linked in with the program. Forgetting the
be supplying its definition of <function>main()</function>
at link-time, you will have to. To signal that to the
compiler when linking, use
- <option>-no-hs-main</option>. See also <xref linkend="using-own-main">.</para>
+ <option>-no-hs-main</option>. See also <xref linkend="using-own-main"/>.</para>
<para>Notice that since the command-line passed to the
linker is rather involved, you probably want to use