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