blob: 22146e7f9b8119976c8add087f8ddeb92199d7cc (
plain)
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
|
# -*- Makefile -*-
TEXI_CHAPTER := EditorConfig Emacs Plugin
EMACS = emacs
PANDOC = pandoc
AWK = awk
PROJECT_ROOT_DIR = $(CURDIR)
ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el)
TRAVIS_FILE = .travis.yml
# Compile with noninteractive and relatively clean environment.
BATCHFLAGS = -batch -q --no-site-file -L $(PROJECT_ROOT_DIR)
MAIN_SRC = editorconfig.el
SRCS = editorconfig.el editorconfig-core.el editorconfig-core-handle.el \
editorconfig-fnmatch.el
OBJS = $(SRCS:.el=.elc)
$(OBJS): %.elc: %.el
$(EMACS) $(BATCHFLAGS) -f batch-byte-compile $^
.PHONY: all clean test test-travis test-ert test-core test-metadata sandbox doc info
all: $(OBJS)
clean:
-rm -f $(OBJS)
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 test-metadata $(OBJS)
$(EMACS) $(BATCHFLAGS) -l editorconfig.el
test-travis:
@if test -z "$$TRAVIS" && test -e $(TRAVIS_FILE); then travis-lint $(TRAVIS_FILE); fi
# 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 "%")
|