Makefile (1756B)
1 # -*- Makefile -*- 2 3 TEXI_CHAPTER := EditorConfig Emacs Plugin 4 5 EMACS = emacs 6 PANDOC = pandoc 7 AWK = awk 8 9 PROJECT_ROOT_DIR = $(CURDIR) 10 ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el) 11 12 # Compile with noninteractive and relatively clean environment. 13 BATCHFLAGS = -batch -q --no-site-file -L $(PROJECT_ROOT_DIR) 14 15 MAIN_SRC = editorconfig.el 16 SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el) 17 OBJS = $(SRCS:.el=.elc) 18 19 .PHONY: check \ 20 compile clean \ 21 test test-ert test-core \ 22 sandbox doc 23 24 check: compile test 25 26 27 compile: $(OBJS) 28 29 $(OBJS): %.elc: %.el 30 $(EMACS) $(BATCHFLAGS) -f batch-byte-compile $^ 31 32 clean: 33 -rm -f $(OBJS) 34 35 36 doc: doc/editorconfig.texi 37 38 doc/editorconfig.texi: README.md doc/header.txt 39 mkdir -p doc 40 tail -n +4 $< | $(PANDOC) -s -f markdown -t texinfo -o $@.body 41 $(AWK) 'f{print} /^@chapter $(TEXI_CHAPTER)/{f=1;print}' $@.body >$@.body2 42 cat doc/header.txt $@.body2 >$@ 43 rm -f $@.body $@.body2 44 45 test: test-ert test-core 46 $(EMACS) $(BATCHFLAGS) -l editorconfig.el 47 48 49 # ert test 50 test-ert: $(ERT_TESTS) $(OBJS) 51 $(EMACS) $(BATCHFLAGS) \ 52 --eval "(setq debug-on-error t)" \ 53 --eval "(require 'ert)" \ 54 --eval "(setq metadata-el-files '($(MAIN_SRC:%=\"%\")))" \ 55 $(ERT_TESTS:%=-l "%") \ 56 -f ert-run-tests-batch-and-exit 57 58 59 60 # Core test 61 core-test/CMakeLists.txt: 62 git submodule init 63 64 test-core: core-test/CMakeLists.txt $(OBJS) 65 cd $(PROJECT_ROOT_DIR)/core-test && \ 66 cmake -DEDITORCONFIG_CMD="$(PROJECT_ROOT_DIR)/bin/editorconfig-el" . 67 cd $(PROJECT_ROOT_DIR)/core-test && \ 68 EMACS_BIN=$(EMACS) EDITORCONFIG_CORE_LIBRARY_PATH="$(PROJECT_ROOT_DIR)" \ 69 ctest --output-on-failure . 70 71 72 # Start Emacs that loads *.el in current directory and does not load the user 73 # init file 74 sandbox: 75 $(EMACS) -q -L $(PROJECT_ROOT_DIR) $(MAIN_SRC:%=-l "%")