Makefile: add PREFIX variable

We use a Makefile which in turn uses cmake. If we wanted to set the install
prefix for cmake, we had to do this so far:

  make CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=/tmp/nvim"

That's long and hard to remember. Following the conventions of other Makefiles,
this now works as well and is equivalent:

  make PREFIX=/tmp/nvim
This commit is contained in:
Marco Hinz 2016-10-08 02:23:51 +02:00
parent 31f6334aa8
commit c13f72ee0a
No known key found for this signature in database
GPG Key ID: AC9D48E91BCF448C
2 changed files with 5 additions and 1 deletions

View File

@ -13,6 +13,10 @@ CLINT_ERRORS_FILE_PATH := /reports/clint/errors.json
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
echo "Unix Makefiles")
ifneq (,$(PREFIX))
CMAKE_FLAGS += -DCMAKE_INSTALL_PREFIX:PATH="$(PREFIX)"
endif
ifeq (,$(BUILD_TOOL))
ifeq (Ninja,$(BUILD_TYPE))
ifneq ($(shell cmake --help 2>/dev/null | grep Ninja),)

View File

@ -2,7 +2,7 @@
# Individual entries must be uncommented to take effect.
# By default, the installation prefix is '/usr/local'.
# CMAKE_EXTRA_FLAGS += -DCMAKE_INSTALL_PREFIX=/usr/local/nvim-latest
# PREFIX := /usr/local/nvim-latest
# These CFLAGS can be used in addition to those specified in CMakeLists.txt:
# CMAKE_EXTRA_FLAGS="-DCMAKE_C_FLAGS=-ftrapv -Wlogical-op"