# Top-level Makefile for Emacs under MS-DOS/DJGPP v2.0 or higher. -*-makefile-*-
-# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+# Copyright (C) 1996,1997,1998,1999,2000,2001,2002
+# Free Software Foundation, Inc.
# This file is part of GNU Emacs.
# Find out which version of Emacs this is.
version := ${shell sed -n -e '/(defconst emacs-version/s/^[^"]*\("[^"]*"\).*/\1/p' lisp/version.el}
-all: lib-src src man lispref lispintro
+all: maybe_bootstrap lib-src src man lispref lispintro
lib-src: FRC
cd lib-src
cd leim
if exist Makefile redir $(MAKE) clean
cd ..
+
+.PHONY: bootstrap bootstrap-lisp-1 boostrap-src bootstrap-lisp bootstrap-clean
+.PHONY: maybe_bootstrap
+
+maybe_bootstrap:
+ @if not exist lisp\abbrev.elc djecho \
+ "Some *.elc files are missing. You should do a `make bootstrap'."
+ @if not exist lisp\abbrev.elc redir -e /dev/null -oe redir fail-this-make.exe
+
+bootstrap: bootstrap-clean-before bootstrap-lisp-1 bootstrap-src bootstrap-lisp bootstrap-clean-after all info
+
+bootstrap-lisp-1:
+ cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean; cd ..
+
+bootstrap-lisp:
+ cd lisp; $(MAKE) $(MFLAGS) bootstrap EMACS=${top_srcdir}/src/b-emacs.exe lisp=${top_srcdir}/lisp; cd ..
+
+bootstrap-src:
+ cd src; $(MAKE) $(MFLAGS) bootstrap; cd ..
+
+### Used for `bootstrap' to avoid deleting existing dumped Emacs executables.
+bootstrap-clean-before: FRC
+ cd src; $(MAKE) $(MFLAGS) mostlyclean; cd ..
+ cd lib-src; $(MAKE) $(MFLAGS) clean; cd ..
+ cd leim; $(MAKE) $(MFLAGS) clean; cd ..
+
+bootstrap-clean-after:
+ cd src; $(MAKE) $(MFLAGS) mostlyclean; cd ..