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)
$(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.
\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
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}}
%* *
%************************************************************************
+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.
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.