(distclean): New target.
[bpt/emacs.git] / lisp / Makefile.in
1 #
2 # Maintenance productions for the Lisp directory
3 #
4
5 SHELL = /bin/sh
6
7 lisp=@srcdir@
8 VPATH=@srcdir@
9
10 # You can specify a different executable on the make command line,
11 # e.g. "make EMACS=../src/emacs ...".
12
13 EMACS = ../src/emacs
14
15 # Command line flags for Emacs. This must include --multibyte,
16 # otherwise some files will not compile.
17
18 EMACSOPT = -batch --no-site-file --multibyte
19
20 SOURCES = *.el COPYING Makefile
21 lisptagsfiles1 = $(lisp)/[a-zA-Z]*.el
22 lisptagsfiles2 = $(lisp)/[a-zA-Z]*/[a-zA-Z]*.el
23 ETAGS = ../lib-src/etags
24
25 # Files which should not be compiled.
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.
28
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
56
57 # Files to compile before others during a bootstrap. This is done
58 # to speed up the bootstrap process.
59
60 COMPILE_FIRST = \
61 $(lisp)/emacs-lisp/byte-opt.el \
62 $(lisp)/emacs-lisp/bytecomp.el \
63 $(lisp)/subr.el
64
65 # The actual Emacs command run in the targets below.
66
67 emacs = $(EMACS) $(EMACSOPT)
68
69 # Common command to find subdirectories
70
71 setwins=subdirs=`find $$wd -type d -print`; \
72 for file in $$subdirs; do \
73 case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
74 *) wins="$$wins $$file" ;; \
75 esac; \
76 done
77
78 doit:
79
80 cus-load.el:
81 touch $@
82 custom-deps: cus-load.el doit
83 wd=$(lisp); $(setwins); \
84 echo Directories: $$wins; \
85 $(emacs) -l cus-dep -f custom-make-dependencies $$wins
86
87 finder-inf.el:
88 echo "(provide 'finder-inf)" >> $@
89 finder-data: finder-inf.el doit
90 wd=$(lisp); $(setwins); \
91 echo Directories: $$wins; \
92 $(emacs) -l finder -f finder-compile-keywords-make-dist $$wins
93
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
105 wd=$(lisp); $(setwins); \
106 echo Directories: $$wins; \
107 $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
108
109 subdirs.el:
110 $(MAKE) $(MFLAGS) update-subdirs
111 update-subdirs: doit
112 wd=$(lisp); $(setwins); \
113 for file in $$wins; do \
114 $(srcdir)/update-subdirs $$file; \
115 done;
116
117 updates: update-subdirs autoloads finder-data custom-deps
118
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)
125
126 .el.elc: subdirs.el
127 -EMACSLOADPATH=$(lisp) $(emacs) -f batch-byte-compile $<
128
129 $(DONTCOMPILE:.el=.elc):
130 -rm -f $@
131
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).
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.
140
141 compile-files: subdirs.el doit
142 find $(lisp) -name "*.elc" -print | xargs chmod +w; \
143 wd=$(lisp); $(setwins); \
144 elpat=`echo $$wins | tr ' ' '\012\012' | \
145 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
146 els=`echo $$elpat $(DONTCOMPILE) $(COMPILE_FIRST) | \
147 tr ' ' '\012\012' | sort | uniq -u`; \
148 for el in $(COMPILE_FIRST) $$els; do \
149 echo Compiling $$el; \
150 EMACSLOADPATH=$(lisp) $(emacs) -f batch-byte-compile $$el; \
151 done
152
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:
157 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
158 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
159
160 # Compile Lisp files, but save old compiled files first.
161
162 compile: backup-compiled-files compile-files
163
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
169 $(emacs) -f batch-byte-recompile-directory $(lisp)
170
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.
176
177 bootstrap-clean:
178 if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi
179 -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
180
181 # Generate/update files for the bootstrap process.
182
183 bootstrap: autoloads compile-files custom-deps
184
185 distclean:
186 -rm -f $(lisp)/Makefile
187
188 # Makefile ends here.