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