diff --git a/Mmake.common.in b/Mmake.common.in index 6df9392a8..5373cf903 100644 --- a/Mmake.common.in +++ b/Mmake.common.in @@ -119,9 +119,9 @@ SHARED_LIBS = @SHARED_LIBS@ # in scripts/Mmake.vars to avoid accidentally overwriting an # existing installation when using an installed mmake. ifeq ($(DESTDIR),) - # DESTDIR is The empty string, DESTDIR_AND_SLASH is therefore empty. since - # the slash can change a relative path into an absolute one; or on Windows, - # from an invalid path name. + # DESTDIR is the empty string, DESTDIR_AND_SLASH must therefore be empty. + # Otherwise the slash can change a relative path into an absolute one; or + # on Windows, it can create an invalid path name. DESTDIR_AND_SLASH= else # We cannot append paths like this in Windows, but we don't think anyone diff --git a/Mmakefile b/Mmakefile index 57cbb1bd4..f3151b71d 100644 --- a/Mmakefile +++ b/Mmakefile @@ -518,20 +518,26 @@ install: install_main install_grades @echo @echo "-- Installation complete." @echo - @echo "-- Don't forget to add $(INSTALL_BINDIR) to your PATH," - @echo "-- $(INSTALL_MAN_DIR) to your MANPATH," - @echo "-- and $(INSTALL_INFO_DIR) to your INFOPATH," + @if test -n "$(DESTDIR)"; then \ + echo "-- The installation was placed in $(DESTDIR)."; \ + echo "-- to complete installation copy the contents of"; \ + echo "-- $(DESTDIR) to the root directory of your system(s)."; \ + echo; \ + fi + @echo "-- Don't forget to add $(FINAL_INSTALL_BINDIR) to your PATH," + @echo "-- $(FINAL_INSTALL_MAN_DIR) to your MANPATH," + @echo "-- and $(FINAL_INSTALL_INFO_DIR) to your INFOPATH," @if test $(ENABLE_DEEP_PROFILER) != yes || \ cmp -s deep_profiler/mdprof_cgi \ $(INSTALL_CGI_DIR)/mdprof_cgi; \ then true ; else \ echo "-- to copy deep_profiler/mdprof_cgi" \ - "to $(INSTALL_CGI_DIR),"; \ + "to $(FINAL_INSTALL_CGI_DIR),"; \ fi @echo "-- and to add the following lines to the \`.emacs' file" @echo "-- in your home directory:" @echo " (add-to-list 'load-path " - @echo " \"$(INSTALL_ELISP_DIR)\")" + @echo " \"$(FINAL_INSTALL_ELISP_DIR)\")" @echo " (autoload 'mdb \"gud\" \"Invoke the Mercury debugger\" t)" .PHONY: install_main diff --git a/scripts/Mmake.vars.in b/scripts/Mmake.vars.in index 79fd72a0f..3cf332fda 100644 --- a/scripts/Mmake.vars.in +++ b/scripts/Mmake.vars.in @@ -664,43 +664,60 @@ INSTALL_MKDIR = mkdir -p # HTML files. # FINAL_INSTALL_PREFIX describes the directory that the installation -# will finally end up in. When building the Mercury compiler, it -# should only be set by the configure script. Other -# FINAL_INSTALL_* variables have a similar meaning. +# will finally end up in. When building the Mercury compiler, it should +# only be set by the configure script. Other FINAL_INSTALL_* variables +# have a similar meaning. +# +# If you want to install to a different directory temporarily (e.g. to +# build a package, or if you don't have the permissions to install to a +# final directory), set DESTDIR on the command-line. If you have +# previously configured to the directory you want to finally install to, +# you will then be able to move the files safely, since any hard-coded +# paths will be set to their final destination already (note that the +# installation in the temporary directory may not work until moved into +# its final destination). e.g. # -# If you want to install to a different directory temporarily (e.g. -# to build a package, or if you don't have the permissions to install -# to a final directory), override INSTALL_PREFIX on the command-line. -# If you have previously configured to the directory you want to -# finally install to, you will then be able to move the files safely, -# since any hard-coded paths will be set to their final destination -# already (note that the installation in the temporary directory may -# not work until moved into its final destination). -# e.g. # configure --prefix /usr -# make INSTALL_PREFIX=/some/temporary/directory/usr +# make DESTDIR=/some/temporary/directory # If you don't intend to install to a temporary directory, rather than -# overriding INSTALL_PREFIX you should reconfigure using the configure -# script, since there are some hardcoded paths created by the configure -# script (e.g. in the shell scripts mmc, ml, mmake, etc) that will not -# be updated simply by overriding INSTALL_PREFIX. +# setting DESTDIR you should reconfigure using the configure script, +# since there are some hardcoded paths created by the configure script +# (e.g. in the shell scripts mmc, ml, mmake, etc) that will not be +# updated simply by overriding INSTALL_PREFIX. -INSTALL_PREFIX = $(DESTDIR)/@prefix@ -FINAL_INSTALL_PREFIX = @prefix@ +ifeq ($(DESTDIR),) + # DESTDIR is the empty string, DESTDIR_AND_SLASH must therefore be empty. + # Otherwise the slash can change a relative path into an absolute one; or + # on Windows, it can create an invalid path name. + DESTDIR_AND_SLASH= +else + # We cannot append paths like this in Windows, but we don't think anyone + # will use DESTDIR on Windows. + DESTDIR_AND_SLASH=$(DESTDIR)/ +endif + +INSTALL_PREFIX = $(DESTDIR_AND_SLASH)@prefix@ INSTALL_BINDIR = $(INSTALL_PREFIX)/bin INSTALL_LIBDIR = $(INSTALL_PREFIX)/lib/mercury -FINAL_INSTALL_LIBDIR = $(FINAL_INSTALL_PREFIX)/lib/mercury INSTALL_INFO_DIR = $(INSTALL_PREFIX)/info INSTALL_DVI_DIR = $(INSTALL_PREFIX)/lib/mercury/doc INSTALL_TEXT_DIR = $(INSTALL_PREFIX)/lib/mercury/doc INSTALL_PS_DIR = $(INSTALL_PREFIX)/lib/mercury/doc INSTALL_PDF_DIR = $(INSTALL_PREFIX)/lib/mercury/doc -INSTALL_MAN_DIR = $(INSTALL_PREFIX)/man +INSTALL_MAN_DIR = $(INSTALL_PREFIX)/Man INSTALL_HTML_DIR = $(INSTALL_PREFIX)/lib/mercury/html INSTALL_MDB_DOC_DIR = $(INSTALL_PREFIX)/lib/mercury/mdb INSTALL_ELISP_DIR = $(INSTALL_PREFIX)/lib/mercury/elisp -INSTALL_CGI_DIR = $(DESTDIR)/@CGIDIR@ +INSTALL_CGI_DIR = $(DESTDIR_AND_SLASH)@CGIDIR@ + +FINAL_INSTALL_PREFIX = @prefix@ +FINAL_INSTALL_BINDIR = $(FINAL_INSTALL_PREFIX)/bin +FINAL_INSTALL_LIBDIR = $(FINAL_INSTALL_PREFIX)/lib/mercury +FINAL_INSTALL_INFO_DIR = $(FINAL_INSTALL_PREFIX)/info +FINAL_INSTALL_MAN_DIR = $(FINAL_INSTALL_PREFIX)/man +FINAL_INSTALL_ELISP_DIR = $(FINAL_INSTALL_PREFIX)/lib/mercury/elisp +FINAL_INSTALL_CGI_DIR = @CGIDIR@ # You should not need to override anything below here