(setwins): generalized a little.
[emacs.git] / lisp / Makefile
blobe37d1014a2aeaa7be172a595591a5435469d5b83
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 $(setwins) \
116 loadpath="(setq load-path '($$wins))"; \
117 dont_compile=`echo $(DONTCOMPILE)`; \
118 for el in $(EL); do \
119 compile_it=y; \
120 for dont in $$dont_compile; do \
121 if test $$el = $$dont; then \
122 compile_it=n; \
123 fi; \
124 done; \
125 if test $$compile_it = y; then \
126 $(emacs) --eval "$$loadpath" -f batch-byte-compile $$el; \
127 else \
128 echo "Don't compile $$el"; \
129 fi; \
130 done
132 # Compile Lisp files when all we have is the temacs in ../src. All
133 # .elc files under the current directory are deleted first to make
134 # sure we start from a clean basis.
136 bootstrap-compile: doit
137 wd=`pwd`; \
138 find $$wd -name "*.elc" -print | xargs rm -f \
139 $(setwins) \
140 loadpath="(setq load-path '($$wins))"; \
141 dont_compile=`echo $(DONTCOMPILE)`; \
142 for el in $(EL); do \
143 compile_it=y; \
144 for dont in $$dont_compile; do \
145 if test $$el = $$dont; then \
146 compile_it=n; \
147 fi; \
148 done; \
149 if test $$compile_it = y; then \
150 $(temacs) --eval "$$loadpath" -f batch-byte-compile $$el; \
151 else \
152 echo "Don't compile $$el"; \
153 fi; \
154 done
157 # Recompile all Lisp files which are newer than their .elc files.
158 # Note that this doesn't create .elc files. It only recompiles if an
159 # .elc is present.
161 recompile: doit
162 $(emacs) -f batch-byte-recompile-directory .
164 # Build loaddefs.el but with an Emacs executable which was not built
165 # in the current directory tree. The problem in this case is that
166 # autoload.el reads and writes loaddefs.el in its `source-directory'.
167 # If that's different from the current directory tree, we can't build
168 # loaddefs.el.
169 # Can't this rule be used in place of `autoload'? -sm
171 autoloads-with-other-emacs: doit
172 wd=.; $(setwins); \
173 echo Directories: $$wins; \
174 $(emacs) --eval '(setq source-directory ".")' \
175 -f batch-update-autoloads $$wins
177 # Makefile ends here.