ghc --make and make

Frederik Eaton frederik at a5.repetae.net
Thu Dec 8 21:13:14 EST 2005


Shouldn't it work to pass "-M --make"? Or, hmm, maybe -M isn't
generating enough dependencies - like, it seems that it should
generate a dependency for the final output file specified with "-o"
but it isn't...

Frederik

On Wed, Dec 07, 2005 at 11:34:55AM -0000, Simon Marlow wrote:
> On 04 December 2005 00:51, John Meacham wrote:
> 
> > I was thinking it would be nice if ghc --make could touch the output
> > file with the timestamp of the most recently modified source file.
> > 
> > As it is, if you edit a file in between when ghc --make starts and it
> > finishes (a substantial amount of time in some cases) then 'make' will
> > not realize the dependencies have changed.
> 
> Hmm, I'm not sure about this.  I see the problem: you have a Makefile
> rule that looks like this:
> 
> myprog : Main.hs Foo.hs Bar.hs ...
>   $(GHC) -o $@ --make Main.hs
> 
> and while building myprog, you edit Foo.hs after it has been compiled,
> with the result that myprog has a later modification date than Foo.hs so
> won't be recompiled.
> 
> However, touching myprog to match the date of Foo.hs when it was
> compiled doesn't seem right - the date on the executable would be
> earlier than the object files, which might not cause problems with the
> Makefile rule above, but would likely lead to problems with different
> Makefile setups.  Perhaps the date on an object file should be set to
> the same as the source file?  And the date on the .hi file?
> 
> The easiest thing to do is not to try to use make dependencies with
> --make, just run ghc --make every time.  It doesn't link if linking
> isn't required any more.
> 
> Cheers,
> 	Simon
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 


More information about the Glasgow-haskell-users mailing list