Commit | Line | Data |
---|---|---|
c7685c8d PA |
1 | # |
2 | # Maintenance productions for the Lisp directory | |
3 | # | |
7ec641b8 | 4 | |
261f3289 EZ |
5 | SHELL = /bin/sh |
6 | ||
dce6b995 GM |
7 | lisp=@srcdir@ |
8 | VPATH=@srcdir@ | |
0df68e9f | 9 | srcdir=@srcdir@/.. |
dce6b995 | 10 | |
7ec641b8 GM |
11 | # You can specify a different executable on the make command line, |
12 | # e.g. "make EMACS=../src/emacs ...". | |
13 | ||
e3384ae7 | 14 | EMACS = ../src/emacs |
7ec641b8 GM |
15 | |
16 | # Command line flags for Emacs. This must include --multibyte, | |
17 | # otherwise some files will not compile. | |
18 | ||
1499d2dd | 19 | EMACSOPT = -batch --no-site-file --multibyte |
7ec641b8 | 20 | |
c7685c8d | 21 | SOURCES = *.el COPYING Makefile |
dce6b995 GM |
22 | lisptagsfiles1 = $(lisp)/[a-zA-Z]*.el |
23 | lisptagsfiles2 = $(lisp)/[a-zA-Z]*/[a-zA-Z]*.el | |
3975988b | 24 | ETAGS = ../lib-src/etags |
c7685c8d | 25 | |
dce6b995 | 26 | # Files which should not be compiled. |
cc953d27 SM |
27 | # - emacs-lisp/cl-specs.el: only contains `def-edebug-spec's so there's |
28 | # no point compiling it, although it doesn't hurt. | |
a9b67cf4 | 29 | |
dce6b995 GM |
30 | DONTCOMPILE = \ |
31 | $(lisp)/bindings.el \ | |
32 | $(lisp)/cus-load.el \ | |
33 | $(lisp)/cus-start.el \ | |
34 | $(lisp)/emacs-lisp/cl-specs.el \ | |
35 | $(lisp)/finder-inf.el \ | |
36 | $(lisp)/forms-d2.el \ | |
37 | $(lisp)/forms-pass.el \ | |
38 | $(lisp)/generic-x.el \ | |
39 | $(lisp)/international/latin-1.el \ | |
40 | $(lisp)/international/latin-2.el \ | |
41 | $(lisp)/international/latin-3.el \ | |
42 | $(lisp)/international/latin-4.el \ | |
43 | $(lisp)/international/latin-5.el \ | |
44 | $(lisp)/international/latin-8.el \ | |
45 | $(lisp)/international/latin-9.el \ | |
46 | $(lisp)/international/mule-conf.el \ | |
47 | $(lisp)/loaddefs.el \ | |
48 | $(lisp)/loadup.el \ | |
49 | $(lisp)/mail/blessmail.el \ | |
50 | $(lisp)/mail/sc.el \ | |
51 | $(lisp)/patcomp.el \ | |
52 | $(lisp)/paths.el \ | |
53 | $(lisp)/play/bruce.el \ | |
54 | $(lisp)/subdirs.el \ | |
55 | $(lisp)/term/internal.el \ | |
56 | $(lisp)/version.el | |
7ec641b8 | 57 | |
d849789b GM |
58 | # Files to compile before others during a bootstrap. This is done |
59 | # to speed up the bootstrap process. | |
60 | ||
dce6b995 GM |
61 | COMPILE_FIRST = \ |
62 | $(lisp)/emacs-lisp/byte-opt.el \ | |
63 | $(lisp)/emacs-lisp/bytecomp.el \ | |
64 | $(lisp)/subr.el | |
d849789b | 65 | |
7ec641b8 GM |
66 | # The actual Emacs command run in the targets below. |
67 | ||
68 | emacs = $(EMACS) $(EMACSOPT) | |
69 | ||
80c382e5 | 70 | # Common command to find subdirectories |
7ec641b8 | 71 | |
3f4c23f9 | 72 | setwins=subdirs=`find $$wd -type d -print`; \ |
f83a4f35 | 73 | for file in $$subdirs; do \ |
80c382e5 | 74 | case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \ |
f83a4f35 RS |
75 | *) wins="$$wins $$file" ;; \ |
76 | esac; \ | |
80c382e5 SM |
77 | done |
78 | ||
79 | doit: | |
80 | ||
cc953d27 SM |
81 | cus-load.el: |
82 | touch $@ | |
83 | custom-deps: cus-load.el doit | |
dce6b995 | 84 | wd=$(lisp); $(setwins); \ |
4746aeeb | 85 | echo Directories: $$wins; \ |
7ec641b8 | 86 | $(emacs) -l cus-dep -f custom-make-dependencies $$wins |
009368b9 | 87 | |
cc953d27 SM |
88 | finder-inf.el: |
89 | echo "(provide 'finder-inf)" >> $@ | |
90 | finder-data: finder-inf.el doit | |
dce6b995 | 91 | wd=$(lisp); $(setwins); \ |
4746aeeb | 92 | echo Directories: $$wins; \ |
7ec641b8 | 93 | $(emacs) -l finder -f finder-compile-keywords-make-dist $$wins |
009368b9 | 94 | |
cc953d27 SM |
95 | loaddefs.el: |
96 | echo ";;; loaddefs.el --- automatically extracted autoloads" >> $@ | |
97 | echo ";;" >> $@; echo ";;; Code:" >> $@ | |
98 | echo "\f" >> $@ | |
99 | echo ";;; Local Variables:" >> $@ | |
100 | echo ";;; version-control: never" >> $@ | |
101 | echo ";;; no-byte-compile: t" >> $@ | |
102 | echo ";;; no-update-autoloads: t" >> $@ | |
103 | echo ";;; End:" >> $@ | |
104 | echo ";;; loaddefs.el ends here" >> $@ | |
105 | autoloads: loaddefs.el doit | |
dce6b995 | 106 | wd=$(lisp); $(setwins); \ |
4746aeeb | 107 | echo Directories: $$wins; \ |
dce6b995 | 108 | $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins |
f83a4f35 | 109 | |
cc953d27 SM |
110 | subdirs.el: |
111 | $(MAKE) $(MFLAGS) update-subdirs | |
98b918b6 | 112 | update-subdirs: doit |
dce6b995 | 113 | wd=$(lisp); $(setwins); \ |
98b918b6 | 114 | for file in $$wins; do \ |
dce6b995 | 115 | $(srcdir)/update-subdirs $$file; \ |
98b918b6 RS |
116 | done; |
117 | ||
cc953d27 | 118 | updates: update-subdirs autoloads finder-data custom-deps |
c48c3772 | 119 | |
7ab2c289 RS |
120 | TAGS: $(lisptagsfiles1) $(lisptagsfiles2) |
121 | ${ETAGS} $(lisptagsfiles1) $(lisptagsfiles2) | |
122 | ||
123 | TAGS-LISP: $(lispsource)$(lisptagsfiles1) $(lispsource)$(lisptagsfiles2) | |
124 | ${ETAGS} -o TAGS-LISP \ | |
125 | $(lispsource)$(lisptagsfiles1) $(lispsource)$(lisptagsfiles2) | |
7ec641b8 | 126 | |
cc953d27 | 127 | .el.elc: subdirs.el |
dce6b995 | 128 | -EMACSLOADPATH=$(lisp) $(emacs) -f batch-byte-compile $< |
cc953d27 SM |
129 | |
130 | $(DONTCOMPILE:.el=.elc): | |
131 | -rm -f $@ | |
132 | ||
7ec641b8 GM |
133 | # Compile all Lisp files, except those from DONTCOMPILE. This |
134 | # compiles files unconditionally. All .elc files are made writable | |
135 | # before compilation in case we checked out read-only (CVS option -r). | |
8256e31b GM |
136 | # Files MUST be compiled one by one. If we compile several files in a |
137 | # row we can't make sure that the compilation environment is clean. | |
138 | # We also set the load-path of the Emacs used for compilation to the | |
139 | # current directory and its subdirectories, to make sure require's and | |
140 | # load's in the files being compiled find the right files. | |
7ec641b8 | 141 | |
a9b67cf4 | 142 | compile-files: subdirs.el doit |
dce6b995 GM |
143 | find $(lisp) -name "*.elc" -print | xargs chmod +w; \ |
144 | wd=$(lisp); $(setwins); \ | |
145 | elpat=`echo $$wins | tr ' ' '\012\012' | \ | |
cc953d27 | 146 | sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \ |
d849789b GM |
147 | els=`echo $$elpat $(DONTCOMPILE) $(COMPILE_FIRST) | \ |
148 | tr ' ' '\012\012' | sort | uniq -u`; \ | |
149 | for el in $(COMPILE_FIRST) $$els; do \ | |
8256e31b | 150 | echo Compiling $$el; \ |
dce6b995 | 151 | EMACSLOADPATH=$(lisp) $(emacs) -f batch-byte-compile $$el; \ |
8256e31b | 152 | done |
96ff0f09 | 153 | |
a9b67cf4 GM |
154 | # Backup compiled Lisp files in elc.tar.gz. If that file already |
155 | # exists, make a backup of it. | |
156 | ||
157 | backup-compiled-files: | |
dce6b995 GM |
158 | -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~ |
159 | -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc | |
a9b67cf4 GM |
160 | |
161 | # Compile Lisp files, but save old compiled files first. | |
162 | ||
163 | compile: backup-compiled-files compile-files | |
164 | ||
7ec641b8 GM |
165 | # Recompile all Lisp files which are newer than their .elc files. |
166 | # Note that this doesn't create .elc files. It only recompiles if an | |
167 | # .elc is present. | |
168 | ||
169 | recompile: doit | |
dce6b995 | 170 | $(emacs) -f batch-byte-recompile-directory $(lisp) |
7ec641b8 | 171 | |
03adf1ee GM |
172 | # Prepare a bootstrap in the lisp subdirectory. Build loaddefs.el, |
173 | # because it's not sure it's up-to-date, and if it's not, that might | |
174 | # lead to errors during the bootstrap because something fails to | |
175 | # autoload as expected. Remove compiled Lisp files so that | |
176 | # bootstrap-emacs will be built from sources only. | |
a9b67cf4 GM |
177 | |
178 | bootstrap-clean: | |
dce6b995 GM |
179 | if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi |
180 | -rm -f $(lisp)/*.elc $(lisp)/*/*.elc | |
a9b67cf4 GM |
181 | |
182 | # Generate/update files for the bootstrap process. | |
183 | ||
1499d2dd | 184 | bootstrap: autoloads compile-files custom-deps |
a9b67cf4 | 185 | |
43280888 GM |
186 | distclean: |
187 | -rm -f $(lisp)/Makefile | |
188 | ||
7ec641b8 | 189 | # Makefile ends here. |