[m-dev.] For review: More clpr updates

Warwick Harvey wharvey at cs.monash.edu.au
Mon Feb 7 11:32:30 AEDT 2000


Fergus wrote:
> On 03-Feb-2000, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> > Part of this change includes by default installing a standalone version of 
> > CLP(R) if the user installs the CLP(R) libraries.  I find this useful, but 
> > maybe it's not appropriate?
> 
> I don't think it is appropriate.
> By all means add a target to do that, and document it
> in the README file, but I don't think it should be
> part of the normal "install" target.

Yup, fixed.

> I think it would be best to keep $(SUBDIR_MMAKE),
> even if that is defined as just $(MMAKE) $(MMAKEFLAGS).

Yup, good idea, fixed.

> > Index: clpr/Mmakefile
> ...
> > +MAKE = gmake
> 
> That is wrong, I think; AFAIK there is no guarantee that the system
> will have a program called `gmake' on it.

Yup.  I'm not sure where that one came from.  Fixed.

Alternatively I could just add the appropriate rules to the Mmakefile and 
abandon the use of the Makefile altogether.

> > +# This should be made more general
> > +clpr_script: clpr_script.in
> > +	sed -e "s, at LIBDIR@,$(INSTALL_LIBDIR),g" \
> > +		-e "s, at FULLARCH@,$(FULLARCH),g" < $< > $@
> > +	chmod +x $@
> 
> `chmod +x' is not portable, I think; on some systems
> it means `chmod u+x' and on others it means `chmod a+x'.
> Probably you want `chmod a+x' here.

Fixed.


I've also fixed it so that the CLP(R) library (rather than just the 
interface) is built when the user just types `mmake'.  (My initial changes 
had changed this behaviour so it was delayed until install time or when 
needed by the samples, or until the user specifically requested it be built, 
etc..)

Anyway, here's a relative diff with updated log message.

Warwick


Estimated hours taken: 5

A bunch of updates to (extras/)clpr, mainly to make use of the "new" library
install support.

clpr/Mmakefile:
        Updated to use the "new" library install support.

clpr/README:
        Add descriptions of the main targets used for building and 
        installing the libraries, etc.

clpr/clpr/Mmakefile:
        Updated to use the "new" library install support.
        Added rules to install a standalone version of CLP(R), including
        installing the `init.clpr' file and specifying an appropriate
        LIBPATH so it can be found.
        Updated some of the hand-coded library targets to match what Mercury
        would generate for them if they were Mercury libraries.

clpr/clpr/clpr_script.in:
        New script, to be installed in the appropriate `bin' directory as
        `clpr', which calls the binary CLP(R) executable (installed in the
        appropriate architecture-dependent `bin' directory). 


diff -udr clpr3/Mmakefile clpr/Mmakefile
--- clpr3/Mmakefile	Mon Feb  7 11:19:14 2000
+++ clpr/Mmakefile	Mon Feb  7 10:46:06 2000
@@ -42,9 +42,11 @@
 # In case the user doesn't define it, to avoid a warning
 MMAKEFLAGS=
 
+SUBDIR_MMAKE = $(MMAKE) $(MMAKEFLAGS) INSTALL_PREFIX=$(INSTALL_PREFIX)
+
 #---------------------------------------------------------------------------
--#
 
-MAIN_TARGET = libcfloat_lib
+MAIN_TARGET = libcfloat_lib clpr
 
 #---------------------------------------------------------------------------
--#
 
@@ -53,28 +55,30 @@
 
 .PHONY: depend_samples
 depend_samples:
-	cd samples && $(MMAKE) $(MMAKEFLAGS) depend
+	cd samples && $(SUBDIR_MMAKE) depend
 
 .PHONY: install
 install: libcfloat_lib.install clpr_install
 
 .PHONY: clpr_install
 clpr_install:
-	cd clpr && $(MMAKE) $(MMAKEFLAGS) \
-		INSTALL_PREFIX=$(INSTALL_PREFIX) \
-		install
+	cd clpr && $(SUBDIR_MMAKE) install
+
+.PHONY: clpr_install_bin
+clpr_install_bin:
+	cd clpr && $(SUBDIR_MMAKE) install_bin
 
 .PHONY: clpr
 clpr:
-	cd clpr && $(MMAKE) $(MMAKEFLAGS)
+	cd clpr && $(SUBDIR_MMAKE)
 
 .PHONY: samples
 samples: libcfloat_lib clpr
-	cd samples && $(MMAKE) $(MMAKEFLAGS)
+	cd samples && $(SUBDIR_MMAKE)
 
 .PHONY: check
 check: libcfloat_lib clpr
-	cd samples && $(MMAKE) $(MMAKEFLAGS) check
+	cd samples && $(SUBDIR_MMAKE) check
 
 #---------------------------------------------------------------------------
--#
 
@@ -83,21 +87,21 @@
 
 .PHONY: clean_clpr
 clean_clpr:
-	cd clpr && $(MMAKE) $(MMAKEFLAGS) clean
+	cd clpr && $(SUBDIR_MMAKE) clean
 
 .PHONY: clean_samples
 clean_samples:
-	cd samples && $(MMAKE) $(MMAKEFLAGS) clean
+	cd samples && $(SUBDIR_MMAKE) clean
 
 .PHONY: realclean
 realclean: realclean_clpr realclean_samples
 
 .PHONY: realclean_clpr
 realclean_clpr:
-	cd clpr && $(MMAKE) $(MMAKEFLAGS) realclean
+	cd clpr && $(SUBDIR_MMAKE) realclean
 
 .PHONY: realclean_samples
 realclean_samples:
-	cd samples && $(MMAKE) $(MMAKEFLAGS) realclean
+	cd samples && $(SUBDIR_MMAKE) realclean
 
 #---------------------------------------------------------------------------
--#
diff -udr clpr3/README clpr/README
--- clpr3/README	Wed Oct  1 00:13:37 1997
+++ clpr/README	Fri Feb  4 12:35:39 2000
@@ -21,3 +21,25 @@
 	dec-alpha-osf3.2
 	i586-pc-linux-gnu
 
+
+The following targets have been provided in the Mmakefile for building and
+installing CLP(R).  Please check the value of `$(INSTALL_PREFIX)' is set
+appropriately before installing.
+
+depend
+	Builds the appropriate dependencies for the Mercury interface and
+	the sample programs.
+
+samples
+	Builds the sample programs.
+
+check
+	Builds and runs the sample programs, checking that their output
+	matches their expected output.
+
+install
+	Builds and installs the CLP(R) library and Mercury interface.
+
+clpr_install_bin
+	Builds and installs a standalone version of CLP(R).
+
diff -udr clpr3/clpr/Mmakefile clpr/clpr/Mmakefile
--- clpr3/clpr/Mmakefile	Mon Feb  7 11:19:14 2000
+++ clpr/clpr/Mmakefile	Mon Feb  7 11:09:39 2000
@@ -2,8 +2,6 @@
 
 INSTALL_PREFIX := $(INSTALL_PREFIX)/extras
 
-MAKE = gmake
-
 #---------------------------------------------------------------------------
--#
 
 MAIN_TARGET = libclpr
@@ -45,14 +43,14 @@
 clpr_script: clpr_script.in
 	sed -e "s, at LIBDIR@,$(INSTALL_LIBDIR),g" \
 		-e "s, at FULLARCH@,$(FULLARCH),g" < $< > $@
-	chmod +x $@
+	chmod a+x $@
 
 #---------------------------------------------------------------------------
--#
 
 INSTALL_MERC_CLPR_LIB_DIR = $(INSTALL_MERC_GRADELESS_LIB_DIR)
 
 .PHONY: install
-install: install_headers install_lib install_init install_bin
+install: install_headers install_lib
 
 .PHONY: install_headers
 install_headers: *.h
@@ -67,17 +65,14 @@
 	cp libclpr.a libclpr.$(EXT_FOR_SHARED_LIB) \
 		$(INSTALL_MERC_CLPR_LIB_DIR)
 
-.PHONY: install_init
-install_init: init.clpr
-	-[ -d $(INSTALL_LIBDIR) ] || mkdir -p $(INSTALL_LIBDIR)
-	cp init.clpr $(INSTALL_LIBDIR)
-
 .PHONY: install_bin
-install_bin: clpr clpr_script
+install_bin: clpr clpr_script init.clpr
 	-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
 	cp clpr $(INSTALL_MERC_BIN_DIR)
 	-[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
 	cp clpr_script $(INSTALL_BINDIR)/clpr
+	-[ -d $(INSTALL_LIBDIR) ] || mkdir -p $(INSTALL_LIBDIR)
+	cp init.clpr $(INSTALL_LIBDIR)
 
 #---------------------------------------------------------------------------
--#
 


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