mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
0b2f6a0cf4
This achieves several goals: * Less reliance on scripts so we have better portability to Windows (though we still have a ways to go for proper Windows support). Luajit, luarocks, moonscript, and busted are all installed via CMake now. * Trying to make use of pkg-config to get the correct libraries. The latest libuv is still broken in this regard, but we'll at least be in a position to use it. * Allow the use of Ninja or make. The former runs faster in many environments, and automatically makes use of parallel builds. This also allows for system installed dependencies--though not through the Makefile just yet--and adds support for FreeBSD. This also make us build libuv and luajit as static libraries only, since we're only concerned about having static libraries for our bundled dependencies.
68 lines
1.6 KiB
Makefile
68 lines
1.6 KiB
Makefile
-include local.mk
|
|
|
|
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=.deps/usr
|
|
|
|
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
|
|
|
|
# Extra CMake flags which extend the default set
|
|
CMAKE_EXTRA_FLAGS ?=
|
|
DEPS_CMAKE_FLAGS ?=
|
|
|
|
# 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)
|
|
|
|
all: nvim
|
|
|
|
nvim: build/.ran-cmake deps
|
|
+$(BUILD_TOOL) -C build
|
|
|
|
cmake: | build/.ran-cmake
|
|
|
|
build/.ran-cmake: | deps
|
|
mkdir -p build
|
|
cd build && cmake -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) ..
|
|
touch $@
|
|
|
|
deps: | .deps/build/third-party/.ran-cmake
|
|
+$(BUILD_TOOL) -C .deps/build/third-party
|
|
|
|
.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 $@
|
|
|
|
test: | nvim
|
|
+$(SINGLE_MAKE) -C src/testdir
|
|
|
|
unittest: | nvim
|
|
+$(BUILD_TOOL) -C build unittest
|
|
|
|
clean:
|
|
+test -d build && $(BUILD_TOOL) -C build clean || true
|
|
$(MAKE) -C src/testdir clean
|
|
|
|
distclean: clean
|
|
rm -rf .deps build
|
|
|
|
install: | nvim
|
|
+$(BUILD_TOOL) -C build install
|
|
|
|
.PHONY: test unittest clean distclean nvim cmake deps install
|