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