File: Makefile

package info (click to toggle)
auctex 13.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,440 kB
  • sloc: lisp: 53,963; makefile: 835; sh: 112; perl: 91
file content (95 lines) | stat: -rw-r--r-- 2,649 bytes parent folder | download | duplicates (2)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Copyright (C) 2010-2014, 2017 Free Software Foundation, Inc.

# This file is part of AUCTeX.

# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

### Commentary:

## Some targets:
## check: re-run all tests, writing to .log files.
## check-maybe: run all tests whose .log file needs updating
## filename.log: run tests from filename.el if .log file needs updating
## filename: re-run tests from filename.el, with no logging

## Adapted from test/Makefile.in of GNU Emacs.

### Code:

SHELL = /bin/sh

EMACS = emacs
# AUCTeX source directory.
SRCDIR = ".."

# Command line flags for Emacs.
EMACSOPT = -batch -L $(SRCDIR)

# Prevent any settings in the user environment causing problems.
unexport EMACSDATA EMACSDOC EMACSPATH

## To run tests under a debugger, set this to eg: "gdb --args".
GDB =

# The actual Emacs command run in the targets below.
# Prevent any setting of EMACSLOADPATH in user environment causing problems.
emacs = EMACSLOADPATH= LC_ALL=C $(GDB) "$(EMACS)" $(EMACSOPT)

.PHONY: all check

all: check

# In GNU Emacs there is a bashism here to direct output to file and to standard
# output at the same time.
WRITE_LOG = 2>&1 | tee $@

%.log: %.el
	$(emacs) -l ert -l make-test-deps.emacs-lisp -l $< \
	-f ert-run-tests-batch-and-exit ${WRITE_LOG}

ELFILES = $(wildcard */*.el)
LOGFILES = $(patsubst %.el,%.log, ${ELFILES})
TESTS = ${LOGFILES:.log=}

## If we have to interrupt a hanging test, preserve the log so we can
## see what the problem was.
.PRECIOUS: %.log

.PHONY: ${TESTS}

## The short aliases that always re-run the tests, with no logging.
define test_template
$(1):
	@test ! -f $(1).log || mv $(1).log $(1).log~
	@${MAKE} $(1).log WRITE_LOG=
endef

$(foreach test,${TESTS},$(eval $(call test_template,${test})))

## Re-run all the tests every time.
check: mostlyclean check-doit

.PHONY: check-doit
check-doit: ${LOGFILES}
	$(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^

.PHONY: mostlyclean clean

mostlyclean:
	-@for f in ${LOGFILES}; do test ! -f $$f || mv $$f $$f~; done

clean:
	-rm -f */*.log */*.log~

# Makefile ends here.