Avoid EMACSDATA in user environment interfering with building
[bpt/emacs.git] / test / automated / Makefile.in
CommitLineData
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 20SHELL = @SHELL@
d221e780
CO
21
22srcdir = @srcdir@
d221e780 23VPATH = $(srcdir)
d221e780 24
0845be75 25SEPCHAR = @SEPCHAR@
2df10228 26
009111d6
GM
27# Empty for all systems except MinGW, where xargs needs an explicit
28# limitation.
29XARGS_LIMIT = @XARGS_LIMIT@
30
67fb4e6a
GM
31# We never change directory before running Emacs, so a relative file
32# name is fine, and makes life easier. If we need to change
33# directory, we can use emacs --chdir.
34EMACS = ../../src/emacs
d221e780
CO
35
36# Command line flags for Emacs.
2df10228
GM
37# Apparently MSYS bash would convert "-L :" to "-L ;" anyway,
38# but we might as well be explicit.
0845be75 39EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)"
d221e780 40
67bb589e 41# Extra flags to pass to the byte compiler.
d221e780 42BYTE_COMPILE_EXTRA_FLAGS =
d221e780 43
e088b01d
GM
44# Prevent any settings in the user environment causing problems.
45unexport EMACSDATA EMACSDOC EMACSPATH
46
d221e780 47# The actual Emacs command run in the targets below.
8b77446f 48# Prevent any setting of EMACSLOADPATH in user environment causing problems.
17e0445b 49emacs = EMACSLOADPATH= LC_ALL=C EMACS_TEST_DIRECTORY=$(srcdir) "$(EMACS)" $(EMACSOPT)
d221e780
CO
50
51# Common command to find subdirectories
6b4ac03e
GM
52setwins=for file in `find $(srcdir) -type d -print`; do \
53 case $$file in $(srcdir)*/data* | $(srcdir)*/flymake* ) ;; \
f8ccce03 54 *) wins="$$wins$${wins:+ }$$file" ;; \
d221e780
CO
55 esac; \
56 done
57
67bb589e 58.PHONY: all check
d221e780 59
67bb589e 60all: check
d221e780 61
67bb589e 62# The compilation stuff is copied from lisp/Makefile - see comments there.
d221e780
CO
63
64.SUFFIXES: .elc .el
65
d221e780
CO
66.el.elc:
67 @echo Compiling $<
2d748773 68 @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
d221e780 69
67bb589e 70
67fb4e6a 71.PHONY: compile-targets compile-main compile-clean
d221e780 72
d221e780
CO
73# TARGETS is set dynamically in the recursive call from `compile-main'.
74compile-targets: $(TARGETS)
75
76# Compile all the Elisp files that need it. Beware: it approximates
77# `no-byte-compile', so watch out for false-positives!
67fb4e6a 78compile-main: compile-clean
2d748773 79 @$(setwins); \
d221e780
CO
80 els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
81 for el in $$els; do \
82 test -f $$el || continue; \
83 test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
84 echo "$${el}c"; \
009111d6 85 done | xargs $(XARGS_LIMIT) echo | \
d221e780
CO
86 while read chunk; do \
87 $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
88 done
89
d221e780
CO
90# Erase left-over .elc files that do not have a corresponding .el file.
91compile-clean:
2d748773 92 @$(setwins); \
d221e780
CO
93 elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
94 for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
95 if test -f "$$el" -o \! -f "$${el}c"; then :; else \
96 echo rm "$${el}c"; \
97 rm "$${el}c"; \
98 fi \
99 done
100
67bb589e
GM
101
102.PHONY: bootstrap-clean distclean maintainer-clean
d221e780
CO
103
104bootstrap-clean:
1f43ed41 105 -cd $(srcdir) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
d221e780
CO
106
107distclean:
1f43ed41 108 rm -f Makefile
d221e780
CO
109
110maintainer-clean: distclean bootstrap-clean
111
67bb589e 112
d221e780 113check: compile-main
2d748773 114 @$(setwins); \
d221e780
CO
115 pattern=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
116 for el in $$pattern; do \
117 test -f $$el || continue; \
118 args="$$args -l $$el"; \
119 els="$$els $$el"; \
120 done; \
121 echo Testing $$els; \
2d748773 122 $(emacs) $$args -f ert-run-tests-batch-and-exit
d221e780
CO
123
124# Makefile ends here.