[project @ 2003-05-21 13:05:49 by simonmar]
authorsimonmar <unknown>
Wed, 21 May 2003 13:05:49 +0000 (13:05 +0000)
committersimonmar <unknown>
Wed, 21 May 2003 13:05:49 +0000 (13:05 +0000)
Restore the correct partitioning of command-line arguments into
objects and compilation-manager inputs for --make mode, and restore a
comment explaining the behaviour.

Rev. 1.120 made some subtle changes to the semantics, in particular in
cases where a file given on the command line is neither a source nor
an object file.

I believe the behaviour for one-shot mode has not changed.  The
behaviour for GHCi mode is now the same as --make mode (previous to
rev. 1.120 it was subtly broken in this respect).

ghc/compiler/main/Main.hs

index 23bbec1..953bc87 100644 (file)
@@ -1,7 +1,7 @@
 {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
 
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.122 2003/05/21 12:38:36 simonmar Exp $
+-- $Id: Main.hs,v 1.123 2003/05/21 13:05:49 simonmar Exp $
 --
 -- GHC Driver program
 --
@@ -198,9 +198,30 @@ main =
        -- save the "initial DynFlags" away
    saveDynFlags
 
-       -- We split out the object files (.o, .dll) and add them
-       -- to v_Ld_inputs for use by the linker
-   let (objs, srcs) = partition objish_file fileish_args
+   let
+    {-
+      We split out the object files (.o, .dll) and add them
+      to v_Ld_inputs for use by the linker.
+
+      The following things should be considered compilation manager inputs:
+
+       - haskell source files (strings ending in .hs, .lhs or other 
+         haskellish extension),
+
+       - module names (not forgetting hierarchical module names),
+
+       - and finally we consider everything not containing a '.' to be
+         a comp manager input, as shorthand for a .hs or .lhs filename.
+
+      Everything else is considered to be a linker object, and passed
+      straight through to the linker.
+    -}
+    looks_like_an_input m =  isSourceFile m 
+                         || looksLikeModuleName m
+                         || '.' `notElem` m
+
+    (srcs, objs) = partition looks_like_an_input fileish_args
+
    mapM_ (add v_Ld_inputs) objs
 
        ---------------- Display banners and configuration -----------