diff --git a/doc/Makefile b/doc/Makefile index 7449ebf6b505600d5e295747868d015064fcb430..9c43626645eaf939ab3f9504f6b39fc095afc898 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -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" diff --git a/share/Makefile.common b/share/Makefile.common index f2ed89e458f18e7f6ad686ed0c86043c1789e7a5..b3c6d6eb692e91d0cb53cf9bd87f3b06d05a4019 100644 --- a/share/Makefile.common +++ b/share/Makefile.common @@ -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 # diff --git a/share/Makefile.installation b/share/Makefile.installation index 4bbbeae51be9f6287aee61d8eb4e32626b7728c1..11c30cb0dd3ec20d2946d4394538e3abb8cfebd0 100644 --- a/share/Makefile.installation +++ b/share/Makefile.installation @@ -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