2014-06-14 10:39:20 -05:00
|
|
|
filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1))
|
|
|
|
filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
|
|
|
|
|
2015-03-07 18:49:16 -06:00
|
|
|
# See contrib/local.mk.example
|
2014-02-25 08:55:36 -06:00
|
|
|
-include local.mk
|
|
|
|
|
2014-05-31 07:13:49 -05:00
|
|
|
CMAKE_BUILD_TYPE ?= Debug
|
|
|
|
|
|
|
|
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
|
2014-03-03 09:09:06 -06:00
|
|
|
|
|
|
|
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
|
|
|
|
echo "Unix Makefiles")
|
|
|
|
|
|
|
|
ifeq (,$(BUILD_TOOL))
|
|
|
|
ifeq (Ninja,$(BUILD_TYPE))
|
2014-06-15 01:34:28 -05:00
|
|
|
ifneq ($(shell cmake --help 2>/dev/null | grep Ninja),)
|
|
|
|
BUILD_TOOL := ninja
|
|
|
|
else
|
|
|
|
# User's version of CMake doesn't support Ninja
|
2014-03-03 09:09:06 -06:00
|
|
|
BUILD_TOOL = $(MAKE)
|
2014-06-15 01:34:28 -05:00
|
|
|
BUILD_TYPE := Unix Makefiles
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
BUILD_TOOL = $(MAKE)
|
2014-03-03 09:09:06 -06:00
|
|
|
endif
|
|
|
|
endif
|
2014-01-31 07:39:15 -06:00
|
|
|
|
2014-04-23 03:59:25 -05:00
|
|
|
ifneq ($(VERBOSE),)
|
2014-06-15 01:34:28 -05:00
|
|
|
# Only need to handle Ninja here. Make will inherit the VERBOSE variable.
|
|
|
|
ifeq ($(BUILD_TYPE),Ninja)
|
|
|
|
VERBOSE_FLAG := -v
|
|
|
|
endif
|
2014-04-23 03:59:25 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
BUILD_CMD = $(BUILD_TOOL) $(VERBOSE_FLAG)
|
|
|
|
|
2014-02-24 18:22:48 -06:00
|
|
|
# Extra CMake flags which extend the default set
|
2014-03-03 09:09:06 -06:00
|
|
|
CMAKE_EXTRA_FLAGS ?=
|
|
|
|
DEPS_CMAKE_FLAGS ?=
|
2014-06-14 10:39:20 -05:00
|
|
|
USE_BUNDLED_DEPS ?=
|
|
|
|
|
|
|
|
ifneq (,$(USE_BUNDLED_DEPS))
|
2014-06-15 01:34:28 -05:00
|
|
|
BUNDLED_CMAKE_FLAG := -DUSE_BUNDLED=$(USE_BUNDLED_DEPS)
|
2014-06-14 10:39:20 -05:00
|
|
|
endif
|
2014-02-24 18:22:48 -06:00
|
|
|
|
2014-06-14 10:42:50 -05:00
|
|
|
# For use where we want to make sure only a single job is run. This does issue
|
|
|
|
# a warning, but we need to keep SCRIPTS argument.
|
2014-02-28 20:32:25 -06:00
|
|
|
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
|
|
|
|
|
2014-03-03 09:09:06 -06:00
|
|
|
all: nvim
|
2014-01-31 07:39:15 -06:00
|
|
|
|
2014-03-03 09:09:06 -06:00
|
|
|
nvim: build/.ran-cmake deps
|
2014-04-23 03:59:25 -05:00
|
|
|
+$(BUILD_CMD) -C build
|
2014-02-01 08:27:24 -06:00
|
|
|
|
2014-11-30 20:22:46 -06:00
|
|
|
libnvim: build/.ran-cmake deps
|
|
|
|
+$(BUILD_CMD) -C build libnvim
|
|
|
|
|
2014-03-31 03:41:26 -05:00
|
|
|
cmake:
|
|
|
|
touch CMakeLists.txt
|
|
|
|
$(MAKE) build/.ran-cmake
|
2014-02-27 13:57:06 -06:00
|
|
|
|
2014-03-03 09:09:06 -06:00
|
|
|
build/.ran-cmake: | deps
|
|
|
|
cd build && cmake -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) ..
|
|
|
|
touch $@
|
2014-02-01 08:20:02 -06:00
|
|
|
|
2014-06-14 10:39:20 -05:00
|
|
|
deps: | build/.ran-third-party-cmake
|
|
|
|
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
|
2014-12-01 09:59:55 -06:00
|
|
|
+$(BUILD_CMD) -C .deps
|
2014-06-14 10:39:20 -05:00
|
|
|
endif
|
2014-02-01 08:20:02 -06:00
|
|
|
|
2014-06-14 10:39:20 -05:00
|
|
|
build/.ran-third-party-cmake:
|
|
|
|
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
|
2014-12-01 09:59:55 -06:00
|
|
|
mkdir -p .deps
|
|
|
|
cd .deps && \
|
2014-06-14 10:39:20 -05:00
|
|
|
cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) \
|
2014-12-01 09:59:55 -06:00
|
|
|
$(DEPS_CMAKE_FLAGS) ../third-party
|
2014-06-14 10:39:20 -05:00
|
|
|
endif
|
|
|
|
mkdir -p build
|
2014-03-03 09:09:06 -06:00
|
|
|
touch $@
|
2014-02-27 13:57:06 -06:00
|
|
|
|
2014-09-29 07:43:52 -05:00
|
|
|
oldtest: | nvim
|
2014-06-14 10:42:50 -05:00
|
|
|
+$(SINGLE_MAKE) -C src/nvim/testdir $(MAKEOVERRIDES)
|
2014-09-29 07:43:52 -05:00
|
|
|
|
2014-11-05 04:54:20 -06:00
|
|
|
functionaltest: | nvim
|
|
|
|
+$(BUILD_CMD) -C build functionaltest
|
|
|
|
|
|
|
|
test: functionaltest
|
2014-02-27 13:57:06 -06:00
|
|
|
|
2014-03-03 09:09:06 -06:00
|
|
|
unittest: | nvim
|
2014-04-23 03:59:25 -05:00
|
|
|
+$(BUILD_CMD) -C build unittest
|
2014-01-31 07:39:15 -06:00
|
|
|
|
2015-03-28 16:28:37 -05:00
|
|
|
benchmark: | nvim
|
|
|
|
+$(BUILD_CMD) -C build benchmark
|
|
|
|
|
2014-02-01 08:20:02 -06:00
|
|
|
clean:
|
2014-04-23 03:59:25 -05:00
|
|
|
+test -d build && $(BUILD_CMD) -C build clean || true
|
2014-05-12 08:50:37 -05:00
|
|
|
$(MAKE) -C src/nvim/testdir clean
|
2014-02-01 08:20:02 -06:00
|
|
|
|
2014-03-03 09:09:06 -06:00
|
|
|
distclean: clean
|
|
|
|
rm -rf .deps build
|
2014-02-24 18:04:51 -06:00
|
|
|
|
2014-03-03 09:09:06 -06:00
|
|
|
install: | nvim
|
2014-04-23 03:59:25 -05:00
|
|
|
+$(BUILD_CMD) -C build install
|
2014-02-01 08:27:24 -06:00
|
|
|
|
2014-12-12 19:20:34 -06:00
|
|
|
lint:
|
|
|
|
cmake -DLINT_PRG=./clint.py \
|
|
|
|
-DLINT_DIR=src \
|
|
|
|
-DLINT_IGNORE_FILE=clint-ignored-files.txt \
|
|
|
|
-P cmake/RunLint.cmake
|
|
|
|
|
|
|
|
.PHONY: test functionaltest unittest lint clean distclean nvim libnvim cmake deps install
|