Remove lib-src/b2m.c and b2m.pl.
[bpt/emacs.git] / msdos / mainmake.v2
CommitLineData
4a7c8265 1# Top-level Makefile for Emacs under MS-DOS/DJGPP v2.0 or higher. -*-makefile-*-
7121a5e1 2
b65d8176 3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
114f9c96 4# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
7121a5e1
EZ
5
6# This file is part of GNU Emacs.
7
ff0cdfb9 8# GNU Emacs is free software: you can redistribute it and/or modify
7121a5e1 9# it under the terms of the GNU General Public License as published by
ff0cdfb9
GM
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
7121a5e1
EZ
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
ff0cdfb9 19# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
7121a5e1 20
2d0300ef 21# make all to compile and build Emacs.
406865b8 22# make install to install it (installs in-place, in `bin' subdir of top dir).
2d0300ef
RS
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.
177c0ea7 33#
2d0300ef
RS
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.
177c0ea7 40#
406865b8 41# make maintainer-clean
2d0300ef
RS
42# Delete everything from the current directory that can be
43# reconstructed with this Makefile. This typically includes
406865b8
EZ
44# everything deleted by distclean, plus more: *.elc files,
45# C source files produced by Bison, tags tables, info files,
46# and so on.
2d0300ef
RS
47#
48# make extraclean
49# Still more severe - delete backup and autosave files, too.
50
32372ef8
EZ
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.
94b04180
EZ
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.)
61SHELL=/xyzzy/command
62MAKESHELL=/xyzzy/command
32372ef8 63
2d0300ef 64# Generate a full pathname of the top-level installation directory
de219b90
EZ
65top_srcdir := $(subst \,/,$(shell cd))
66
67# Find out which version of Emacs this is.
491a1546 68version := ${shell sed -n -e '/^static const char emacs_version/s/^[^"]*\("[^"]*"\).*/\1/p' src/emacs.c}
2d0300ef 69
291f6a31 70# Q: Do we need to bootstrap?
7e222e4e
GM
71# A: Only if we find admin/admin.el, i.e. we are building out of
72# a VCS-checkout (not a release) and src/b-emacs.exe does not exist.
73# This avoids building a bootstrap-emacs and recompiling Lisp files
74# when building a pretest/release tarball.
2a2ec649 75boot :=
291f6a31 76ifneq ($(wildcard admin/admin.el),)
2a2ec649
EZ
77ifeq ($(wildcard src/b-emacs.exe),)
78boot := b-emacs.exe
79endif
291f6a31 80endif
2a2ec649
EZ
81
82# Subdirectories to run Make. `lisp' is not included because the
83# compiled lisp files are part of the distribution. (If we are
84# bootstrapping, the src target will run Make in `lisp' as well.)
85# leim is not included because it is part of the src target.
0c123bd1 86all: lib-src src emacs misc lispref lispintro
2d0300ef
RS
87
88lib-src: FRC
89 cd lib-src
de219b90 90 $(MAKE) top_srcdir=${top_srcdir} version=${version}
2d0300ef
RS
91 cd ..
92
2a2ec649
EZ
93# Pass to src/Makefile.in an additional BOOTSTRAPEMACS variable which
94# is either set to b-emacs.exe (in case bootstrap-emacs has not been
95# constructed yet) or the empty string (otherwise).
96# src/Makefile.in uses it to implement conditional dependencies, so that
97# files that need bootstrap-emacs to be built do not additionally need
98# to be kept fresher than b-emacs.exe. Otherwise changing a single
99# file src/foo.c forces dumping a new bootstrap-emacs, then re-byte-compiling
100# all preloaded elisp files, and only then dump the actual src/emacs, which
101# is not wrong, but is overkill in 99.99% of the cases.
2d0300ef
RS
102src: FRC
103 cd src
2a2ec649 104 $(MAKE) top_srcdir=${top_srcdir} BOOTSTRAPEMACS="${boot}"
a9530035
EZ
105 djecho -s '/-geometry/s,^.*,set environment HOME $(top_srcdir),' \
106 '/environment *TERM/s/^.*/set environment TERM internal/' \
dfec8622 107 >gdb.sed
a9530035 108 sed -f gdb.sed _gdbinit >gdb.tmp
efb29aff 109 djecho -a gdb.tmp -s 'set environment USER root' \
dfec8622
EZ
110 'set environment NAME root' \
111 'set environment USERNAME root' \
efb29aff
EZ
112 'set environment EMACSPATH $(top_srcdir)/bin' \
113 'set environment SHELL $(subst \,/,$(COMSPEC))' \
114 'set environment PATH $(subst \,/,$(PATH))'
2d0300ef 115 update gdb.tmp gdb.ini
d04127d3 116 rm -f gdb.tmp gdb.sed
2d0300ef 117 cd ..
2a2ec649 118 if exist src\bootlisp redir $(MAKE) -C lisp top_srcdir=${top_srcdir}
aae2a498 119 rm -f src/bootlisp
0ccc59eb 120 if exist leim\Makefile redir $(MAKE) -C leim top_srcdir=${top_srcdir}
2d0300ef 121
0c123bd1 122info: emacs misc lispref lispintro
2a2ec649 123
0c123bd1 124emacs misc lispref lispintro: FRC
d945fac6 125 cd doc/$@
ca39f6c1 126 $(MAKE) top_srcdir=${top_srcdir} info
d945fac6 127 cd ../..
9830885f 128
2d0300ef 129install: all
9830885f 130 if not exist bin\nul md bin
2d0300ef 131 cd lib-src
3fb78d1f 132 command.com /c >/dev/null for %p in (hexl etags ctags ebrowse) do\
a9530035 133 if exist %p.exe mv -f %p.exe ../bin
b712940a 134 if exist fns.el update fns.el ../bin/fns.el
2d0300ef
RS
135 cd ..
136 cd src
2d0300ef
RS
137 mv -f emacs.exe ../bin/
138 cd ..
fc406406
EZ
139 djecho -s "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)" \
140 " (normal-top-level-add-subdirs-to-load-path))" \
141 > ./subdirs.el
142 if not exist .\site-lisp\subdirs.el \
143 update ./subdirs.el ./site-lisp/subdirs.el
144 rm -f ./subdirs.el
2d0300ef
RS
145
146FRC:
147
838b9528
EZ
148# We cannot use [a-zA-Z]* like the mainline distribution does, because
149# that causes all file names to be returned in upper-case on DOS...
644d0594
EZ
150# Must use `find' to filter out loaddefs files; ignore errors if `find'
151# is not available or is an MS `find'.
152# The "cd $(CURDIR)" gork is for when `find' fails and leaves us inside
153# `lisp' or one of its subdirectories.
53f7e7ad
RS
154TAGS tags: lib-src FRC
155 cd lib-src
156 if exist etags.exe mv -f etags.exe ../bin
157 cd ..
644d0594
EZ
158 - find $(CURDIR)/lisp -iname "*.el" -a -! -( -iname "*loaddefs.el" -o -iname "ldefs-boot.el" -) | ./bin/etags -o lisp/TAGS -
159 cd $(CURDIR)
2d0300ef
RS
160 cd src
161 ../bin/etags --include=../lisp/TAGS \
644d0594
EZ
162 --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \
163 $(CURDIR)/src/*.c $(CURDIR)/src/*.h \
164 $(CURDIR)/src/s/msdos.h $(CURDIR)/src/m/intel386.h
2d0300ef
RS
165 cd ..
166 ./bin/etags --include=src/TAGS
167
168check:
169 @echo "We don't have any tests for GNU Emacs yet."
170
406865b8 171clean mostlyclean:
2d0300ef 172 cd lib-src
406865b8 173 $(MAKE) $(MFLAGS) $@
2d0300ef
RS
174 cd ..
175 cd src
406865b8 176 $(MAKE) $(MFLAGS) $@
2d0300ef 177 cd ..
d945fac6
EZ
178 cd doc
179 cd emacs
180 -$(MAKE) $(MFLAGS) $@
181 cd ..
182 cd misc
406865b8
EZ
183 -$(MAKE) $(MFLAGS) $@
184 cd ..
185 cd lispref
186 -$(MAKE) $(MFLAGS) $@
187 cd ..
188 cd lispintro
189 -$(MAKE) $(MFLAGS) $@
2d0300ef 190 cd ..
d945fac6 191 cd ..
0ccc59eb 192 cd leim
406865b8 193 if exist Makefile redir $(MAKE) $(MFLAGS) $@
0ccc59eb 194 cd ..
f72a0a4a 195
406865b8
EZ
196top_distclean=rm -f Makefile */Makefile src/_gdbinit
197
198distclean maintainer-clean: FRC
199 cd src
200 $(MAKE) $(MFLAGS) $@
2a2ec649 201 if exist bootlisp rm -f bootlisp
406865b8
EZ
202 cd ..
203 cd lib-src
204 $(MAKE) $(MFLAGS) $@
205 cd ..
d945fac6
EZ
206 cd doc
207 cd emacs
208 -$(MAKE) $(MFLAGS) $@
209 cd ..
210 cd misc
406865b8
EZ
211 -$(MAKE) $(MFLAGS) $@
212 cd ..
213 cd lispref
214 -$(MAKE) $(MFLAGS) $@
215 cd ..
216 cd lispintro
217 -$(MAKE) $(MFLAGS) $@
218 cd ..
d945fac6 219 cd ..
406865b8
EZ
220 cd leim
221 if exist Makefile redir $(MAKE) $(MFLAGS) $@
222 cd ..
223 cd lisp
224 $(MAKE) $(MFLAGS) $@
225 cd ..
226 ${top_distclean}
227
228extraclean:
229 cd src
230 $(MAKE) $(MFLAGS) $@
231 cd ..
406865b8
EZ
232 cd lib-src
233 $(MAKE) $(MFLAGS) $@
234 cd ..
d945fac6
EZ
235 cd doc
236 cd emacs
237 -$(MAKE) $(MFLAGS) $@
238 cd ..
239 cd misc
406865b8
EZ
240 -$(MAKE) $(MFLAGS) $@
241 cd ..
242 cd lispref
243 -$(MAKE) $(MFLAGS) $@
244 cd ..
245 cd lispintro
246 -$(MAKE) $(MFLAGS) $@
247 cd ..
d945fac6 248 cd ..
406865b8
EZ
249 cd leim
250 if exist Makefile redir $(MAKE) $(MFLAGS) $@
251 cd ..
252 cd lisp
253 $(MAKE) $(MFLAGS) $@
254 cd ..
255 ${top_distclean}
256 -rm -f *~ #*
257
2a2ec649 258.PHONY: bootstrap
f72a0a4a 259
2a2ec649
EZ
260bootstrap-clean: FRC
261 cd src
262 $(MAKE) $(MFLAGS) $@
263 cd ..
264 cd lib-src
265 $(MAKE) $(MFLAGS) maintainer-clean
266 cd ..
267 cd doc
268 cd emacs
269 -$(MAKE) $(MFLAGS) maintainer-clean
270 cd ../misc
271 -$(MAKE) $(MFLAGS) maintainer-clean
272 cd ../lispref
273 -$(MAKE) $(MFLAGS) maintainer-clean
274 cd ../lispintro
275 -$(MAKE) $(MFLAGS) maintainer-clean
276 cd ..
277 cd ..
278 cd leim
279 $(MAKE) $(MFLAGS) maintainer-clean
280 cd ..
281 cd lisp
282 $(MAKE) $(MFLAGS) bootstrap-clean
283 cd ..
284 ${top_bootclean}
f72a0a4a 285
2a2ec649 286bootstrap: bootstrap-clean FRC
66205aea 287 command.com /e:2048 /c config msdos
2a2ec649 288 $(MAKE) $(MFLAGS) info all
ab5796a9 289