X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fusers_guide%2Futils.lit;h=94516bfd38dd9015b6d9ca87976f60435872adcf;hb=5eb1c77c795f92ed0f4c8023847e9d4be1a4fd0d;hp=d007621521d41b4ff303816058af0c11c1d46189;hpb=e7d21ee4f8ac907665a7e170c71d59e13a01da09;p=ghc-hetmet.git diff --git a/ghc/docs/users_guide/utils.lit b/ghc/docs/users_guide/utils.lit index d007621..94516bf 100644 --- a/ghc/docs/users_guide/utils.lit +++ b/ghc/docs/users_guide/utils.lit @@ -22,12 +22,14 @@ GHC, assuming you name your source files the same as your modules. Thus: \begin{verbatim} HC = ghc -HCFLAGS = -fhaskell-1.3 -cpp -hi-diffs $(EXTRA_HC_OPTS) +HCFLAGS = -recomp -cpp -hi-diffs $(EXTRA_HC_OPTS) SRCS = Main.lhs Foo.lhs Bar.lhs OBJS = Main.o Foo.o Bar.o -.SUFFIXES : .o .lhs +.SUFFIXES : .o .hi .lhs +.o.hi: + @: .lhs.o: $(RM) $@ $(HC) -c $< $(HCFLAGS) @@ -37,6 +39,14 @@ cool_pgm : $(OBJS) $(HC) -o $@ $(HCFLAGS) $(OBJS) \end{verbatim} +Note the cheesy \tr{.o.hi} rule: It records the dependency of the +interface (\tr{.hi}) file on the source. The rule says a \tr{.hi} +file can be made from a \tr{.o} file by doing... nothing. Which is +true. + +(Sophisticated \tr{make} variants may achieve some of the above more +elegantly. What we've shown should work with any \tr{make}.) + The only thing lacking in the above \tr{Makefile} is interface-file dependencies. If \tr{Foo.lhs} imports module \tr{Bar} and the \tr{Bar} interface changes, then \tr{Foo.lhs} needs to be recompiled. @@ -55,6 +65,11 @@ Now, before you start compiling, and any time you change the \tr{make cool_pgm}. \tr{mkdependHS} will append the needed dependencies to your \tr{Makefile}. +Please note the use of the recompilation checker (the \tr{-recomp} +\index{-recomp option} flag). Without it, your dependencies will be +{\em inadequate} to cope with the Haskell~1.3 module system! See +\sectionref{recomp} for more details about the recompilation checker! + A few caveats about this simple scheme: (a)~You may need to compile some modules explicitly to create their interfaces in the first place (e.g., \tr{make Bar.o} to create \tr{Bar.hi}). (b)~You may have to @@ -64,6 +79,9 @@ effect. However, a \tr{make} run that does nothing {\em does} mean mutually-recursive modules but, again, it may take multiple iterations to ``settle.'' +To see \tr{mkdependHS}'s command-line flags, give it a duff flag, +e.g., \tr{mkdependHS -help}. + %************************************************************************ %* * \subsection[hstags]{Emacs `TAGS' for Haskell: \tr{hstags}} @@ -72,6 +90,8 @@ iterations to ``settle.'' %* * %************************************************************************ +NB: \tr{hstags} is temporarily dead at version~2.01. Sigh. + `Tags' is a facility for indexing the definitions of programming-language things in a multi-file program, and then using that index to jump around among these definitions. @@ -120,7 +140,7 @@ Andy Gill and Simon Marlow have written a parser-generator for Haskell, called \tr{happy}.\index{happy parser generator} \tr{Happy} is to Haskell what \tr{Yacc} is to C. -You can get \tr{happy} by FTP from \tr{ftp.dcs.glasgow.ac.uk} in +You can get \tr{happy} by FTP from \tr{ftp.dcs.gla.ac.uk} in \tr{pub/haskell/happy}, the file \tr{happy-0.8.tar.gz}. \tr{Happy} is at its shining best when compiled by GHC.