[mercury-users] Correct approach to install library containing extra C code?

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Apr 3 01:33:58 AEST 2003


On 02-Apr-2003, Ondrej Bojar <oboj7042 at ss1000.ms.mff.cuni.cz> wrote:
> I use 'mmake libmylib.depend; mmake libmylib; mmake libmylib.install' to
> build and install a library containing both, Mercury and C code.
> 
> In my Mmakefile, I link the extra C objects to the library this way:
> 
> MLOBJS-mylib=c_object1.o c_object2.o
> 
> When trying to use the library, the header files (c_object1.h and
> c_object2.h) are missing.
> 
> How should I influence the 'mmake lib....install' phase to install these
> as well? Or should I copy the .h files to the .../lib/mercury/ints by
> hand?

I think you need to copy them to $(INSTALL_INC_DIR),
i.e. .../lib/mercury/incs, as well as to $(INSTALL_INT_DIR),
i.e. .../lib/mercury/ints.

Rather than doing it by hand, you can do this by adding a new target
in your Mmakefile,

	MYLIB_C_HDRS = c_object1.h c_object2.h

	.PHONY: libmylib.install_c_hdrs
	libmylib.install_c_hdrs:
		for hdr in $(MYLIB_C_HDRS); do \
			$(INSTALL) $$hdr $(INSTALL_INT_DIR); \
			$(INSTALL) $$hdr $(INSTALL_INC_DIR); \
		done

and adding a dependency to ensure that this target gets invoked:

	libmylib.install: libmylib.install_c_hdrs

-- 
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-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