aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Tassi2020-05-27 22:00:00 +0200
committerEnrico Tassi2020-05-27 22:00:00 +0200
commita102a80d886bafc75991a446d1c1ae4c04494666 (patch)
treecb1070f44e52a101c68f6f33179fcb95812e6610
parent35e175710795974a4a38c8a7d6da6a5ccaf8de74 (diff)
parent4bdfeb3c6d3a90fe2980a6d9063bb00136c53eeb (diff)
Merge PR #12389: Small coq_makefile improvement.
Reviewed-by: gares
-rw-r--r--doc/changelog/08-tools/12389-coq_makefile.rst5
-rw-r--r--doc/sphinx/practical-tools/utilities.rst4
-rw-r--r--tools/CoqMakefile.in28
3 files changed, 25 insertions, 12 deletions
diff --git a/doc/changelog/08-tools/12389-coq_makefile.rst b/doc/changelog/08-tools/12389-coq_makefile.rst
new file mode 100644
index 0000000000..74e3a68170
--- /dev/null
+++ b/doc/changelog/08-tools/12389-coq_makefile.rst
@@ -0,0 +1,5 @@
+- **Changed:**
+ Adding the possibility in coq_makefile to directly set the installation folders,
+ through the :n:`COQLIBINSTALL` and :n:`COQDOCINSTALL` variables.
+ See :ref:`coqmakefilelocal`.
+ (`#12389 <https://github.com/coq/coq/pull/12389>`_, by Martin Bodin, review of Enrico Tassi).
diff --git a/doc/sphinx/practical-tools/utilities.rst b/doc/sphinx/practical-tools/utilities.rst
index 408f8fc3ec..33ebbce640 100644
--- a/doc/sphinx/practical-tools/utilities.rst
+++ b/doc/sphinx/practical-tools/utilities.rst
@@ -170,6 +170,10 @@ Here we describe only few of them.
override the flags passed to ``coqdoc``. By default ``-interpolate -utf8``.
:COQDOCEXTRAFLAGS:
extend the flags passed to ``coqdoc``
+:COQLIBINSTALL, COQDOCINSTALL:
+ specify where the Coq libraries and documentation will be installed.
+ By default a combination of ``$(DESTDIR)`` (if defined) with
+ ``$(COQLIB)/user-contrib`` and ``$(DOCDIR)/user-contrib``.
**Rule extension**
diff --git a/tools/CoqMakefile.in b/tools/CoqMakefile.in
index a26eb9dfbe..e2ed2db728 100644
--- a/tools/CoqMakefile.in
+++ b/tools/CoqMakefile.in
@@ -146,6 +146,21 @@ TIME_OF_PRETTY_BUILD_EXTRA_FILES ?= - # also output to the command line
TGTS ?=
+# Retro compatibility (DESTDIR is standard on Unix, DSTROOT is not)
+ifdef DSTROOT
+DESTDIR := $(DSTROOT)
+endif
+
+# Substitution of the path by appending $(DESTDIR) if needed.
+# The variable $(COQMF_WINDRIVE) can be needed for Cygwin environments.
+windrive_path = $(if $(COQMF_WINDRIVE),$(subst $(COQMF_WINDRIVE),/,$(1)),$(1))
+destination_path = $(if $(DESTDIR),$(DESTDIR)/$(call windrive_path,$(1)),$(1))
+
+# Installation paths of libraries and documentation.
+COQLIBINSTALL ?= $(call destination_path,$(COQLIB)/user-contrib)
+COQDOCINSTALL ?= $(call destination_path,$(DOCDIR)/user-contrib)
+COQTOPINSTALL ?= $(call destination_path,$(COQLIB)/toploop) # FIXME: Unused variable?
+
########## End of parameters ##################################################
# What follows may be relevant to you only if you need to
# extend this Makefile. If so, look for 'Extension point' here and
@@ -227,17 +242,6 @@ else
TIMING_ARG=
endif
-# Retro compatibility (DESTDIR is standard on Unix, DSTROOT is not)
-ifdef DSTROOT
-DESTDIR := $(DSTROOT)
-endif
-
-concat_path = $(if $(1),$(1)/$(if $(COQMF_WINDRIVE),$(subst $(COQMF_WINDRIVE),/,$(2)),$(2)),$(2))
-
-COQLIBINSTALL = $(call concat_path,$(DESTDIR),$(COQLIB)/user-contrib)
-COQDOCINSTALL = $(call concat_path,$(DESTDIR),$(DOCDIR)/user-contrib)
-COQTOPINSTALL = $(call concat_path,$(DESTDIR),$(COQLIB)/toploop)
-
# Files #######################################################################
#
# We here define a bunch of variables about the files being part of the
@@ -577,7 +581,7 @@ uninstall::
instf="$(COQLIBINSTALL)/$$df/`basename $$f`" &&\
rm -f "$$instf" &&\
echo RM "$$instf" &&\
- (rmdir "$(call concat_path,,$(COQLIBINSTALL)/$$df/)" 2>/dev/null || true); \
+ (rmdir "$(COQLIBINSTALL)/$$df/" 2>/dev/null || true); \
done
.PHONY: uninstall