[mercury-users] Compiling Libraries...

Nancy Mazur Nancy.Mazur at cs.kuleuven.ac.be
Fri Dec 13 00:33:12 AEDT 2002


* Noel  Pinto <cool4life at rediffmail.com> [2002-12-12 14:06]:
> Hi,
> I have not really understood how the Mmakefile works. What I am 
> trying to say is that the example in the User's Guide about the 
> example of the Mmakefile is not given fully. There are some '...' 
> indicating much more and I am not able to find much info about how 
> to go ahead with it and for me as a beginner there is very less 
> clarity.
> 
> Plz do explain the variables that go in the Mmakefile.

I'm not used to build my own libraries myself, but reading the manual
did give me enough information. 

In section "Building libraries", it sais that: "The Mmake target
`libfoo' is a built-in target for creating a library whose top-level
module is `foo.m'.

So that's already one error you make in your test: if a module is named
"blabla", and is located in the file "blabla.m", then building a library
out of this is as simple as writing: 
	$ mmake blabla.depend
	$ mmake libblabla

Note that mmake is told to make a library out of blabla, by instructing
it to make "libblabla" instead of "blabla". 
Your mistake, here below, is to call your module libtesting, and then to
expect that a "$ mmake libtesting" makes you a library... that should be 
"$ mmake liblibtesting"... See the difference? 

Here no Mmakefile is used. 
But to save some typing, you could provide a Mmakefile containing: 

MAIN_TARGET=libblabla
depend: blabla.depend

(something which is explained in the manual)

And then you can build your library by simply: 
	$ mmake depend
	$ mmake

Hope this helps, 
Nancy

PS: the compiler will give an error though, because you declare a
predicate display, with two arguments, yet, you define display as if it
had 4 arguments (using the DCG notation "-->"). 

> 
> Thanks in Advance.
> 
> Regards,
> 
> Noel
> On Thu, 12 Dec 2002 Nancy Mazur wrote :
> >* Noel  Pinto <cool4life at rediffmail.com> [2002-12-12 10:45]:
> >> Hi,
> >>
> >> I am learning to build libraries. I am not able to understand 
> >how
> >> to build libraries. It is not clear from the User Guide.
> >>
> >> I am trying to compile a file written as...
> >>
> >> :- module libtesting.
> >>
> >> :- interface.
> >>
> >> :- import_module string.
> >>
> >> :- pred display(string, string).
> >> :- mode display(in, out) is det.
> >>
> >> :- implementation.
> >>
> >> :- import_module io.
> >>
> >> display(StrOld, StrNew) -->
> >>         { StrNew = StrOld}.
> >>
> >> It is giving me an error during compilation. I really do not 
> >know
> >> whether this is the right way to do it.
> >> $ mmake libtesting.depend
> >> /tmp/mmake.601479:549: *** missing separator.  Stop.
> >
> >Are you sure you're giving us all the information? What is the 
> >content
> >of your Mmakefile, because I guess you're using one.
> >
> >Nancy
> >--------------------------------------------------------------------------
> >mercury-users mailing list
> >post:  mercury-users at cs.mu.oz.au
> >administrative address: owner-mercury-users at cs.mu.oz.au
> >unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: 
> >unsubscribe
> >subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: 
> >subscribe
> >--------------------------------------------------------------------------
> 
> 
> --------------------------------------------------------------------------
> mercury-users mailing list
> post:  mercury-users at cs.mu.oz.au
> administrative address: owner-mercury-users at cs.mu.oz.au
> unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
> subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
> --------------------------------------------------------------------------

-- 
nancy.mazur at cs.kuleuven.ac.be ------------ Katholieke Universiteit Leuven -
tel: +32-16-327596 - fax: +32-16-327996 ------- Dept. of Computer Science -
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list