]> code.delx.au - gnu-emacs/blob - test/automated/Makefile.in
* automated/Makefile.in (test): Remove variable.
[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 abs_top_srcdir = @abs_top_srcdir@
24 abs_top_builddir = @abs_top_builddir@
25 VPATH = $(srcdir)
26
27 # You can specify a different executable on the make command line,
28 # e.g. "make EMACS=../src/emacs ...".
29
30 # We sometimes change directory before running Emacs (typically when
31 # building out-of-tree, we chdir to the source directory), so we need
32 # to use an absolute file name.
33 EMACS = ${abs_top_builddir}/src/emacs
34
35 # Command line flags for Emacs.
36
37 EMACSOPT = -batch --no-site-file --no-site-lisp
38
39 # Extra flags to pass to the byte compiler
40 BYTE_COMPILE_EXTRA_FLAGS =
41 # For example to not display the undefined function warnings you can use this:
42 # BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not unresolved)))'
43 # The example above is just for developers, it should not be used by default.
44
45 # The actual Emacs command run in the targets below.
46 emacs = EMACSLOADPATH="$(abs_top_srcdir)/lisp:$(abs_srcdir)" LC_ALL=C "$(EMACS)" $(EMACSOPT)
47
48 # Common command to find subdirectories
49 setwins=subdirs=`find . -type d -print`; \
50 for file in $$subdirs; do \
51 case $$file in */.* | */.*/* | */=* | ./data* ) ;; \
52 *) wins="$$wins$${wins:+ }$$file" ;; \
53 esac; \
54 done
55
56 all: check
57
58 doit:
59
60
61 # Files MUST be compiled one by one. If we compile several files in a
62 # row (i.e., in the same instance of Emacs) we can't make sure that
63 # the compilation environment is clean. We also set the load-path of
64 # the Emacs used for compilation to the current directory and its
65 # subdirectories, to make sure require's and load's in the files being
66 # compiled find the right files.
67
68 .SUFFIXES: .elc .el
69
70 # An old-fashioned suffix rule, which, according to the GNU Make manual,
71 # cannot have prerequisites.
72 .el.elc:
73 @echo Compiling $<
74 @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
75
76 .PHONY: lisp-compile compile-main compile compile-always
77
78 lisp-compile:
79 cd ../../lisp && $(MAKE) $(MFLAGS) compile EMACS="$(EMACS)"
80
81 # In `compile-main' we could directly do
82 # ... | xargs $(MAKE) $(MFLAGS) EMACS="$(EMACS)"
83 # and it works, but it generates a lot of messages like
84 # make[2]: « gnus/gnus-mlspl.elc » is up to date.
85 # so instead, we use "xargs echo" to split the list of file into manageable
86 # chunks and then use an intermediate `compile-targets' target so the
87 # actual targets (the .elc files) are not mentioned as targets on the
88 # make command line.
89
90
91 .PHONY: compile-targets
92 # TARGETS is set dynamically in the recursive call from `compile-main'.
93 compile-targets: $(TARGETS)
94
95 # Compile all the Elisp files that need it. Beware: it approximates
96 # `no-byte-compile', so watch out for false-positives!
97 compile-main: compile-clean lisp-compile
98 @(cd $(srcdir) && $(setwins); \
99 els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
100 for el in $$els; do \
101 test -f $$el || continue; \
102 test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
103 echo "$${el}c"; \
104 done | xargs echo) | \
105 while read chunk; do \
106 $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
107 done
108
109 .PHONY: compile-clean
110 # Erase left-over .elc files that do not have a corresponding .el file.
111 compile-clean:
112 @cd $(srcdir) && $(setwins); \
113 elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
114 for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
115 if test -f "$$el" -o \! -f "$${el}c"; then :; else \
116 echo rm "$${el}c"; \
117 rm "$${el}c"; \
118 fi \
119 done
120
121 # Compile all Lisp files, but don't recompile those that are up to
122 # date. Some .el files don't get compiled because they set the
123 # local variable no-byte-compile.
124 # Calling make recursively because suffix rule cannot have prerequisites.
125 # Explicitly pass EMACS (sometimes ../src/bootstrap-emacs) to those
126 # sub-makes that run rules that use it, for the sake of some non-GNU makes.
127 compile: $(LOADDEFS) autoloads compile-first
128 $(MAKE) $(MFLAGS) compile-main EMACS="$(EMACS)"
129
130 # Compile all Lisp files. This is like `compile' but compiles files
131 # unconditionally. Some files don't actually get compiled because they
132 # set the local variable no-byte-compile.
133 compile-always: bootstrap-clean
134 $(MAKE) $(MFLAGS) compile EMACS="$(EMACS)"
135
136 bootstrap-clean:
137 -cd $(srcdir) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
138
139 distclean:
140 rm -f Makefile
141
142 maintainer-clean: distclean bootstrap-clean
143
144 check: compile-main
145 @(cd $(srcdir) && $(setwins); \
146 pattern=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
147 for el in $$pattern; do \
148 test -f $$el || continue; \
149 args="$$args -l $$el"; \
150 els="$$els $$el"; \
151 done; \
152 echo Testing $$els; \
153 $(emacs) $$args -f ert-run-tests-batch-and-exit)
154
155 # Makefile ends here.