[m-dev.] Infix syntax proposal

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 22 14:02:35 AEST 2002


On 22-Aug-2002, Michael Day <mikeday at yeslogic.com> wrote:
> 
> Using regular Makefiles with mmc --make would be quite 
> strange, I think.
> 
> The Makefile would not be aware of the dependencies, so it would be 
> something like this:
> 
> myprogram:
> 	mmc --make myprogram

Actually you probably want either

	myprogram: *.m
		mmc --make myprogram

or

	myprogram: force
		mmc --make myprogram

	.PHONY: force
	force: ;

to ensure that `myprogram' will get remade even if it exists already.
But yes, that's the basic idea.

> But if you had generated source files that mmc --make was not aware of, 
> you would have to do something like this:
> 
> myprogram: *.m
> 	mmc --make myprogram
> 
> %.m : %.moo
> 	moose -u $< > $@

The basic idea here is right, but the details aren't.
Using `myprogram: *.m' doesn't quite work, if there are generated .m
files, because *.m won't match the generated files if they haven't been
generated yet.

You'd need something like this:

	MOOSE_GENERATED_MS := $(patsubst %.moo,%.m,$(wildcard *.moo))

	myprogram: $(MOOSE_GENERATED_MS) *.m
		mmc --make myprogram

or

	MOOSE_GENERATED_MS := $(patsubst %.moo,%.m,$(wildcard *.moo))

	myprogram: $(MOOSE_GENERATED_MS) force
		mmc --make myprogram

	.PHONY: force
	force: ;

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list