[mercury-users] Make/Mmake/mmc

Julien Fischer juliensf at csse.unimelb.edu.au
Sat Nov 25 17:56:02 AEDT 2006

On Fri, 24 Nov 2006, Tomas By wrote:

> Hello antipodeans,
> A couple of make-related questions:
> What is the best way to generate .mh files for C inclusion. I have:
> .m.mh:
> 	mmc --make-int $*
> which seems to work, but am not sure if that is the right way.

Both mmake and mmc --make allow you to force the creation of .mh files,

 	mmake foo.mh

 	mmc --make foo.mh

will create the .mh file for module foo.

> If I have multiple binaries (written in Mercury) that all include
> different pieces of C code, how do I specify those (C source) object files
> to the linker?

>From section 5 of the user's guide:

 	It is also possible to override these variables on a per-file
 	basis. For example, if you have a module called say bad_style.m which
 	triggers lots of compiler warnings, and you want to disable the warnings
 	just for that file, but keep them for all the other modules, then you
 	can override MCFLAGS just for that file. This is done by setting the
 	variable MCFLAGS-bad_style, as shown here:

 		MCFLAGS-bad_style = --inhibit-warnings

In the case where I have multiple binaries foo and bar and want to link
them with foo_c_code.o and bar_c_code.o respectively I would add the
following to my Mmakefile:

 	MLOBJS-foo = foo_c_code.o
 	MLOBJS-bar = bar_c_code.o

mmc --make has similar functionality.

> I suppose I can have separate explicit make rules for each binary, but
> there ought to be a simpler solution.
> Can I have Mercury-module-specific extra Mmake files or something?

See above.

mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au

More information about the users mailing list