Skip to content
  • Simon Marlow's avatar
    [project @ 2003-07-18 13:18:06 by simonmar] · 2d532e45
    Simon Marlow authored
    Revision to the filename policy changes of yesterday.  This fixes the
    broken stage2 and library builds.
    
    The new story is this:
    
      A Haskell source filename should take the form
    
    	<path>/<basename>.<extension>
    
      where
    
    	<path>      is any directory
    	<basename>  is the name of the module, with dots replaced by slashes.
    	<extension> is ".hs" or ".lhs".
    
      given a source filename in this form, GHC will produce object and
      interface files named respectively:
    
            <hidir>/<basename>.<hisuf>
    	<odir>/<basename>.<osuf>
    
      where
    
    	<hidir>   is the value of the -hidir flag, if one was given, or
    		  the value of <path> from the source file otherwise.
    
    	<odir>    the same, for the -odir flag.
    
            <osuf>	  the object suffix (settable with the -osuf flag)
    	<hisuf>   the hi suffix (settable with the -hisuf flag)
    
    For example, if I have a module A.B.C, in source file foo/A/B/C.hs,
    then GHC will create foo/A/B/C.hi and foo/A/B/C.o.
    
    If GHC is given a source filename which is *not* of the form
    <path>/<basename>.<extension>, then it uses a different strategy.
    This happens if the filename does not follow the module name.  In this
    case, GHC will set <path> to be the directory in which the source file
    resides, and <basename> to the module name with dots replaced by
    slashes, and then use the rules above.
    
    For example, if we put module A.B.C in foo/bar/baz.hs, then GHC will
    produce foo/bar/A/B/C.o and foo/bar/A/B/C.hi.
    2d532e45