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