|
![](/i/fill.gif) |
Warp wrote:
> Do you know what a makefile is?
Sure do!
> Make a system which automatically builds a "makefile" behind the scenes
> and keeps it up-to-date as the source code changes (ie. by updating all the
> dependencies between files), and you have gone a long way towards an IDE.
What, you mean like
ghc -M RootModule
or similar?
(This generates a file named "makefile", containing instructions for how
to compile and link RootModule and everything it [recursively] depends on.)
Of course, most people will just do
ghc --make RootModule
This (re)compiles everything that RootModule [indirectly] depends on,
and links the result into a single executable. Unlike a makefile,
1. The "make" program is not required. (Useful on Windows.)
2. You don't have to restart the GHC binary for each source file.
3. GHC can determine what needs to be recompiled based on information
more sophisticated than file modification time.
Then again, GHC only knows about dependencies between *Haskell* source
files. If you had, say, a Haskell program which writes a Haskell
program, GHC wouldn't know about that.
Fortunately, the -M switch is configurable. In particular, it can append
the autogenerated stuff to a hand-written makefile. (And it uses magic
comments so that successive runs of -M can delete the previously added
dependencies before adding the current ones.) In this way, it should be
possible to track all dependencies in a project.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |