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

Peter Moulder pmoulder at csse.monash.edu.au
Thu Apr 3 13:47:40 AEST 2003


> 	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

Better example code would be to prepend `set -e; ' to the
`for' loop.

(If one wants to disregard errors copying the files, then one should use
an explicit `|| true'; otherwise, an error copying the last file will
not be ignored.)

The Gnu standards for makefiles would additionally recommend that the
$(INSTALL) commands be written e.g.

	$(INSTALL_DATA) $$hdr $(INSTALL_INT_DIR)/$$hdr

where the default value of $(INSTALL_DATA) is `${INSTALL} -m 644'.

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