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
|
# -*- Makefile -*-
TEXI_CHAPTER := EditorConfig Emacs Plugin
EMACS = emacs
EASK = eask
PANDOC = pandoc
AWK = awk
PROJECT_ROOT_DIR = $(CURDIR)
ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el)
# Compile with noninteractive and relatively clean environment.
BATCHFLAGS = -batch -q --no-site-file -L $(PROJECT_ROOT_DIR)
MAIN_SRC = editorconfig.el
SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el)
OBJS = $(SRCS:.el=.elc)
.PHONY: check-unix check-dos \
compile clean \
test test-ert test-core \
sandbox doc
# CI entry
check-unix: package install compile test
check-dos: package install compile test-ert
package:
$(EASK) package
install:
$(EASK) install
compile:
$(EASK) compile
clean:
$(EASK) clean elc
doc: doc/editorconfig.texi
doc/editorconfig.texi: README.md doc/header.txt
mkdir -p doc
tail -n +4 $< | $(PANDOC) -s -f markdown -t texinfo -o $@.body
$(AWK) 'f{print} /^@chapter $(TEXI_CHAPTER)/{f=1;print}' $@.body >$@.body2
cat doc/header.txt $@.body2 >$@
rm -f $@.body $@.body2
test: test-ert test-core
$(EMACS) $(BATCHFLAGS) -l editorconfig.el
# ert test
test-ert: $(ERT_TESTS) $(OBJS)
$(EMACS) $(BATCHFLAGS) \
--eval "(setq debug-on-error t)" \
--eval "(require 'ert)" \
--eval "(setq metadata-el-files '($(MAIN_SRC:%=\"%\")))" \
$(ERT_TESTS:%=-l "%") \
-f ert-run-tests-batch-and-exit
# Core test
core-test/CMakeLists.txt:
true
test-core: core-test/CMakeLists.txt $(OBJS)
cd $(PROJECT_ROOT_DIR)/core-test && \
cmake -DEDITORCONFIG_CMD="$(PROJECT_ROOT_DIR)/bin/editorconfig-el" .
cd $(PROJECT_ROOT_DIR)/core-test && \
EMACS_BIN=$(EMACS) EDITORCONFIG_CORE_LIBRARY_PATH="$(PROJECT_ROOT_DIR)" \
ctest --output-on-failure .
# Start Emacs that loads *.el in current directory and does not load the user
# init file
sandbox:
$(EMACS) -q -L $(PROJECT_ROOT_DIR) $(MAIN_SRC:%=-l "%")
|