]> code.delx.au - gnu-emacs/blob - test/automated/Makefile.in
Get rid of --chdir usage in test/automated
[gnu-emacs] / test / automated / Makefile.in
1 ### @configure_input@
2
3 # Copyright (C) 2010-2013 Free Software Foundation, Inc.
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
20 SHELL = @SHELL@
21
22 srcdir = @srcdir@
23 VPATH = $(srcdir)
24
25 # We never change directory before running Emacs, so a relative file
26 # name is fine, and makes life easier. If we need to change
27 # directory, we can use emacs --chdir.
28 EMACS = ../../src/emacs
29
30 # Command line flags for Emacs.
31 EMACSOPT = -batch --no-site-file --no-site-lisp -L :$(srcdir)
32
33 # Extra flags to pass to the byte compiler.
34 BYTE_COMPILE_EXTRA_FLAGS =
35
36 # The actual Emacs command run in the targets below.
37 # Prevent any setting of EMACSLOADPATH in user environment causing problems.
38 emacs = unset EMACSLOADPATH; \
39 LC_ALL=C EMACS_TEST_DIRECTORY=$(srcdir) "$(EMACS)" $(EMACSOPT)
40
41 # Common command to find subdirectories
42 setwins=subdirs=`find $(srcdir) -type d -print`; \
43 for file in $$subdirs; do \
44 case $$file in */data* | */flymake* ) ;; \
45 *) wins="$$wins$${wins:+ }$$file" ;; \
46 esac; \
47 done
48
49 .PHONY: all check
50
51 all: check
52
53 # The compilation stuff is copied from lisp/Makefile - see comments there.
54
55 .SUFFIXES: .elc .el
56
57 .el.elc:
58 @echo Compiling $<
59 @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
60
61
62 .PHONY: compile-targets compile-main compile-clean
63
64 # TARGETS is set dynamically in the recursive call from `compile-main'.
65 compile-targets: $(TARGETS)
66
67 # Compile all the Elisp files that need it. Beware: it approximates
68 # `no-byte-compile', so watch out for false-positives!
69 compile-main: compile-clean
70 @$(setwins); \
71 els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
72 for el in $$els; do \
73 test -f $$el || continue; \
74 test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
75 echo "$${el}c"; \
76 done | xargs echo | \
77 while read chunk; do \
78 $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
79 done
80
81 # Erase left-over .elc files that do not have a corresponding .el file.
82 compile-clean:
83 @$(setwins); \
84 elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
85 for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
86 if test -f "$$el" -o \! -f "$${el}c"; then :; else \
87 echo rm "$${el}c"; \
88 rm "$${el}c"; \
89 fi \
90 done
91
92
93 .PHONY: bootstrap-clean distclean maintainer-clean
94
95 bootstrap-clean:
96 -cd $(srcdir) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
97
98 distclean:
99 rm -f Makefile
100
101 maintainer-clean: distclean bootstrap-clean
102
103
104 check: compile-main
105 @$(setwins); \
106 pattern=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
107 for el in $$pattern; do \
108 test -f $$el || continue; \
109 args="$$args -l $$el"; \
110 els="$$els $$el"; \
111 done; \
112 echo Testing $$els; \
113 $(emacs) $$args -f ert-run-tests-batch-and-exit
114
115 # Makefile ends here.