2014-06-14 08:39:20 -07:00
|
|
|
filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1))
|
|
|
|
filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
|
|
|
|
|
2014-02-25 07:55:36 -07:00
|
|
|
-include local.mk
|
|
|
|
|
2014-05-31 05:13:49 -07:00
|
|
|
CMAKE_BUILD_TYPE ?= Debug
|
|
|
|
|
|
|
|
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
|
2014-03-03 08:09:06 -07:00
|
|
|
|
|
|
|
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
|
|
|
|
echo "Unix Makefiles")
|
|
|
|
|
|
|
|
ifeq (,$(BUILD_TOOL))
|
|
|
|
ifeq (Ninja,$(BUILD_TYPE))
|
2014-06-14 23:34:28 -07: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 08:09:06 -07:00
|
|
|
BUILD_TOOL = $(MAKE)
|
2014-06-14 23:34:28 -07:00
|
|
|
BUILD_TYPE := Unix Makefiles
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
BUILD_TOOL = $(MAKE)
|
2014-03-03 08:09:06 -07:00
|
|
|
endif
|
|
|
|
endif
|
2014-01-31 06:39:15 -07:00
|
|
|
|
2014-04-23 01:59:25 -07:00
|
|
|
ifneq ($(VERBOSE),)
|
2014-06-14 23:34:28 -07:00
|
|
|
# Only need to handle Ninja here. Make will inherit the VERBOSE variable.
|
|
|
|
ifeq ($(BUILD_TYPE),Ninja)
|
|
|
|
VERBOSE_FLAG := -v
|
|
|
|
endif
|
2014-04-23 01:59:25 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
BUILD_CMD = $(BUILD_TOOL) $(VERBOSE_FLAG)
|
|
|
|
|
2014-02-24 17:22:48 -07:00
|
|
|
# Extra CMake flags which extend the default set
|
2014-03-03 08:09:06 -07:00
|
|
|
CMAKE_EXTRA_FLAGS ?=
|
|
|
|
DEPS_CMAKE_FLAGS ?=
|
2014-06-14 08:39:20 -07:00
|
|
|
USE_BUNDLED_DEPS ?=
|
|
|
|
|
|
|
|
ifneq (,$(USE_BUNDLED_DEPS))
|
2014-06-14 23:34:28 -07:00
|
|
|
BUNDLED_CMAKE_FLAG := -DUSE_BUNDLED=$(USE_BUNDLED_DEPS)
|
2014-06-14 08:39:20 -07:00
|
|
|
endif
|
2014-02-24 17:22:48 -07:00
|
|
|
|
2014-06-14 08:42:50 -07: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 19:32:25 -07:00
|
|
|
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
|
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
all: nvim
|
2014-01-31 06:39:15 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
nvim: build/.ran-cmake deps
|
2014-04-23 01:59:25 -07:00
|
|
|
+$(BUILD_CMD) -C build
|
2014-02-01 07:27:24 -07:00
|
|
|
|
2014-11-30 19:22:46 -07:00
|
|
|
libnvim: build/.ran-cmake deps
|
|
|
|
+$(BUILD_CMD) -C build libnvim
|
|
|
|
|
2014-03-31 01:41:26 -07:00
|
|
|
cmake:
|
|
|
|
touch CMakeLists.txt
|
|
|
|
$(MAKE) build/.ran-cmake
|
2014-02-27 12:57:06 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
build/.ran-cmake: | deps
|
|
|
|
cd build && cmake -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) ..
|
|
|
|
touch $@
|
2014-02-01 07:20:02 -07:00
|
|
|
|
2014-06-14 08:39:20 -07:00
|
|
|
deps: | build/.ran-third-party-cmake
|
|
|
|
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
|
2014-12-01 08:59:55 -07:00
|
|
|
+$(BUILD_CMD) -C .deps
|
2014-06-14 08:39:20 -07:00
|
|
|
endif
|
2014-02-01 07:20:02 -07:00
|
|
|
|
2014-06-14 08:39:20 -07:00
|
|
|
build/.ran-third-party-cmake:
|
|
|
|
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
|
2014-12-01 08:59:55 -07:00
|
|
|
mkdir -p .deps
|
|
|
|
cd .deps && \
|
2014-06-14 08:39:20 -07:00
|
|
|
cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) \
|
2014-12-01 08:59:55 -07:00
|
|
|
$(DEPS_CMAKE_FLAGS) ../third-party
|
2014-06-14 08:39:20 -07:00
|
|
|
endif
|
|
|
|
mkdir -p build
|
2014-03-03 08:09:06 -07:00
|
|
|
touch $@
|
2014-02-27 12:57:06 -07:00
|
|
|
|
2014-09-29 05:43:52 -07:00
|
|
|
oldtest: | nvim
|
2014-06-14 08:42:50 -07:00
|
|
|
+$(SINGLE_MAKE) -C src/nvim/testdir $(MAKEOVERRIDES)
|
2014-09-29 05:43:52 -07:00
|
|
|
|
2014-11-05 03:54:20 -07:00
|
|
|
functionaltest: | nvim
|
|
|
|
+$(BUILD_CMD) -C build functionaltest
|
|
|
|
|
|
|
|
test: functionaltest
|
2014-02-27 12:57:06 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
unittest: | nvim
|
2014-04-23 01:59:25 -07:00
|
|
|
+$(BUILD_CMD) -C build unittest
|
2014-01-31 06:39:15 -07:00
|
|
|
|
2014-02-01 07:20:02 -07:00
|
|
|
clean:
|
2014-04-23 01:59:25 -07:00
|
|
|
+test -d build && $(BUILD_CMD) -C build clean || true
|
2014-05-12 06:50:37 -07:00
|
|
|
$(MAKE) -C src/nvim/testdir clean
|
2014-02-01 07:20:02 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
distclean: clean
|
|
|
|
rm -rf .deps build
|
2014-02-24 17:04:51 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
install: | nvim
|
2014-04-23 01:59:25 -07:00
|
|
|
+$(BUILD_CMD) -C build install
|
2014-02-01 07:27:24 -07:00
|
|
|
|
2014-12-12 18:20:34 -07: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
|