separate_compilation.xml whitespace
[ghc-hetmet.git] / docs / users_guide / separate_compilation.xml
index 727a133..e2c9c33 100644 (file)
          has been specified, then the object filename is
          <replaceable>dir</replaceable>/<replaceable>mod</replaceable>.<replaceable>osuf</replaceable>,
          where <replaceable>mod</replaceable> is the module name with
-         dots replaced by slashes.  GHC will silently create the necessary directory 
+         dots replaced by slashes.  GHC will silently create the necessary directory
           structure underneath <replaceable>dir</replaceable>, if it does not
-          already exist.</para> 
+          already exist.</para>
        </listitem>
       </itemizedlist>
 
           <para>If you use <command>ghc --make</command> and you don't
           use the <option>-o</option>, the name GHC will choose
           for the executable will be based on the name of the file
-          containing the module <literal>Main</literal>. 
+          containing the module <literal>Main</literal>.
           Note that with GHC the <literal>Main</literal> module doesn't
           have to be put in file <filename>Main.hs</filename>.
           Thus both
@@ -433,13 +433,15 @@ $ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `uname -m`
        </varlistentry>
       </variablelist>
     </sect2>
-  
+
     <sect2 id="keeping-intermediates">
       <title>Keeping Intermediate Files</title>
       <indexterm><primary>intermediate files, saving</primary>
       </indexterm>
       <indexterm><primary><literal>.hc</literal> files, saving</primary>
       </indexterm>
+      <indexterm><primary><literal>.ll</literal> files, saving</primary>
+      </indexterm>
       <indexterm><primary><literal>.s</literal> files, saving</primary>
       </indexterm>
 
@@ -459,37 +461,36 @@ $ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `uname -m`
            <para>Keep intermediate <literal>.hc</literal> files when
            doing <literal>.hs</literal>-to-<literal>.o</literal>
            compilations via C (NOTE: <literal>.hc</literal> files
-           aren't generated when using the native code generator, you
-           may need to use <option>-fvia-C</option> to force them
-           to be produced).</para>
+           are only generated by unregisterised compilers).</para>
          </listitem>
        </varlistentry>
 
        <varlistentry>
          <term>
-            <option>-keep-s-file</option>,
-            <option>-keep-s-files</option>
-            <indexterm><primary><option>-keep-s-file</option></primary></indexterm>
-            <indexterm><primary><option>-keep-s-files</option></primary></indexterm>
+            <option>-keep-llvm-file</option>,
+            <option>-keep-llvm-files</option>
+            <indexterm><primary><option>-keep-llvm-file</option></primary></indexterm>
+            <indexterm><primary><option>-keep-llvm-files</option></primary></indexterm>
           </term>
          <listitem>
-           <para>Keep intermediate <literal>.s</literal> files.</para>
+           <para>Keep intermediate <literal>.ll</literal> files when
+           doing <literal>.hs</literal>-to-<literal>.o</literal>
+           compilations via LLVM (NOTE: <literal>.ll</literal> files
+           aren't generated when using the native code generator, you
+           may need to use <option>-fllvm</option> to force them
+           to be produced).</para>
          </listitem>
        </varlistentry>
 
        <varlistentry>
          <term>
-            <option>-keep-raw-s-file</option>,
-            <option>-keep-raw-s-files</option>
-            <indexterm><primary><option>-keep-raw-s-file</option></primary></indexterm>
-            <indexterm><primary><option>-keep-raw-s-files</option></primary></indexterm>
+            <option>-keep-s-file</option>,
+            <option>-keep-s-files</option>
+            <indexterm><primary><option>-keep-s-file</option></primary></indexterm>
+            <indexterm><primary><option>-keep-s-files</option></primary></indexterm>
           </term>
          <listitem>
-           <para>Keep intermediate <literal>.raw-s</literal> files.
-           These are the direct output from the C compiler, before
-           GHC does &ldquo;assembly mangling&rdquo; to produce the
-           <literal>.s</literal> file.  Again, these are not produced
-           when using the native code generator.</para>
+           <para>Keep intermediate <literal>.s</literal> files.</para>
          </listitem>
        </varlistentry>
 
@@ -692,22 +693,22 @@ $ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `uname -m`
       This section explains how.</para>
 
       <para>Every cycle in the module import graph must be broken by a <filename>hs-boot</filename> file.
-      Suppose that modules <filename>A.hs</filename> and <filename>B.hs</filename> are Haskell source files, 
+      Suppose that modules <filename>A.hs</filename> and <filename>B.hs</filename> are Haskell source files,
       thus:
 <programlisting>
 module A where
     import B( TB(..) )
-    
+
     newtype TA = MkTA Int
-    
+
     f :: TB -&#62; TA
     f (MkTB x) = MkTA x
 
 module B where
     import {-# SOURCE #-} A( TA(..) )
-    
+
     data TB = MkTB !Int
-    
+
     g :: TA -&#62; TB
     g (MkTA x) = MkTB x
 </programlisting>
@@ -749,12 +750,12 @@ module A where
 <programlisting>
   ghc -c A.hs-boot
 </programlisting>
-When a hs-boot file <filename>A.hs-boot</filename> 
+When a hs-boot file <filename>A.hs-boot</filename>
    is compiled, it is checked for scope and type errors.
    When its parent module <filename>A.hs</filename> is compiled, the two are compared, and
    an error is reported if the two are inconsistent.
    </para></listitem>
-   
+
        <listitem>
          <para> Just as compiling <filename>A.hs</filename> produces an
            interface file <filename>A.hi</filename>, and an object file
@@ -792,7 +793,7 @@ When a hs-boot file <filename>A.hs-boot</filename>
    <command>ghc -M</command> will report an error if a cycle is found.
    </para></listitem>
 
-   <listitem><para> A module <literal>M</literal> that is 
+   <listitem><para> A module <literal>M</literal> that is
    <literal>{-# SOURCE #-}</literal>-imported in a program will usually also be
    ordinarily imported elsewhere.  If not, <command>ghc --make</command>
    automatically adds <literal>M</literal> to the set of modules it tries to
@@ -811,9 +812,9 @@ A hs-boot file need only contain the bare
 <para>A hs-boot file is written in a subset of Haskell:
 <itemizedlist>
 <listitem><para> The module header (including the export list), and import statements, are exactly as in
-Haskell, and so are the scoping rules.  
+Haskell, and so are the scoping rules.
    Hence, to mention a non-Prelude type or class, you must import it.</para></listitem>
-   
+
 <listitem><para> There must be no value declarations, but there can be type signatures for
 values.  For example:
 <programlisting>
@@ -822,7 +823,7 @@ values.  For example:
 </para></listitem>
 <listitem><para> Fixity declarations are exactly as in Haskell.</para></listitem>
 <listitem><para> Type synonym declarations are exactly as in Haskell.</para></listitem>
-<listitem><para> A data type declaration can either be given in full, exactly as in Haskell, or it 
+<listitem><para> A data type declaration can either be given in full, exactly as in Haskell, or it
 can be given abstractly, by omitting the '=' sign and everything that follows.  For example:
 <programlisting>
   data T a b
@@ -834,7 +835,7 @@ can be given abstractly, by omitting the '=' sign and everything that follows.
          You <emphasis>can</emphasis> also write out the constructors but, if you do so, you must write
          it out precisely as in its real definition.</para>
          <para>
-           If you do not write out the constructors, you may need to give a kind 
+           If you do not write out the constructors, you may need to give a kind
            annotation (<xref linkend="kinding"/>), to tell
            GHC the kind of the type variable, if it is not "*".  (In source files, this is worked out
            from the way the type variable is used in the constructors.)  For example:
@@ -937,7 +938,7 @@ Foo.o Foo.hc Foo.s    : Baz.hi          # Foo imports Baz
       brought up to date.  To bring it up to date,
       <literal>make</literal> looks for a rule to do so; one of the
       preceding suffix rules does the job nicely.  These dependencies
-      can be generated automatically by <command>ghc</command>; see 
+      can be generated automatically by <command>ghc</command>; see
       <xref linkend="makefile-dependencies"/></para>
 
  </sect2>
@@ -966,7 +967,7 @@ depend :
         <filename>Makefile</filename>.</para>
 
        <para>In general, <command>ghc -M Foo</command> does the following.
-       For each module <literal>M</literal> in the set 
+       For each module <literal>M</literal> in the set
        <literal>Foo</literal> plus all its imports (transitively),
        it adds to the Makefile:
        <itemizedlist>
@@ -989,7 +990,7 @@ M.o : X.hi-boot
        (See <xref linkend="mutual-recursion"/> for details of
        <literal>hi-boot</literal> style interface files.)
       </para></listitem>
-        </itemizedlist> 
+        </itemizedlist>
        If <literal>M</literal> imports multiple modules, then there will
        be multiple lines with <filename>M.o</filename> as the
        target.</para>
@@ -1025,15 +1026,7 @@ M.o : X.hi-boot
        <option>&ndash;&ndash;include-pkg-deps</option> option below).</para>
 
        <para>The dependency generation phase of GHC can take some
-        additional options, which you may find useful.  For historical
-        reasons, each option passed to the dependency generator from
-        the GHC command line must be preceded by
-        <literal>-optdep</literal>.  For example, to pass <literal>-f
-        .depend</literal> to the dependency generator, you say
-
-<screen>
-ghc -M -optdep-f -optdep.depend ...
-</screen>
+        additional options, which you may find useful.
 
        The options which affect dependency generation are:</para>
 
@@ -1042,15 +1035,7 @@ ghc -M -optdep-f -optdep.depend ...
            <term><option>-ddump-mod-cycles</option></term>
            <listitem>
              <para>Display a list of the cycles in the module graph. This is
-         useful when trying to eliminate such cycles.  You do not need the <literal>-optdep</literal> prefix
-         for this flag.</para>
-           </listitem>
-         </varlistentry>
-
-         <varlistentry>
-           <term><option>-w</option></term>
-           <listitem>
-             <para>Turn off warnings about interface file shadowing.</para>
+         useful when trying to eliminate such cycles.</para>
            </listitem>
          </varlistentry>
 
@@ -1066,14 +1051,14 @@ ghc -M -optdep-f -optdep.depend ...
          </varlistentry>
 
          <varlistentry>
-           <term><option>-f</option> <replaceable>file</replaceable></term>
+           <term><option>-dep-makefile</option> <replaceable>file</replaceable></term>
            <listitem>
              <para>Use <replaceable>file</replaceable> as the makefile,
               rather than <filename>makefile</filename> or
               <filename>Makefile</filename>.  If
               <replaceable>file</replaceable> doesn't exist,
               <command>mkdependHS</command> creates it.  We often use
-              <option>-f .depend</option> to put the dependencies in
+              <option>-dep-makefile .depend</option> to put the dependencies in
               <filename>.depend</filename> and then
               <command>include</command> the file
               <filename>.depend</filename> into
@@ -1081,21 +1066,8 @@ ghc -M -optdep-f -optdep.depend ...
            </listitem>
          </varlistentry>
 
-<!-- Retired with the move away from 'mkdependHS'.
          <varlistentry>
-           <term><option>-o &lt;osuf&gt;</option></term>
-           <listitem>
-             <para>Use <filename>.&lt;osuf&gt;</filename> as the
-              "target file" suffix ( default: <literal>o</literal>).
-              Multiple <option>-o</option> flags are permitted
-              (GHC2.05 onwards).  Thus "<option>-o hc -o o</option>"
-              will generate dependencies for <filename>.hc</filename>
-              and <filename>.o</filename> files.</para>
-           </listitem>
-         </varlistentry>
--->
-         <varlistentry>
-           <term><option>-s &lt;suf&gt;</option></term>
+           <term><option>-dep-suffix &lt;suf&gt;</option></term>
            <listitem>
              <para>Make extra dependencies that declare that files
               with suffix
@@ -1104,13 +1076,14 @@ ghc -M -optdep-f -optdep.depend ...
               <filename>.&lt;suf&gt;&lowbar;hi</filename>, or (for
               <literal>&lcub;-&num; SOURCE &num;-&rcub;</literal>
               imports) on <filename>.hi-boot</filename>.  Multiple
-              <option>-s</option> flags are permitted.  For example,
-              <option>-o hc -s a -s b</option> will make dependencies
-              for <filename>.hc</filename> on
+              <option>-dep-suffix</option> flags are permitted.  For example,
+              <option>-dep-suffix a -dep-suffix b</option>
+              will make dependencies
+              for <filename>.hs</filename> on
               <filename>.hi</filename>,
-              <filename>.a&lowbar;hc</filename> on
+              <filename>.a&lowbar;hs</filename> on
               <filename>.a&lowbar;hi</filename>, and
-              <filename>.b&lowbar;hc</filename> on
+              <filename>.b&lowbar;hs</filename> on
               <filename>.b&lowbar;hi</filename>.  (Useful in
               conjunction with NoFib "ways".)</para>
            </listitem>
@@ -1126,35 +1099,6 @@ ghc -M -optdep-f -optdep.depend ...
          </varlistentry>
 
          <varlistentry>
-           <term><option>-x</option></term>
-           <listitem>
-             <para>same as <option>&ndash;&ndash;exclude-module</option></para>
-           </listitem>
-         </varlistentry>
-
-<!-- Not currently implemented:
-         <varlistentry>
-           <term><option>&ndash;&ndash;exclude-directory=&lt;dirs&gt;</option></term>
-           <listitem>
-             <para>Regard the colon-separated list of directories
-              <filename>&lt;dirs&gt;</filename> as containing stable,
-              don't generate any dependencies on modules
-              therein.</para>
-           </listitem>
-         </varlistentry>
-
-         <varlistentry>
-           <term><option>&ndash;&ndash;include-module=&lt;file&gt;</option></term>
-           <listitem>
-             <para>Regard <filename>&lt;file&gt;</filename> as not
-              "stable"; i.e., generate dependencies on it (if
-              any). This option is normally used in conjunction with
-              the <option>&ndash;&ndash;exclude-directory</option> option.</para>
-           </listitem>
-         </varlistentry>
--->
-
-         <varlistentry>
            <term><option>&ndash;&ndash;include-pkg-deps</option></term>
            <listitem>
              <para>Regard modules imported from packages as unstable,
@@ -1183,7 +1127,7 @@ just in case they contain an instance declaration that matters to M.  This would
 be a disaster in practice, so GHC tries to be clever. </para>
 
 <para>In particular, if an instance declaration is in the same module as the definition
-of any type or class mentioned in the <emphasis>head</emphasis> of the instance declaration 
+of any type or class mentioned in the <emphasis>head</emphasis> of the instance declaration
 (the part after the &ldquo;<literal>=&gt;</literal>&rdquo;; see <xref linkend="instance-rules"/>), then
 GHC has to visit that interface file anyway.  Example:</para>
 <programlisting>
@@ -1234,8 +1178,8 @@ These considerations lead to the following definition of an orphan module:
   least one <emphasis>orphan rule</emphasis>.</para> </listitem>
 
   <listitem><para> An instance declaration in a module M is an <emphasis>orphan instance</emphasis> if
-  <indexterm><primary>orphan instance</primary></indexterm> 
-<itemizedlist> 
+  <indexterm><primary>orphan instance</primary></indexterm>
+<itemizedlist>
 <listitem><para>
   The class of the instance declaration is not declared in M, and
 </para></listitem>
@@ -1247,7 +1191,7 @@ These considerations lead to the following definition of an orphan module:
        </para></listitem>
   </itemizedlist>
   </para>
-  <para> Only the instance head 
+  <para> Only the instance head
   counts.  In the example above, it is not good enough for C's declaration
   to be in module A; it must be the declaration of D or T.</para>
   </listitem>
@@ -1261,9 +1205,9 @@ These considerations lead to the following definition of an orphan module:
 
 
 
-<para>If you use the flag <option>-fwarn-orphans</option>, GHC will warn you 
+<para>If you use the flag <option>-fwarn-orphans</option>, GHC will warn you
 if you are creating an orphan module.
-Like any warning, you can switch the warning off with <option>-fno-warn-orphans</option>, 
+Like any warning, you can switch the warning off with <option>-fno-warn-orphans</option>,
 and <option>-Werror</option>
 will make the compilation fail if the warning is issued.
 </para>
@@ -1279,7 +1223,6 @@ first line, GHC considers it an orphan module.
 
 <!-- Emacs stuff:
      ;;; Local Variables: ***
-     ;;; mode: xml ***
      ;;; sgml-parent-document: ("users_guide.xml" "book" "chapter" "sect1") ***
      ;;; End: ***
  -->