Commit | Line | Data |
---|---|---|
bbece175 GM |
1 | ### @configure_input@ |
2 | ||
ba318903 | 3 | # Copyright (C) 2010-2014 Free Software Foundation, Inc. |
d221e780 CO |
4 | |
5 | # This file is part of GNU Emacs. | |
6 | ||
7 | # GNU Emacs is free software: you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation, either version 3 of the License, or | |
10 | # (at your option) any later version. | |
11 | ||
12 | # GNU Emacs is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | ||
17 | # You should have received a copy of the GNU General Public License | |
18 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
50b13cde | 20 | SHELL = @SHELL@ |
d221e780 CO |
21 | |
22 | srcdir = @srcdir@ | |
d221e780 | 23 | VPATH = $(srcdir) |
d221e780 | 24 | |
0845be75 | 25 | SEPCHAR = @SEPCHAR@ |
2df10228 | 26 | |
67fb4e6a GM |
27 | # We never change directory before running Emacs, so a relative file |
28 | # name is fine, and makes life easier. If we need to change | |
29 | # directory, we can use emacs --chdir. | |
30 | EMACS = ../../src/emacs | |
d221e780 CO |
31 | |
32 | # Command line flags for Emacs. | |
2df10228 GM |
33 | # Apparently MSYS bash would convert "-L :" to "-L ;" anyway, |
34 | # but we might as well be explicit. | |
0845be75 | 35 | EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" |
d221e780 | 36 | |
e088b01d | 37 | # Prevent any settings in the user environment causing problems. |
5a8816f3 | 38 | unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS |
e088b01d | 39 | |
d221e780 | 40 | # The actual Emacs command run in the targets below. |
8b77446f | 41 | # Prevent any setting of EMACSLOADPATH in user environment causing problems. |
17e0445b | 42 | emacs = EMACSLOADPATH= LC_ALL=C EMACS_TEST_DIRECTORY=$(srcdir) "$(EMACS)" $(EMACSOPT) |
d221e780 | 43 | |
67bb589e | 44 | .PHONY: all check |
d221e780 | 45 | |
67bb589e | 46 | all: check |
d221e780 | 47 | |
5a8816f3 | 48 | %.elc: %.el |
d221e780 | 49 | @echo Compiling $< |
5a8816f3 GM |
50 | @$(emacs) -f batch-byte-compile $< |
51 | ||
52 | ## Ignore any test errors so we can continue to test other files. | |
53 | ## (It would be nice if we could get an error when running an | |
54 | ## individual test, but not when running check.) | |
55 | ## But compilation errors are always fatal. | |
56 | ## | |
57 | ## I'd prefer to use -emacs -f ert-run-tests-batch-and-exit rather | |
58 | ## than || true, since the former makes problems more obvious. | |
59 | ## I'd also prefer to @-hide the grep part and not the | |
60 | ## ert-run-tests-batch-and-exit part. | |
61 | ## | |
62 | ## We need to use $loadfile because: | |
63 | ## i) -L :$srcdir -l basename does not work, because we have files whose | |
64 | ## basename duplicates a file in lisp/ (eg eshell.el). | |
65 | ## ii) Although -l basename will automatically load .el or .elc, | |
66 | ## -l ./basename treats basename as a literal file (it would be nice | |
67 | ## to change this). | |
68 | ## | |
69 | ## Beware: it approximates `no-byte-compile', so watch out for false-positives! | |
70 | %.log: ${srcdir}/%.el | |
71 | @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \ | |
72 | loadfile=$<; \ | |
73 | else \ | |
74 | loadfile=$<c; \ | |
75 | ${MAKE} $$loadfile; \ | |
76 | fi; \ | |
77 | echo Testing $$loadfile; \ | |
78 | stat=OK ; \ | |
79 | $(emacs) -l ert -l $$loadfile \ | |
d9ca41e7 GM |
80 | -f ert-run-tests-batch-and-exit >& $@ || { \ |
81 | stat=ERROR; \ | |
82 | cat $@; }; \ | |
5a8816f3 GM |
83 | echo $$stat: $@ |
84 | ||
85 | ELFILES = $(wildcard ${srcdir}/*.el) | |
86 | LOGFILES = $(patsubst %.el,%.log,$(notdir ${ELFILES})) | |
87 | ||
88 | ## If we have to interrupt a hanging test, preserve the log so we can | |
89 | ## see what the problem was. | |
90 | .PRECIOUS: %.log | |
91 | ||
92 | check: ${LOGFILES} | |
93 | $(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^ | |
94 | ||
95 | .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean | |
96 | ||
97 | clean mostlyclean: | |
98 | -rm -f *.log | |
99 | ||
100 | bootstrap-clean: clean | |
101 | -rm -f ${srcdir}/*.elc | |
102 | ||
103 | distclean: clean | |
1f43ed41 | 104 | rm -f Makefile |
d221e780 CO |
105 | |
106 | maintainer-clean: distclean bootstrap-clean | |
107 | ||
d221e780 | 108 | # Makefile ends here. |