(compile, bootstrap-compile): don't use setwins: I'm an idiot.
[emacs.git] / lisp / Makefile
blob73f80bf711163d4ed2d1e6734bea0d8b97face79
2 # Maintenance productions for the Lisp directory
5 # You can specify a different executable on the make command line,
6 # e.g. "make EMACS=../src/emacs ...".
8 EMACS = emacs
10 # Command line flags for Emacs. This must include --multibyte,
11 # otherwise some files will not compile.
13 EMACSOPT = --no-init-file --no-site-file --multibyte -batch
15 SOURCES = *.el COPYING Makefile
16 lisptagsfiles1 = [a-zA-Z]*.el
17 lisptagsfiles2 = [a-zA-Z]*/[a-zA-Z]*.el
18 ETAGS = ../lib-src/etags
20 # Leave this in. I don't know if some utility depends on it.
22 dontcompilefiles: bindings.el blessmail.el bruce.el cus-load.el cus-start.el
23 dontcompilefiles: forms-d2.el forms-pass.el
24 dontcompilefiles: latin-1.el latin-2.el latin-3.el latin-4.el latin-5.el
25 dontcompilefiles: loaddefs.el loadup.el mule-conf.el patcomp.el
26 dontcompilefiles: paths.el sc.el subdirs.el term-nasty.el version.el
27 dontcompilefiles: generic-x.el latin-8.el latin-9.el
29 # Files which should not be compiled. All file names must be relative
30 # to the `lisp' directory.
32 DONTCOMPILE = bindings.el mail/blessmail.el play/bruce.el cus-load.el \
33 cus-start.el forms-d2.el forms-pass.el \
34 international/latin-1.el international/latin-2.el \
35 international/latin-3.el international/latin-4.el \
36 international/latin-5.el \
37 loaddefs.el loadup.el international/mule-conf.el patcomp.el \
38 paths.el mail/sc.el subdirs.el term-nasty.el version.el \
39 generic-x.el international/latin-8.el international/latin-9.el
41 # All Lisp source files in the current directory.
43 EL = $(lisptagsfiles1) $(lisptagsfiles2)
45 # The actual Emacs command run in the targets below.
47 emacs = $(EMACS) $(EMACSOPT)
49 # The Emacs used to compile Lisp files from scratch.
51 temacs=../src/temacs -batch -l ./loadup.el
53 # Common command to find subdirectories
55 setwins=subdirs=`find $$wd -type d -print`; \
56 for file in $$subdirs; do \
57 case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
58 *) wins="$$wins $$file" ;; \
59 esac; \
60 done
62 doit:
64 custom-deps: doit
65 wd=.; $(setwins); \
66 echo Directories: $$wins; \
67 $(emacs) -l cus-dep -f custom-make-dependencies $$wins
69 finder-data: doit
70 wd=.; $(setwins); \
71 echo Directories: $$wins; \
72 $(emacs) -l finder -f finder-compile-keywords-make-dist $$wins
74 autoloads: doit
75 wd=.; $(setwins); \
76 echo Directories: $$wins; \
77 $(emacs) -f batch-update-autoloads $$wins
79 update-subdirs: doit
80 wd=.; $(setwins); \
81 for file in $$wins; do \
82 ../update-subdirs $$file; \
83 done;
85 updates: doit
86 wd=.; $(setwins); \
87 for file in $$wins; do \
88 ../update-subdirs $$file; \
89 done; \
90 echo Directories: $$wins; \
91 $(emacs) -l cus-dep -f custom-make-dependencies $$wins; \
92 $(emacs) -l finder -f finder-compile-keywords-make-dist $$wins; \
93 $(emacs) -f batch-update-autoloads $$wins
95 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
96 ${ETAGS} $(lisptagsfiles1) $(lisptagsfiles2)
98 TAGS-LISP: $(lispsource)$(lisptagsfiles1) $(lispsource)$(lisptagsfiles2)
99 ${ETAGS} -o TAGS-LISP \
100 $(lispsource)$(lisptagsfiles1) $(lispsource)$(lisptagsfiles2)
102 # Compile all Lisp files, except those from DONTCOMPILE. This
103 # compiles files unconditionally. All .elc files are made writable
104 # before compilation in case we checked out read-only (CVS option -r).
105 # Files must be compiled one by one, otherwise apparently
106 # eval-when-compile's in some Lisp files make problems in files being
107 # compiled later. We also set the load-path of the Emacs used for
108 # compilation to the current directory and its subdirectories, to
109 # make sure require's and load's in the files being compiled find
110 # the right files.
112 compile: doit
113 wd=`pwd`; \
114 find $$wd -name "*.elc" -print | xargs chmod +w; \
115 subdirs=`find $$wd -type d -print`; \
116 for dir in $$subdirs; do \
117 case $$dir in \
118 */Old | */RCS | */CVS | */=* ) ;; \
119 *) loadpath="$$loadpath \"$$dir\"" ;; \
120 esac; \
121 done; \
122 loadpath="(setq load-path '($$loadpath))"; \
123 dont_compile=`echo $(DONTCOMPILE)`; \
124 for el in $(EL); do \
125 compile_it=y; \
126 for dont in $$dont_compile; do \
127 if test $$el = $$dont; then \
128 compile_it=n; \
129 fi; \
130 done; \
131 if test $$compile_it = y; then \
132 echo $(emacs) --eval "$$loadpath" -f batch-byte-compile $$el; \
133 $(emacs) --eval "$$loadpath" -f batch-byte-compile $$el; \
134 else \
135 echo "Don't compile $$el"; \
136 fi; \
137 done
139 # Compile Lisp files when all we have is the temacs in ../src. All
140 # .elc files under the current directory are deleted first to make
141 # sure we start from a clean basis.
143 bootstrap-compile: doit
144 wd=`pwd`; \
145 find $$wd -name "*.elc" -print | xargs rm -f \
146 subdirs=`find $$wd -type d -print`; \
147 for dir in $$subdirs; do \
148 case $$dir in \
149 */Old | */RCS | */CVS | */=* ) ;; \
150 *) loadpath="$$loadpath \"$$dir\"" ;; \
151 esac; \
152 done; \
153 loadpath="(setq load-path '($$loadpath))"; \
154 dont_compile=`echo $(DONTCOMPILE)`; \
155 for el in $(EL); do \
156 compile_it=y; \
157 for dont in $$dont_compile; do \
158 if test $$el = $$dont; then \
159 compile_it=n; \
160 fi; \
161 done; \
162 if test $$compile_it = y; then \
163 $(temacs) --eval "$$loadpath" -f batch-byte-compile $$el; \
164 else \
165 echo "Don't compile $$el"; \
166 fi; \
167 done
170 # Recompile all Lisp files which are newer than their .elc files.
171 # Note that this doesn't create .elc files. It only recompiles if an
172 # .elc is present.
174 recompile: doit
175 $(emacs) -f batch-byte-recompile-directory .
177 # Build loaddefs.el but with an Emacs executable which was not built
178 # in the current directory tree. The problem in this case is that
179 # autoload.el reads and writes loaddefs.el in its `source-directory'.
180 # If that's different from the current directory tree, we can't build
181 # loaddefs.el.
182 # Can't this rule be used in place of `autoload'? -sm
184 autoloads-with-other-emacs: doit
185 wd=.; $(setwins); \
186 echo Directories: $$wins; \
187 $(emacs) --eval '(setq source-directory ".")' \
188 -f batch-update-autoloads $$wins
190 # Makefile ends here.