From 3a167d944593b05b8175d5d68fdb8b4b47fb1200 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr>
Date: Mon, 10 Oct 2022 11:28:28 +0200
Subject: [PATCH] [build] make install: replaces environment variable
 INSTALLDIR by PREFIX.

This is more coherent with `dune install --prefix` option and other targets
`make install` in doc and ivette Makefiles.
---
 nix/frama-c.nix             |  2 +-
 nix/internal-tests.nix      |  2 +-
 nix/mk_plugin.nix           |  2 +-
 opam/opam                   |  2 +-
 share/Makefile.installation | 20 ++++++++++----------
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/nix/frama-c.nix b/nix/frama-c.nix
index 457a9d9c820..ac981c7f92d 100644
--- a/nix/frama-c.nix
+++ b/nix/frama-c.nix
@@ -110,7 +110,7 @@ stdenvNoCC.mkDerivation rec {
   '';
 
   installFlags = [
-    "INSTALLDIR=$(out)"
+    "PREFIX=$(out)"
   ];
 
   # Simpler for our test target
diff --git a/nix/internal-tests.nix b/nix/internal-tests.nix
index 7b7da8d89ac..a2454edc35b 100644
--- a/nix/internal-tests.nix
+++ b/nix/internal-tests.nix
@@ -133,7 +133,7 @@ stdenvNoCC.mkDerivation rec {
   '';
 
   installFlags = [
-    "INSTALLDIR=$(out)"
+    "PREFIX=$(out)"
   ];
 
   meta = {
diff --git a/nix/mk_plugin.nix b/nix/mk_plugin.nix
index c5280b67f10..86f1499b69f 100644
--- a/nix/mk_plugin.nix
+++ b/nix/mk_plugin.nix
@@ -112,7 +112,7 @@ stdenv.mkDerivation {
   '';
 
   installFlags = [
-    "INSTALLDIR=$(out)"
+    "PREFIX=$(out)"
   ];
 
   postInstall = if install-opam then ''
diff --git a/opam/opam b/opam/opam
index dc071e629a7..8adf2660e4a 100644
--- a/opam/opam
+++ b/opam/opam
@@ -92,7 +92,7 @@ build: [
 ]
 
 install: [
-  [make "INSTALLDIR=%{prefix}%" "MANDIR=%{mandir}%" "install"]
+  [make "PREFIX=%{prefix}%" "MANDIR=%{mandir}%" "install"]
   [make "PREFIX=%{prefix}%" "-C" "doc" "install"] {with-doc}
 ]
 
diff --git a/share/Makefile.installation b/share/Makefile.installation
index 544db518ed7..4bbbeae51be 100644
--- a/share/Makefile.installation
+++ b/share/Makefile.installation
@@ -29,7 +29,7 @@
 
 help::
 	@echo "Installation configuration variables"
-	@echo "  - INSTALLDIR: used to customize installation path"
+	@echo "  - PREFIX: used to customize installation path"
 	@echo "  - MANDIR: used to customize man files installation path"
 
 ################################
@@ -37,11 +37,11 @@ help::
 
 # Set this variable to request a specific installation directory
 # Default: Dune installs in the Opam directory
-INSTALLDIR?=
+PREFIX?=
 
 # Set this variable to request a specific man installation directory
 # Default: the manuals are installed in the installation directory transmitted
-# to Dune (so either in Opam or in INSTALLDIR)
+# to Dune (so either in Opam or in PREFIX)
 MANDIR?=
 
 ifeq (${MANDIR},)
@@ -56,19 +56,19 @@ endif
 .PHONY: install uninstall
 
 install:
-ifeq ($(INSTALLDIR),)
+ifeq ($(PREFIX),)
 	dune install ${MANDIR_OPT}
 else
-	@echo "Installing to prefix: ${INSTALLDIR}"
-	dune install --prefix ${INSTALLDIR} ${MANDIR_OPT}
+	@echo "Installing to prefix: ${PREFIX}"
+	dune install --prefix ${PREFIX} ${MANDIR_OPT}
 	@echo 'DO NOT FORGET TO EXPAND YOUR OCAMLPATH VARIABLE:'
-	@echo '  export OCAMLPATH="${INSTALLDIR}/lib:$$OCAMLPATH"'
+	@echo '  export OCAMLPATH="${PREFIX}/lib:$$OCAMLPATH"'
 endif
 
 uninstall:
-ifeq ($(INSTALLDIR),)
+ifeq ($(PREFIX),)
 	dune uninstall ${MANDIR_OPT}
 else
-	@echo "Uninstalling from prefix: ${INSTALLDIR}"
-	dune uninstall --prefix ${INSTALLDIR} ${MANDIR_OPT}
+	@echo "Uninstalling from prefix: ${PREFIX}"
+	dune uninstall --prefix ${PREFIX} ${MANDIR_OPT}
 endif
-- 
GitLab