aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile144
1 files changed, 25 insertions, 119 deletions
diff --git a/Makefile b/Makefile
index 3781d06a6c..c44be8f8c7 100644
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,7 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
all: nvim
-CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake))
-CMAKE_BUILD_TYPE ?= Debug
+CMAKE ?= $(shell (command -v cmake3 || echo cmake))
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
# Extra CMake flags which extend the default set
CMAKE_EXTRA_FLAGS ?=
@@ -28,7 +27,7 @@ override CMAKE_EXTRA_FLAGS += -DCMAKE_INSTALL_PREFIX=$(CMAKE_INSTALL_PREFIX)
checkprefix:
@if [ -f build/.ran-cmake ]; then \
- cached_prefix=$(shell $(CMAKE_PRG) -L -N build | 2>/dev/null grep 'CMAKE_INSTALL_PREFIX' | cut -d '=' -f2); \
+ cached_prefix=$(shell $(CMAKE) -L -N build | 2>/dev/null grep 'CMAKE_INSTALL_PREFIX' | cut -d '=' -f2); \
if ! [ "$(CMAKE_INSTALL_PREFIX)" = "$$cached_prefix" ]; then \
printf "Re-running CMake: CMAKE_INSTALL_PREFIX '$(CMAKE_INSTALL_PREFIX)' does not match cached value '%s'.\n" "$$cached_prefix"; \
$(RM) build/.ran-cmake; \
@@ -53,17 +52,6 @@ ifeq (,$(BUILD_TOOL))
endif
endif
-# Only need to handle Ninja here. Make will inherit the VERBOSE variable, and the -j, -l, and -n flags.
-ifeq ($(CMAKE_GENERATOR),Ninja)
- ifneq ($(VERBOSE),)
- BUILD_TOOL += -v
- endif
- BUILD_TOOL += $(shell printf '%s' '$(MAKEFLAGS)' | grep -o -- ' *-[jl][0-9]\+ *')
- ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS))))
- BUILD_TOOL += -n
- endif
-endif
-
DEPS_CMAKE_FLAGS ?=
USE_BUNDLED ?=
@@ -81,155 +69,73 @@ endif
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
nvim: build/.ran-cmake deps
- +$(BUILD_TOOL) -C build
+ $(BUILD_TOOL) -C build
libnvim: build/.ran-cmake deps
- +$(BUILD_TOOL) -C build libnvim
+ $(BUILD_TOOL) -C build libnvim
cmake:
touch CMakeLists.txt
$(MAKE) build/.ran-cmake
build/.ran-cmake: | deps
- cd build && $(CMAKE_PRG) -G '$(CMAKE_GENERATOR)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR)
+ $(CMAKE) -B build -G '$(CMAKE_GENERATOR)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR)
touch $@
deps: | build/.ran-deps-cmake
ifeq ($(call filter-true,$(USE_BUNDLED)),)
- +$(BUILD_TOOL) -C $(DEPS_BUILD_DIR)
+ $(BUILD_TOOL) -C $(DEPS_BUILD_DIR)
endif
ifeq ($(call filter-true,$(USE_BUNDLED)),)
$(DEPS_BUILD_DIR):
mkdir -p "$@"
build/.ran-deps-cmake:: $(DEPS_BUILD_DIR)
- cd $(DEPS_BUILD_DIR) && \
- $(CMAKE_PRG) -G '$(CMAKE_GENERATOR)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
- $(DEPS_CMAKE_FLAGS) $(MAKEFILE_DIR)/cmake.deps
+ $(CMAKE) -S $(MAKEFILE_DIR)/cmake.deps -B $(DEPS_BUILD_DIR) -G '$(CMAKE_GENERATOR)' \
+ $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) $(DEPS_CMAKE_FLAGS)
endif
build/.ran-deps-cmake::
mkdir -p build
touch $@
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
-oldtest: | nvim build/runtime/doc/tags
- +$(SINGLE_MAKE) -C test/old/testdir clean
+oldtest: | nvim
+ $(SINGLE_MAKE) -C test/old/testdir clean
ifeq ($(strip $(TEST_FILE)),)
- +$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) $(MAKEOVERRIDES)
+ $(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) $(MAKEOVERRIDES)
else
@# Handle TEST_FILE=test_foo{,.res,.vim}.
- +$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE)))
+ $(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE)))
endif
# Build oldtest by specifying the relative .vim filename.
.PHONY: phony_force
test/old/testdir/%.vim: phony_force nvim
- +$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst test/old/testdir/%.vim,%,$@)
+ $(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst test/old/testdir/%.vim,%,$@)
functionaltest-lua: | nvim
$(BUILD_TOOL) -C build functionaltest
FORMAT=formatc formatlua format
-LINT=lintlua lintsh lintc clang-analyzer lintcommit lint
+LINT=lintlua lintsh lintc clang-analyzer lintcommit lintdoc lint
TEST=functionaltest unittest
generated-sources benchmark $(FORMAT) $(LINT) $(TEST) doc: | build/.ran-cmake
- $(CMAKE_PRG) --build build --target $@
+ $(CMAKE) --build build --target $@
test: $(TEST)
-# The ignored header files should be synced with the `check_includes_ignore`
-# array in src/clint.py
iwyu: build/.ran-cmake
- cmake --preset iwyu
- cmake --build build > build/iwyu.log
- iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c|src/nvim/auto/|src/nvim/os/lang.c|src/nvim/map.c\
- |src/nvim/api/extmark.h\
- |src/nvim/api/private/dispatch.h\
- |src/nvim/api/private/helpers.h\
- |src/nvim/api/private/validate.h\
- |src/nvim/api/ui.h\
- |src/nvim/ascii_defs.h\
- |src/nvim/assert_defs.h\
- |src/nvim/autocmd.h\
- |src/nvim/autocmd_defs.h\
- |src/nvim/buffer.h\
- |src/nvim/buffer_defs.h\
- |src/nvim/channel.h\
- |src/nvim/charset.h\
- |src/nvim/cmdexpand.h\
- |src/nvim/cmdhist.h\
- |src/nvim/decoration.h\
- |src/nvim/diff.h\
- |src/nvim/drawline.h\
- |src/nvim/drawscreen.h\
- |src/nvim/eval.h\
- |src/nvim/eval/encode.h\
- |src/nvim/eval/typval.h\
- |src/nvim/eval/typval_defs.h\
- |src/nvim/eval/userfunc.h\
- |src/nvim/eval/window.h\
- |src/nvim/event/libuv_process.h\
- |src/nvim/event/loop.h\
- |src/nvim/event/multiqueue.h\
- |src/nvim/event/process.h\
- |src/nvim/event/rstream.h\
- |src/nvim/event/signal.h\
- |src/nvim/event/socket.h\
- |src/nvim/event/stream.h\
- |src/nvim/event/time.h\
- |src/nvim/event/wstream.h\
- |src/nvim/ex_cmds.h\
- |src/nvim/ex_cmds_defs.h\
- |src/nvim/ex_docmd.h\
- |src/nvim/extmark.h\
- |src/nvim/file_search.h\
- |src/nvim/fileio.h\
- |src/nvim/fold.h\
- |src/nvim/garray.h\
- |src/nvim/getchar.h\
- |src/nvim/globals.h\
- |src/nvim/grid.h\
- |src/nvim/highlight.h\
- |src/nvim/highlight_group.h\
- |src/nvim/input.h\
- |src/nvim/insexpand.h\
- |src/nvim/keycodes.h\
- |src/nvim/log.h\
- |src/nvim/lua/executor.h\
- |src/nvim/main.h\
- |src/nvim/mark.h\
- |src/nvim/mouse.h\
- |src/nvim/move.h\
- |src/nvim/msgpack_rpc/channel.h\
- |src/nvim/msgpack_rpc/channel_defs.h\
- |src/nvim/msgpack_rpc/helpers.h\
- |src/nvim/msgpack_rpc/unpacker.h\
- |src/nvim/option.h\
- |src/nvim/os/fileio.h\
- |src/nvim/os/input.h\
- |src/nvim/os/pty_conpty_win.h\
- |src/nvim/os/pty_process_unix.h\
- |src/nvim/os/pty_process_win.h\
- |src/nvim/path.h\
- |src/nvim/plines.h\
- |src/nvim/popupmenu.h\
- |src/nvim/search.h\
- |src/nvim/spell.h\
- |src/nvim/syntax.h\
- |src/nvim/textobject.h\
- |src/nvim/tui/input.h\
- |src/nvim/tui/tui.h\
- |src/nvim/ui.h\
- |src/nvim/ui_client.h\
- |src/nvim/ui_compositor.h\
- |src/nvim/viml/parser/expressions.h\
- |src/nvim/viml/parser/parser.h\
- |src/nvim/window.h\
+ $(CMAKE) --preset iwyu
+ $(CMAKE) --build build > build/iwyu.log
+ iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c\
+ |src/nvim/auto/\
+ |src/nvim/os/lang.c\
+ |src/nvim/map.c\
)" --nosafe_headers < build/iwyu.log
- cmake -B build -U ENABLE_IWYU
- cmake --build build
+ $(CMAKE) -B build -U ENABLE_IWYU
+ $(CMAKE) --build build
clean:
- +test -d build && $(BUILD_TOOL) -C build clean || true
+ test -d build && $(BUILD_TOOL) -C build clean || true
$(MAKE) -C test/old/testdir clean
$(MAKE) -C runtime/indent clean
@@ -238,7 +144,7 @@ distclean:
$(MAKE) clean
install: checkprefix nvim
- +$(BUILD_TOOL) -C build install
+ $(BUILD_TOOL) -C build install
appimage:
bash scripts/genappimage.sh