]> code.delx.au - gnu-emacs/blob - msdos/mainmake.v2
Make bootstrap work again:
[gnu-emacs] / msdos / mainmake.v2
1 # Top-level Makefile for Emacs under MS-DOS/DJGPP v2.0 or higher. -*-makefile-*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5
6 # This file is part of GNU Emacs.
7
8 # GNU Emacs is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12
13 # GNU Emacs is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20
21 # make all to compile and build Emacs.
22 # make install to install it (installs in-place, in `bin' subdir of top dir).
23 # make TAGS to update tags tables.
24 #
25 # make clean or make mostlyclean
26 # Delete all files from the current directory that are normally
27 # created by building the program. Don't delete the files that
28 # record the configuration. Also preserve files that could be made
29 # by building, but normally aren't because the distribution comes
30 # with them.
31 #
32 # Delete `.dvi' files here if they are not part of the distribution.
33 #
34 # make distclean
35 # Delete all files from the current directory that are created by
36 # configuring or building the program. If you have unpacked the
37 # source and built the program without creating any other files,
38 # `make distclean' should leave only the files that were in the
39 # distribution.
40 #
41 # make maintainer-clean
42 # Delete everything from the current directory that can be
43 # reconstructed with this Makefile. This typically includes
44 # everything deleted by distclean, plus more: *.elc files,
45 # C source files produced by Bison, tags tables, info files,
46 # and so on.
47 #
48 # make extraclean
49 # Still more severe - delete backup and autosave files, too.
50
51 # This gork is required for those who use a Unix-style shell, and
52 # have SHELL in the environment pointing to it. Here we force
53 # Make to use COMMAND.COM instead. This Makefile won't work otherwise.
54 # (The /xyzzy directory is used to minimize the chance that someone
55 # actually has such a directory with an incompatible command.com. We
56 # used to have /dos there, but some Windows installations have an old
57 # version of DOS stashed in that directory, and command.com from there
58 # won't run on Windows, complaining about "Incorrect DOS version".
59 # Make will look up PATH for the shell executable, so the directory name
60 # is not important.)
61 SHELL=/xyzzy/command
62 MAKESHELL=/xyzzy/command
63
64 # Generate a full pathname of the top-level installation directory
65 top_srcdir := $(subst \,/,$(shell cd))
66
67 # Find out which version of Emacs this is.
68 version := ${shell sed -n -e '/(defconst emacs-version/s/^[^"]*\("[^"]*"\).*/\1/p' lisp/version.el}
69
70 # Do we need to bootstrap?
71 boot :=
72 ifeq ($(wildcard src/b-emacs.exe),)
73 boot := b-emacs.exe
74 endif
75
76 # Subdirectories to run Make. `lisp' is not included because the
77 # compiled lisp files are part of the distribution. (If we are
78 # bootstrapping, the src target will run Make in `lisp' as well.)
79 # leim is not included because it is part of the src target.
80 all: lib-src src emacs lispref lispintro
81
82 lib-src: FRC
83 cd lib-src
84 $(MAKE) top_srcdir=${top_srcdir} version=${version}
85 cd ..
86
87 # Pass to src/Makefile.in an additional BOOTSTRAPEMACS variable which
88 # is either set to b-emacs.exe (in case bootstrap-emacs has not been
89 # constructed yet) or the empty string (otherwise).
90 # src/Makefile.in uses it to implement conditional dependencies, so that
91 # files that need bootstrap-emacs to be built do not additionally need
92 # to be kept fresher than b-emacs.exe. Otherwise changing a single
93 # file src/foo.c forces dumping a new bootstrap-emacs, then re-byte-compiling
94 # all preloaded elisp files, and only then dump the actual src/emacs, which
95 # is not wrong, but is overkill in 99.99% of the cases.
96 src: FRC
97 cd src
98 rm -f bootlisp
99 $(MAKE) top_srcdir=${top_srcdir} BOOTSTRAPEMACS="${boot}"
100 djecho -s '/-geometry/s,^.*,set environment HOME $(top_srcdir),' \
101 '/environment *TERM/s/^.*/set environment TERM internal/' \
102 '/x_error_quitter/s/^.*/set environment NAME root/' >gdb.sed
103 sed -f gdb.sed _gdbinit >gdb.tmp
104 djecho -a gdb.tmp -s 'set environment USER root' \
105 'set environment EMACSPATH $(top_srcdir)/bin' \
106 'set environment SHELL $(subst \,/,$(COMSPEC))' \
107 'set environment PATH $(subst \,/,$(PATH))'
108 update gdb.tmp gdb.ini
109 rm -f gdb.tmp gdb.sed
110 cd ..
111 if exist src\bootlisp redir $(MAKE) -C lisp top_srcdir=${top_srcdir}
112 if exist leim\Makefile redir $(MAKE) -C leim top_srcdir=${top_srcdir}
113
114 info: emacs lispref lispintro
115
116 emacs lispref lispintro: FRC
117 cd doc/$@
118 $(MAKE) top_srcdir=${top_srcdir} info
119 cd ../..
120
121 install: all
122 if not exist bin\nul md bin
123 cd lib-src
124 command.com /c >/dev/null for %p in (hexl etags ctags b2m ebrowse) do\
125 if exist %p.exe mv -f %p.exe ../bin
126 if exist fns.el update fns.el ../bin/fns.el
127 cd ..
128 cd src
129 mv -f emacs.exe ../bin/
130 cd ..
131 djecho -s "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)" \
132 " (normal-top-level-add-subdirs-to-load-path))" \
133 > ./subdirs.el
134 if not exist .\site-lisp\subdirs.el \
135 update ./subdirs.el ./site-lisp/subdirs.el
136 rm -f ./subdirs.el
137
138 FRC:
139
140 # We cannot use [a-zA-Z]* like the mainline distribution does, because
141 # that causes all file names to be returned in upper-case on DOS...
142 TAGS tags: lib-src FRC
143 cd lib-src
144 if exist etags.exe mv -f etags.exe ../bin
145 cd ..
146 cd lisp
147 ../bin/etags .../*.el
148 cd ..
149 cd src
150 ../bin/etags --include=../lisp/TAGS \
151 '--regex=/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' *.c *.h s/msdos.h m/intel386.h
152 cd ..
153 ./bin/etags --include=src/TAGS
154
155 check:
156 @echo "We don't have any tests for GNU Emacs yet."
157
158 clean mostlyclean:
159 cd lib-src
160 $(MAKE) $(MFLAGS) $@
161 cd ..
162 cd src
163 $(MAKE) $(MFLAGS) $@
164 cd ..
165 cd doc
166 cd emacs
167 -$(MAKE) $(MFLAGS) $@
168 cd ..
169 cd misc
170 -$(MAKE) $(MFLAGS) $@
171 cd ..
172 cd lispref
173 -$(MAKE) $(MFLAGS) $@
174 cd ..
175 cd lispintro
176 -$(MAKE) $(MFLAGS) $@
177 cd ..
178 cd ..
179 cd leim
180 if exist Makefile redir $(MAKE) $(MFLAGS) $@
181 cd ..
182
183 top_distclean=rm -f Makefile */Makefile src/_gdbinit
184
185 distclean maintainer-clean: FRC
186 cd src
187 $(MAKE) $(MFLAGS) $@
188 if exist bootlisp rm -f bootlisp
189 cd ..
190 cd lib-src
191 $(MAKE) $(MFLAGS) $@
192 cd ..
193 cd doc
194 cd emacs
195 -$(MAKE) $(MFLAGS) $@
196 cd ..
197 cd misc
198 -$(MAKE) $(MFLAGS) $@
199 cd ..
200 cd lispref
201 -$(MAKE) $(MFLAGS) $@
202 cd ..
203 cd lispintro
204 -$(MAKE) $(MFLAGS) $@
205 cd ..
206 cd ..
207 cd leim
208 if exist Makefile redir $(MAKE) $(MFLAGS) $@
209 cd ..
210 cd lisp
211 $(MAKE) $(MFLAGS) $@
212 cd ..
213 ${top_distclean}
214
215 extraclean:
216 cd src
217 $(MAKE) $(MFLAGS) $@
218 cd ..
219 cd lib-src
220 $(MAKE) $(MFLAGS) $@
221 cd ..
222 cd doc
223 cd emacs
224 -$(MAKE) $(MFLAGS) $@
225 cd ..
226 cd misc
227 -$(MAKE) $(MFLAGS) $@
228 cd ..
229 cd lispref
230 -$(MAKE) $(MFLAGS) $@
231 cd ..
232 cd lispintro
233 -$(MAKE) $(MFLAGS) $@
234 cd ..
235 cd ..
236 cd leim
237 if exist Makefile redir $(MAKE) $(MFLAGS) $@
238 cd ..
239 cd lisp
240 $(MAKE) $(MFLAGS) $@
241 cd ..
242 ${top_distclean}
243 -rm -f *~ #*
244
245 .PHONY: bootstrap
246
247 bootstrap-clean: FRC
248 cd src
249 $(MAKE) $(MFLAGS) $@
250 cd ..
251 cd lib-src
252 $(MAKE) $(MFLAGS) maintainer-clean
253 cd ..
254 cd doc
255 cd emacs
256 -$(MAKE) $(MFLAGS) maintainer-clean
257 cd ../misc
258 -$(MAKE) $(MFLAGS) maintainer-clean
259 cd ../lispref
260 -$(MAKE) $(MFLAGS) maintainer-clean
261 cd ../lispintro
262 -$(MAKE) $(MFLAGS) maintainer-clean
263 cd ..
264 cd ..
265 cd leim
266 $(MAKE) $(MFLAGS) maintainer-clean
267 cd ..
268 cd lisp
269 $(MAKE) $(MFLAGS) bootstrap-clean
270 cd ..
271 ${top_bootclean}
272
273 bootstrap: bootstrap-clean FRC
274 config msdos
275 $(MAKE) $(MFLAGS) info all
276
277 # arch-tag: 6fee5130-4c53-46c6-93d3-d0ea852298b9