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