forked from neovim/neovim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
146 lines (110 loc) · 3.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1))
filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
# See contrib/local.mk.example
-include local.mk
CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake))
CMAKE_BUILD_TYPE ?= Debug
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
DOC_DOWNLOAD_URL_BASE := https://raw.githubusercontent.com/neovim/doc/gh-pages
CLINT_ERRORS_FILE_PATH := /reports/clint/errors.json
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
echo "Unix Makefiles")
ifeq (,$(BUILD_TOOL))
ifeq (Ninja,$(BUILD_TYPE))
ifneq ($(shell $(CMAKE_PRG) --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
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)
# Extra CMake flags which extend the default set
CMAKE_EXTRA_FLAGS ?=
DEPS_CMAKE_FLAGS ?=
USE_BUNDLED_DEPS ?=
ifneq (,$(USE_BUNDLED_DEPS))
BUNDLED_CMAKE_FLAG := -DUSE_BUNDLED=$(USE_BUNDLED_DEPS)
endif
ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS)))
BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON
$(shell [ -x .deps/usr/bin/lua ] || rm build/.ran-*)
endif
# 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.
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
all: nvim
nvim: build/.ran-cmake deps
+$(BUILD_CMD) -C build
libnvim: build/.ran-cmake deps
+$(BUILD_CMD) -C build libnvim
cmake:
touch CMakeLists.txt
$(MAKE) build/.ran-cmake
build/.ran-cmake: | deps
cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) ..
touch $@
deps: | build/.ran-third-party-cmake
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
+$(BUILD_CMD) -C .deps
endif
build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
mkdir -p .deps
cd .deps && \
$(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) ../third-party
endif
mkdir -p build
touch $@
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
oldtest: | nvim helptags
+$(SINGLE_MAKE) -C src/nvim/testdir clean
ifeq ($(strip $(TEST_FILE)),)
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES)
else
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES)
endif
helptags: | nvim
+$(BUILD_CMD) -C build helptags
functionaltest: | nvim
+$(BUILD_CMD) -C build functionaltest
functionaltest-lua: | nvim
+$(BUILD_CMD) -C build functionaltest-lua
testlint: | build/.ran-cmake deps
$(BUILD_CMD) -C build testlint
lualint: | build/.ran-cmake deps
$(BUILD_CMD) -C build lualint
unittest: | nvim
+$(BUILD_CMD) -C build unittest
benchmark: | nvim
+$(BUILD_CMD) -C build benchmark
test: functionaltest unittest
clean:
+test -d build && $(BUILD_CMD) -C build clean || true
$(MAKE) -C src/nvim/testdir clean
$(MAKE) -C runtime/doc clean
distclean: clean
rm -rf .deps build
install: | nvim
+$(BUILD_CMD) -C build install
clint: build/.ran-cmake
+$(BUILD_CMD) -C build clint
clint-full: build/.ran-cmake
+$(BUILD_CMD) -C build clint-full
check-single-includes: build/.ran-cmake
+$(BUILD_CMD) -C build check-single-includes
appimage:
bash scripts/genappimage.sh
lint: check-single-includes clint testlint lualint
.PHONY: test testlint lualint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage