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