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))
|
|
|
|
ifneq ($(shell cmake --help 2>/dev/null | grep Ninja),)
|
|
|
|
BUILD_TOOL := ninja
|
|
|
|
else
|
|
|
|
# User's version of CMake doesn't support Ninja
|
|
|
|
BUILD_TOOL = $(MAKE)
|
|
|
|
BUILD_TYPE := Unix Makefiles
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
BUILD_TOOL = $(MAKE)
|
|
|
|
endif
|
|
|
|
endif
|
2014-01-31 06:39:15 -07:00
|
|
|
|
2014-04-23 01:59:25 -07:00
|
|
|
ifneq ($(VERBOSE),)
|
|
|
|
# Only need to handle Ninja here. Make will inherit the VERBOSE variable.
|
|
|
|
ifeq ($(BUILD_TYPE),Ninja)
|
|
|
|
VERBOSE_FLAG := -v
|
|
|
|
endif
|
|
|
|
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-02-24 17:22:48 -07:00
|
|
|
|
2014-02-28 19:32:25 -07:00
|
|
|
# For use where we want to make sure only a single job is run. This also avoids
|
|
|
|
# any warnings from the sub-make.
|
|
|
|
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-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
|
|
|
|
mkdir -p build
|
|
|
|
cd build && cmake -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) ..
|
|
|
|
touch $@
|
2014-02-01 07:20:02 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
deps: | .deps/build/third-party/.ran-cmake
|
2014-04-23 01:59:25 -07:00
|
|
|
+$(BUILD_CMD) -C .deps/build/third-party
|
2014-02-01 07:20:02 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
.deps/build/third-party/.ran-cmake:
|
|
|
|
mkdir -p .deps/build/third-party
|
|
|
|
cd .deps/build/third-party && \
|
|
|
|
cmake -G '$(BUILD_TYPE)' $(DEPS_CMAKE_FLAGS) ../../../third-party
|
|
|
|
touch $@
|
2014-02-27 12:57:06 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
test: | nvim
|
2014-05-12 06:50:37 -07:00
|
|
|
+$(SINGLE_MAKE) -C src/nvim/testdir
|
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-03-03 08:09:06 -07:00
|
|
|
.PHONY: test unittest clean distclean nvim cmake deps install
|