Skip to content
Snippets Groups Projects
Commit 071f3e06 authored by Loïc Correnson's avatar Loïc Correnson Committed by Allan Blanchard
Browse files

[makefile] use PREFIX and OPAM_SWITCH_PREFIX

parent 3a167d94
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ MAKECONFIG_DIR=$(FRAMAC_SRC)/share
include $(FRAMAC_SRC)/share/Makefile.common
FRAMAC_DOCDIR ?= $(DOCDIR)/frama-c
FRAMAC_DOCDIR ?= $(PREFIX)/share/doc/frama-c
.PHONY: .force
......@@ -217,6 +217,5 @@ endif
help::
@echo "Documentation installation configuration variable"
@echo " - PREFIX: documentation will be in PREFIX/share/doc/frama-c"
@echo " - DOCDIR: (overrides previous variable) documentation will be in DOCDIR/frama-c"
@echo " - FRAMAC_DOCDIR: (overrides previous variable) documentation will be in FRAMAC_DOCDIR"
@echo " - PREFIX: by default, documentation will be generated in PREFIX/share/doc/frama-c"
@echo " - FRAMAC_DOCDIR: if set, documentation will be in FRAMAC_DOCDIR"
......@@ -50,16 +50,16 @@ DUNE_BUILD_OPTS+=--display $(DUNE_DISPLAY)
PLATFORM:=$(shell uname -s)
#############
# Locations #
# Install #
#############
# Note that Dune rules do NOT use these variables.
# They are used by other Makefiles
# - Ivette (PREFIX)
# - Manuals (DOCDIR)
PREFIX ?= /usr/local
DOCDIR ?= $(PREFIX)/share/doc
ifndef PREFIX
ifdef OPAM_SWITCH_PREFIX
PREFIX=$(OPAM_SWITCH_PREFIX)
else
PREFIX=/usr/local
endif
endif
#############
# Verbosing #
......
......@@ -28,18 +28,13 @@
## Help
help::
@echo "Installation configuration variables"
@echo " - PREFIX: used to customize installation path"
@echo " - MANDIR: used to customize man files installation path"
@echo "Installation configuration variables:"
@echo " - PREFIX: target installation prefix (default is OPAM switch or /usr/local)"
@echo " - MANDIR: custom installation for man pages"
################################
## Default variables
## Man Path
# Set this variable to request a specific installation directory
# Default: Dune installs in the Opam directory
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 PREFIX)
MANDIR?=
......@@ -55,20 +50,24 @@ endif
.PHONY: install uninstall
install:
ifeq ($(PREFIX),)
dune install ${MANDIR_OPT}
install::
ifndef PREFIX
@echo "Warning: cannot install Frama-C: no PREFIX defined, nor OPAM."
@exit 1
else
ifeq ($(PREFIX),$(OPAM_SWITCH_PREFIX))
@echo "Installing Frama-C to current Opam switch"
dune install ${MANDIR_OPT} 2> /dev/null
else
@echo "Installing to prefix: ${PREFIX}"
dune install --prefix ${PREFIX} ${MANDIR_OPT}
@echo "Installing Frama-C to ${PREFIX}"
dune install --prefix ${PREFIX} ${MANDIR_OPT} 2> /dev/null
@echo 'DO NOT FORGET TO EXPAND YOUR OCAMLPATH VARIABLE:'
@echo ' export OCAMLPATH="${PREFIX}/lib:$$OCAMLPATH"'
endif
endif
uninstall:
ifeq ($(PREFIX),)
dune uninstall ${MANDIR_OPT}
else
@echo "Uninstalling from prefix: ${PREFIX}"
dune uninstall --prefix ${PREFIX} ${MANDIR_OPT}
ifdef PREFIX
uninstall::
@echo "Uninstalling Frama-C"
dune uninstall --prefix ${PREFIX} ${MANDIR_OPT} 2> /dev/null
endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment