[m-dev.] for review: Mmake installation commands
Simon TAYLOR
stayl at cs.mu.OZ.AU
Thu May 11 12:32:42 AEST 2000
Hi,
Fergus, could you please review this.
Simon.
Estimated hours taken: 1
Modify the Mmake rules to install libraries so that the user can
specify commands to copy files and make directories. This is useful
if the user wants more control over the ownership and permissions of
the created files and directories.
scripts/Mmake.rules:
compiler/modules.m:
Use $(INSTALL) to copy a file into its installed location.
Use $(INSTALL_MKDIR) to create directories.
scripts/Mmake.vars.in:
Set the default value of INSTALL to `cp' and
INSTALL_MKDIR to `mkdir -p'.
doc/user_guide.texi:
Document the new Mmake variables.
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.77
diff -u -u -r1.77 Mmake.rules
--- scripts/Mmake.rules 2000/04/19 07:31:54 1.77
+++ scripts/Mmake.rules 2000/05/10 04:58:15
@@ -341,15 +341,15 @@
.PHONY: lib%.install_init
lib%.install_init: %.init install_lib_dirs
- cp `vpath_find $*.init` $(INSTALL_MODULE_DIR)
+ $(INSTALL) `vpath_find $*.init` $(INSTALL_MODULE_DIR)
.PHONY: lib%.install_library
lib%.install_library: lib%.a lib%.$(EXT_FOR_SHARED_LIB) install_grade_dirs
- cp `vpath_find lib$*.a lib$*.$(EXT_FOR_SHARED_LIB)` \
+ $(INSTALL) `vpath_find lib$*.a lib$*.$(EXT_FOR_SHARED_LIB)` \
$(INSTALL_MERC_LIB_DIR)
lib%.install_split_library: %.split.a install_grade_dirs
- cp `vpath_find $*.split.a` $(INSTALL_MERC_LIB_DIR)/lib$*.a
+ $(INSTALL) `vpath_find $*.split.a` $(INSTALL_MERC_LIB_DIR)/lib$*.a
lib%.install_grades:
rm -rf tmp_dir && \
@@ -384,15 +384,16 @@
.PHONY: install_lib_dirs
install_lib_dirs:
- -[ -d $(INSTALL_INT_DIR) ] || mkdir -p $(INSTALL_INT_DIR)
- -[ -d $(INSTALL_INC_DIR) ] || mkdir -p $(INSTALL_INC_DIR)
- -[ -d $(INSTALL_MODULE_DIR) ] || mkdir -p $(INSTALL_MODULE_DIR)
+ -[ -d $(INSTALL_INT_DIR) ] || $(INSTALL_MKDIR) $(INSTALL_INT_DIR)
+ -[ -d $(INSTALL_INC_DIR) ] || $(INSTALL_MKDIR) $(INSTALL_INC_DIR)
+ -[ -d $(INSTALL_MODULE_DIR) ] || $(INSTALL_MKDIR) $(INSTALL_MODULE_DIR)
# The following is needed to support the `--use-subdirs' option
-[ -d $(INSTALL_INT_DIR)/Mercury ] || \
- mkdir -p $(INSTALL_INT_DIR)/Mercury
+ $(INSTALL_MKDIR) $(INSTALL_INT_DIR)/Mercury
.PHONY: install_grade_dirs
install_grade_dirs: #install_lib_dirs
- -[ -d $(INSTALL_MERC_LIB_DIR) ] || mkdir -p $(INSTALL_MERC_LIB_DIR)
+ -[ -d $(INSTALL_MERC_LIB_DIR) ] || \
+ $(INSTALL_MKDIR) $(INSTALL_MERC_LIB_DIR)
#-----------------------------------------------------------------------------#
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.30
diff -u -u -r1.30 Mmake.vars.in
--- scripts/Mmake.vars.in 2000/01/11 07:59:46 1.30
+++ scripts/Mmake.vars.in 2000/05/10 04:57:39
@@ -405,6 +405,13 @@
#-----------------------------------------------------------------------------#
+# Specify commands for installing things.
+
+INSTALL = cp
+INSTALL_MKDIR = mkdir -p
+
+#-----------------------------------------------------------------------------#
+
# Specify the locations for installing things.
# These directories can all be modified independantly.
# In particular, you might want to find a better place for the DVI and
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.119
diff -u -u -r1.119 modules.m
--- compiler/modules.m 2000/04/18 17:57:18 1.119
+++ compiler/modules.m 2000/05/10 06:16:57
@@ -2883,17 +2883,20 @@
echo \"$$target unchanged\"; \\
else \\
echo \"installing $$target\"; \\
- cp ""$$file"" ""$$target""; \\
+ $(INSTALL) ""$$file"" ""$$target""; \\
fi; \\
done
# The following is needed to support the `--use-subdirs' option
- # We try using `ln -s', but if that fails, then we just use `cp'.
+ # We try using `ln -s', but if that fails, then we just use
+ # `$(INSTALL)'.
for ext in int int2 int3 opt trans_opt; do \\
dir=""$(INSTALL_INT_DIR)/Mercury/$${ext}s""; \\
rm -f ""$$dir""; \\
ln -s .. ""$$dir"" || { \\
- { [ -d ""$$dir"" ] || mkdir ""$$dir""; } && \\
- cp ""$(INSTALL_INT_DIR)""/*.$$ext ""$$dir""; \\
+ { [ -d ""$$dir"" ] || \\
+ $(INSTALL_MKDIR) ""$$dir""; } && \\
+ $(INSTALL) ""$(INSTALL_INT_DIR)""/*.$$ext \\
+ ""$$dir""; \\
} || exit 1; \\
done\n\n" },
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.205
diff -u -u -r1.205 user_guide.texi
--- doc/user_guide.texi 2000/04/20 06:26:42 1.205
+++ doc/user_guide.texi 2000/05/10 07:37:24
@@ -434,7 +434,10 @@
(for platforms that support it) a shared object library,
for the default grade and also for the additional grades specified
in the LIBGRADES variable. It will also build and install the
-necessary interface files.
+necessary interface files. The variable INSTALL specifies
+the name of the command to use to install each file, by default
+ at code{cp}. The variable INSTALL_MKDIR specifies the command to use
+to create directories, by default @code{mkdir -p}.
For more information, see @ref{Supporting multiple grades and architectures}.
@item @var{main-module}.clean
@@ -571,6 +574,16 @@
etc. you are building should be installed. The default is to install in
the same location as the Mercury compiler being used to do the install.
+ at item INSTALL
+The command used to install each file in a library. The command should
+take a list of files to install and the location to install them.
+The default command is @code{cp}.
+
+ at item INSTALL_MKDIR
+The command used to create each directory in the directory hierarchy
+where the libraries are to be installed. The default command is
+ at code{mkdir -p}.
+
@item LIBGRADES
A list of additional grades which should be built when installing libraries.
The default is to install the Mercury compiler's default set of grades.
@@ -869,6 +882,12 @@
One can override the list of grades to install for a given library
@samp{lib at var{foo}} by setting the @samp{LIBGRADES- at var{foo}} variable,
or add to it by setting @samp{EXTRA_LIBGRADES- at var{foo}}.
+
+The command used to install each file is specified by @samp{INSTALL}.
+If @samp{INSTALL} is not specified, @samp{cp} will be used.
+
+The command used to create directories is specified by @samp{INSTALL_MKDIR}.
+If @samp{INSTALL_MKDIR} is not specified, @samp{mkdir -p} will be used.
Note that currently it is not possible to set the installation prefix
on a library-by-library basis.
--------------------------------------------------------------------------
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