Update copyright year to 2014 by running admin/update-copyright.
[emacs.git] / msdos / mainmake.v2
blob2cc71bbf3700716f70c2d8d75b62d73d6b048eb0
1 # Top-level Makefile for Emacs under MS-DOS/DJGPP v2.0 or higher. -*-makefile-*-
3 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
5 # This file is part of GNU Emacs.
7 # GNU Emacs is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
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.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
20 # make all      to compile and build Emacs.
21 # make install  to install it (installs in-place, in `bin' subdir of top dir).
22 # make TAGS     to update tags tables.
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.
31 #      Delete `.dvi' files here if they are not part of the distribution.
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.
40 # make maintainer-clean
41 #      Delete everything from the current directory that can be
42 #      reconstructed with this Makefile.  This typically includes
43 #      everything deleted by distclean, plus more: *.elc files,
44 #      C source files produced by Bison, tags tables, info files,
45 #      and so on.
47 # make extraclean
48 #      Still more severe - delete backup and autosave files, too.
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.
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.)
60 SHELL=/xyzzy/command
61 MAKESHELL=/xyzzy/command
63 # Generate a full pathname of the top-level installation directory
64 top_srcdir := $(subst \,/,$(shell cd))
66 # Q: Do we need to bootstrap?
67 # A: Only if we find msdos/autogen/Makefile.in, i.e. we are building out of
68 #    a VCS-checkout (not a release), and src/b-emacs.exe does not exist.
69 #    This avoids building a bootstrap-emacs and recompiling Lisp files
70 #    when building a pretest/release tarball.  Recompiling Lisp files
71 #    is BAD because lisp/Makefile.in requires a Unixy shell.
72 boot :=
73 ifneq ($(wildcard msdos/autogen/Makefile.in),)
74 ifeq ($(wildcard src/b-emacs.exe),)
75 boot := b-emacs.exe
76 endif
77 endif
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.
83 all:    lib lib-src src emacs misc lispref lispintro
85 lib: FRC
86         cd lib
87         $(MAKE) top_srcdir=${top_srcdir} all
88         cd ..
90 lib-src: lib FRC
91         cd lib-src
92         $(MAKE) top_srcdir=${top_srcdir} all
93         cd ..
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.
104 src: lib lib-src FRC
105         cd src
106         $(MAKE) top_srcdir=${top_srcdir} BOOTSTRAPEMACS="${boot}" all
107         djecho -s '/-geometry/s,^.*,set environment HOME $(top_srcdir),' \
108                   '/environment *TERM/s/^.*/set environment TERM internal/' \
109                >gdb.sed
110         sed -f gdb.sed _gdbinit >gdb.tmp
111         djecho -a gdb.tmp -s 'set environment USER root' \
112                              'set environment NAME root' \
113                              'set environment USERNAME root' \
114                              'set environment EMACSPATH $(top_srcdir)/bin' \
115                              'set environment SHELL $(subst \,/,$(COMSPEC))' \
116                              'set environment PATH $(subst \,/,$(PATH))'
117         update gdb.tmp gdb.ini
118         rm -f gdb.tmp gdb.sed
119         cd ..
120         if exist src\bootlisp redir $(MAKE) -C lisp top_srcdir=${top_srcdir}
121         rm -f src/bootlisp
122         if exist leim\Makefile redir $(MAKE) -C leim top_srcdir=${top_srcdir}
124 info: emacs misc lispref lispintro
126 emacs misc lispref lispintro:   FRC
127         cd doc/$@
128         $(MAKE) top_srcdir=${top_srcdir} info
129         cd ../..
131 install: all
132         if not exist bin\nul md bin
133         cd lib-src
134         command.com /c >/dev/null for %p in (hexl etags ctags ebrowse) do\
135            if exist %p.exe mv -f %p.exe ../bin
136         cd ..
137         cd src
138         mv -f emacs.exe ../bin/
139         cd ..
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
147 FRC:
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...
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.
155 TAGS tags:      lib-src FRC
156         cd lib-src
157         if exist etags.exe mv -f etags.exe ../bin
158         cd ..
159         - find $(CURDIR)/lisp -iname "*.el" -a -! -( -iname "*loaddefs.el" -o -iname "ldefs-boot.el" -) | ./bin/etags -o lisp/TAGS -
160         cd $(CURDIR)
161         cd src
162         ../bin/etags --include=../lisp/TAGS \
163          --regex='/[    ]*DEFVAR_[A-Z_  (]+"\([^"]+\)"/' \
164          $(CURDIR)/src/*.c $(CURDIR)/src/*.h
165         cd ..
166         ./bin/etags --include=src/TAGS
168 check:
169         @echo "We don't have any tests for GNU Emacs yet."
171 clean mostlyclean:
172         cd lib
173         $(MAKE) $(MFLAGS) $@
174         cd ..
175         cd lib-src
176         $(MAKE) $(MFLAGS) $@
177         cd ..
178         cd src
179         $(MAKE) $(MFLAGS) $@
180         cd ..
181         cd doc
182         cd emacs
183         -$(MAKE) $(MFLAGS) $@
184         cd ..
185         cd misc
186         -$(MAKE) $(MFLAGS) $@
187         cd ..
188         cd lispref
189         -$(MAKE) $(MFLAGS) $@
190         cd ..
191         cd lispintro
192         -$(MAKE) $(MFLAGS) $@
193         cd ..
194         cd ..
195         cd leim
196         if exist Makefile redir $(MAKE) $(MFLAGS) $@
197         cd ..
199 top_distclean=rm -f Makefile */Makefile src/_gdbinit
201 distclean maintainer-clean: FRC
202         cd src
203         $(MAKE) $(MFLAGS) $@
204         if exist bootlisp rm -f bootlisp
205         cd ..
206         cd lib
207         $(MAKE) $(MFLAGS) $@
208         cd ..
209         cd lib-src
210         $(MAKE) $(MFLAGS) $@
211         cd ..
212         cd doc
213         cd emacs
214         -$(MAKE) $(MFLAGS) $@
215         cd ..
216         cd misc
217         -$(MAKE) $(MFLAGS) $@
218         cd ..
219         cd lispref
220         -$(MAKE) $(MFLAGS) $@
221         cd ..
222         cd lispintro
223         -$(MAKE) $(MFLAGS) $@
224         cd ..
225         cd ..
226         cd leim
227         if exist Makefile redir $(MAKE) $(MFLAGS) $@
228         cd ..
229         cd lisp
230         $(MAKE) $(MFLAGS) $@
231         cd ..
232         ${top_distclean}
234 extraclean:
235         cd src
236         $(MAKE) $(MFLAGS) $@
237         cd ..
238         cd lib
239         $(MAKE) $(MFLAGS) $@
240         cd ..
241         cd lib-src
242         $(MAKE) $(MFLAGS) $@
243         cd ..
244         cd doc
245         cd emacs
246         -$(MAKE) $(MFLAGS) $@
247         cd ..
248         cd misc
249         -$(MAKE) $(MFLAGS) $@
250         cd ..
251         cd lispref
252         -$(MAKE) $(MFLAGS) $@
253         cd ..
254         cd lispintro
255         -$(MAKE) $(MFLAGS) $@
256         cd ..
257         cd ..
258         cd leim
259         if exist Makefile redir $(MAKE) $(MFLAGS) $@
260         cd ..
261         cd lisp
262         $(MAKE) $(MFLAGS) $@
263         cd ..
264         ${top_distclean}
265         -rm -f *~ #*
267 .PHONY: bootstrap
269 bootstrap-clean: FRC
270         cd lib
271         -$(MAKE) $(MFLAGS) maintainer-clean
272         cd ..
273         cd src
274         $(MAKE) $(MFLAGS) $@
275         cd ..
276         cd lib-src
277         $(MAKE) $(MFLAGS) maintainer-clean
278         cd ..
279         cd doc
280         cd emacs
281         -$(MAKE) $(MFLAGS) maintainer-clean
282         cd ../misc
283         -$(MAKE) $(MFLAGS) maintainer-clean
284         cd ../lispref
285         -$(MAKE) $(MFLAGS) maintainer-clean
286         cd ../lispintro
287         -$(MAKE) $(MFLAGS) maintainer-clean
288         cd ..
289         cd ..
290         cd leim
291         $(MAKE) $(MFLAGS) maintainer-clean
292         cd ..
293         cd lisp
294         $(MAKE) $(MFLAGS) bootstrap-clean
295         cd ..
296         ${top_bootclean}
298 bootstrap: bootstrap-clean FRC
299         command.com /e:2048 /c config msdos
300         $(MAKE) $(MFLAGS) info all