[m-dev.] Grade-conditional predicates & modes

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Sep 9 01:29:09 AEST 1998


On 08-Sep-1998, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> 
> With some of the changes I've been making to the Mercury compiler, I have 
> come across the desire to have certain library predicates (and certain modes 
> of others) only available in some grades of the compiler.
> 
> Apart from there being no support for conditional compilation,
> all grades share the same interface files, and so on.

The current implementation does not impose that requirement.
Just do a `mmake realclean; mmake depend' if you change the grade.
If you're building libraries, for multiple grades, then just copy
the interface files into per-grade directories.

> It would seem that adding this kind of feature would require a major 
> overhaul, and is more work than the feature is worth to me.  :-)

If you really want conditional compilation, it's quite trivial to add.
For example, here's a two-line addition to your Mmakefile that should
do most of what you need:

	%.m: %.mpp
		sed '/^#if TRAILING/,/^#endif/d' $< > $@

In addition, you may have to add some dependencies for the `depend'
target(s), e.g.

	MPP_SOURCES = $(wildcard *.mpp)
	M_SOURCES = $(MPP_SOURCES:.mpp=.m)
	depend: $(M_SOURCES)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list