New syntax for GADT-style record declarations, and associated refactoring
[ghc-hetmet.git] / docs / users_guide / separate_compilation.xml
index bc3afca..32dc850 100644 (file)
            <replaceable>dir</replaceable>.  For example:</para>
 
 <screen>
-$ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `arch`
+$ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `uname -m`
 </screen>
 
            <para>The object files, <filename>Foo.o</filename>,
@@ -374,6 +374,20 @@ $ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `arch`
          </listitem>
        </varlistentry>
 
+        <varlistentry>
+          <term>
+            <option>-outputdir</option> <replaceable>dir</replaceable>
+            <indexterm><primary><option>-outputdir</option></primary></indexterm>
+          </term>
+          <listitem>
+            <para>The <option>-outputdir</option> option is shorthand for
+              the combination
+              of <option>-odir</option>, <option>-hidir</option>,
+              and <option>-stubdir</option>.
+            </para>
+          </listitem>
+        </varlistentry>
+
        <varlistentry>
          <term>
             <option>-osuf</option> <replaceable>suffix</replaceable>
@@ -565,9 +579,9 @@ $ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `arch`
             the same as the old one; this is friendly to
             <command>make</command>.  When an interface does change,
             it is often enlightening to be informed.  The
-            <option>-ddump-hi-diffs</option> option will make GHC run
-            <command>diff</command> on the old and new
-            <filename>.hi</filename> files.</para>
+            <option>-ddump-hi-diffs</option> option will make GHC
+            report the differences between the old and
+            new <filename>.hi</filename> files.</para>
          </listitem>
        </varlistentry>
 
@@ -647,24 +661,24 @@ $ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `arch`
       <literal>B</literal>, say) may conceivably not change
       <filename>B.hi</filename> one jot.  So now&hellip;</para>
 
-      <para>GHC keeps a version number on each interface file, and on
-      each type signature within the interface file.  It also keeps in
-      every interface file a list of the version numbers of everything
-      it used when it last compiled the file.  If the source file's
-      modification date is earlier than the <filename>.o</filename>
-      file's date (i.e. the source hasn't changed since the file was
-      last compiled), and the recompilation checking is on, GHC will be
-      clever.  It compares the version numbers on the things it needs
-      this time with the version numbers on the things it needed last
-      time (gleaned from the interface file of the module being
-      compiled); if they are all the same it stops compiling rather
-      early in the process saying &ldquo;Compilation IS NOT
-      required&rdquo;.  What a beautiful sight!</para>
-
-      <para>Patrick Sansom had a workshop paper about how all this is
-      done (though the details have changed quite a bit). <ulink
-      url="mailto:sansom@dcs.gla.ac.uk">Ask him</ulink> if you want a
-      copy.</para>
+      <para>GHC calculates a fingerprint (in fact an MD5 hash) of each
+      interface file, and of each declaration within the interface
+      file.  It also keeps in every interface file a list of the
+      fingerprints of everything it used when it last compiled the
+      file.  If the source file's modification date is earlier than
+      the <filename>.o</filename> file's date (i.e. the source hasn't
+      changed since the file was last compiled), and the recompilation
+      checking is on, GHC will be clever.  It compares the fingerprints
+      on the things it needs this time with the fingerprints
+      on the things it needed last time (gleaned from the
+      interface file of the module being compiled); if they are all
+      the same it stops compiling early in the process saying
+      &ldquo;Compilation IS NOT required&rdquo;.  What a beautiful
+      sight!</para>
+
+      <para>You can read
+      about <ulink url="http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/RecompilationAvoidance">how
+          all this works</ulink> in the GHC commentary.</para>
 
     </sect2>
 
@@ -1011,15 +1025,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>
 
@@ -1028,15 +1034,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>
 
@@ -1052,14 +1050,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
@@ -1067,21 +1065,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
@@ -1090,13 +1075,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>
@@ -1112,35 +1098,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,
@@ -1247,7 +1204,13 @@ These considerations lead to the following definition of an orphan module:
 
 
 
-<para>GHC will warn you if you are creating an orphan module, if you add `-fwarn-orphan-modules`.
+<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>, 
+and <option>-Werror</option>
+will make the compilation fail if the warning is issued.
+</para>
+<para>
 You can identify an orphan module by looking in its interface
 file, <filename>M.hi</filename>, using the
 <link linkend="modes"><option>--show-iface</option> mode</link>.  If there is a <literal>[orphan module]</literal> on the