preprocessors

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Fri, 15 Feb 2002 11:27:05 +0000


> But what's the best way to manage this?  Suppose you have
> several modules, some of which need no preprocessor, while others need
> to be preprocessed in different ways (ignoring multiple extensions --
> too hard).  I've been doing this by using different filename extensions
> to distinguish them, plus a patched version of Hugs that can be told
> what filename extensions to accept, plus a preprocessor that uses the
> filename extensions to decide what to do.  (For example, .y files could
> be sent through happy.)

The latest version of hmake (3.01) has support for calling a
preprocessor based on the filename extension, before calling the
compiler on the resulting file.  Currently, it recognises:

	.y	Happy
	.ly	literate Happy 
	.gc	GreenCard
	.hsc	hsc2hs
	.chs	C->HS
	.hs.cpp	C preprocessor

I'm not really sure whether the invocation magic for all of these
is correct yet, but I would encourage people to try it out and
send patches.  It is pretty easy to add new preprocessors - there
are basically four options to define for each pp in addition to the
filename extension.

Regards,
    Malcolm