[Haskell-cafe] Compiling with NHC98

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Sun May 8 06:00:46 EDT 2005


> > I haven't used NHC so I can't guarantee this will work, but try doing
> > something like this:
> > 
> >     $ nhc98 -c RC4.hs
> >     $ nhc98 -c prng.hs
> >     $ nhc98 RC4.o prng.o -o prng
> 
> Yay! It does. And I just put it in a makefile:
> 
> ---<daniel's makefile>----
> COMPILER=nhc98
> RC4.o:
>          $(COMPILER) -c RC4.hs
> prng.o:
>          $(COMPILER) -c prng.hs
> prng: RC4.o  prng.o
>          $(COMPILER) RC4.o prng.o -o prng

I strongly recommend using 'hmake' (which is supplied with nhc98, but
also works with ghc) in preference to 'make'.  It tracks the
dependencies between haskell source files automatically (no Makefile),
so there is no chance for the dependencies to get out of sync with
reality..

Hmake was the inspiration for ghc's recently added '--make' option.
However, hmake is more flexible, because it automatically handles the
invocation of many common preprocessors, besides working with multiple
compilers.

Regards,
    Malcolm


More information about the Haskell-Cafe mailing list