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