Mercurial > emacs
changeset 96137:eae2eee28ad3
Make "make" do a bootstrap if needed.
* src/Makefile.in (emacs${EXEEXT}): Link the new emacs to bootstrap-emacs.
(bootstrapclean): Remove.
(.el.elc): New rule.
(PRECOMP): New var.
(../lisp/subdirs.el): Remove.
(bootstrap-emacs${EXEEXT}): Remove subdirs.el and charpro.el dependency.
(witness-emacs): New target.
(mostlyclean): Remove witness-emacs as well.
(../lisp/loaddefs.el, ${lisp} ${SOME_MACHINE_LISP}):
Add witness-emacs dependency.
* lisp/loadup.el: Don't add emacs-<VERS> name when bootstrapping.
* lisp/Makefile.in (emacs-deps): Remove.
($(lisp)/cus-load.el, $(lisp)/finder-inf.el): Re-add.
(all): Use them.
(autogen-clean): Remove.
* Makefile.in (maybe_bootstrap, src/bootstrap-emacs${EXEEXT})
(bootstrap-build): Remove.
(top_bootclean): New var.
(top_distclean, bootstrap-clean): Use it.
(bootstrap): Don't recheck config. Make normally.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 21 Jun 2008 01:38:39 +0000 |
parents | 73e422173a87 |
children | 41be5bc2426e |
files | ChangeLog Makefile.in lisp/ChangeLog lisp/Makefile.in lisp/loadup.el src/ChangeLog src/Makefile.in |
diffstat | 7 files changed, 116 insertions(+), 86 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jun 20 23:27:07 2008 +0000 +++ b/ChangeLog Sat Jun 21 01:38:39 2008 +0000 @@ -1,3 +1,11 @@ +2008-06-21 Stefan Monnier <monnier@iro.umontreal.ca> + + * Makefile.in (maybe_bootstrap, src/bootstrap-emacs${EXEEXT}) + (bootstrap-build): Remove. + (top_bootclean): New var. + (top_distclean, bootstrap-clean): Use it. + (bootstrap): Don't recheck config. Make normally. + 2008-06-20 Stefan Monnier <monnier@iro.umontreal.ca> * Makefile.in (SUBDIR): Include `lisp'.
--- a/Makefile.in Fri Jun 20 23:27:07 2008 +0000 +++ b/Makefile.in Sat Jun 21 01:38:39 2008 +0000 @@ -54,8 +54,8 @@ # Still more severe - delete backup and autosave files, too. # # make bootstrap -# Recompiles all the Emacs Lisp files using the latest source, -# then rebuilds Emacs. +# Removes all the compiled files to force a new bootstrap from a +# clean slate, and then build in the normal way. SHELL = /bin/sh @@ -315,7 +315,7 @@ # We need to build `emacs' in `src' to compile the *.elc files in `lisp'. lisp: src -${SUBDIR}: maybe_bootstrap ${SUBDIR_MAKEFILES} FRC +${SUBDIR}: ${SUBDIR_MAKEFILES} FRC cd $@; $(MAKE) all $(MFLAGS) \ CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' @@ -706,6 +706,11 @@ -(cd doc/lispintro && $(MAKE) $(MFLAGS) clean) (cd leim; $(MAKE) $(MFLAGS) clean) +### `bootclean' +### Delete all files that need to be remade for a clean bootstrap. +top_bootclean=\ + rm -f config.cache config.log ; \ + if [ -d lock ] ; then (cd lock && (rm -f * || true)); else true; fi ### `distclean' ### Delete all files from the current directory that are created by ### configuring or building the program. If you have unpacked the @@ -713,9 +718,8 @@ ### `make distclean' should leave only the files that were in the ### distribution. top_distclean=\ - rm -f config.cache config.log ; \ - rm -f Makefile ${SUBDIR_MAKEFILES} ; \ - if [ -d lock ] ; then (cd lock && (rm -f * || true)); else true; fi + ${top_bootclean}; \ + rm -f config.status Makefile ${SUBDIR_MAKEFILES} distclean: FRC (cd src; $(MAKE) $(MFLAGS) distclean) (cd oldXMenu; $(MAKE) $(MFLAGS) distclean) @@ -742,8 +746,8 @@ -(cd doc/lispref && $(MAKE) $(MFLAGS) maintainer-clean) -(cd doc/lispintro && $(MAKE) $(MFLAGS) maintainer-clean) (cd leim; $(MAKE) $(MFLAGS) maintainer-clean) - (cd lisp; $(MAKE) $(MFLAGS) maintainer-clean) - ${top_distclean} + (cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean) + ${top_bootclean} ### `maintainer-clean' ### Delete everything from the current directory that can be @@ -756,9 +760,10 @@ ### Makefile. More generally, `make maintainer-clean' should not delete ### anything that needs to exist in order to run `configure' and then ### begin to build the program. -maintainer-clean: bootstrap-clean +maintainer-clean: bootstrap-clean FRC (cd src; $(MAKE) $(MFLAGS) maintainer-clean) - -rm -f config.status + (cd lisp; $(MAKE) $(MFLAGS) maintainer-clean) + ${top_distclean} ### This doesn't actually appear in the coding standards, but Karl ### says GCC supports it, and that's where the configuration part of @@ -829,41 +834,17 @@ #### Bootstrapping. ### This first cleans the lisp subdirectory, removing all compiled -### Lisp files. Then a special emacs executable is built from Lisp -### sources, which is then used to compile Lisp files. The last step -### is a "normal" make. +### Lisp files. Then re-run make to build all the files anew. .PHONY: bootstrap -.PHONY: bootstrap-build -.PHONY: maybe_bootstrap - -maybe_bootstrap: - @bar="`echo $(srcdir)/lisp/*.elc`"; \ - if [ \( "$$bar" = '$(srcdir)/lisp/*.elc' \) -o \( "$$bar" = '' \) ]; then \ - echo "Your tree does not include the compiled Lisp files."; \ - echo "You need to do \`make bootstrap' to build Emacs."; \ - exit 1;\ - fi bootstrap: bootstrap-clean FRC if [ -x ./config.status ]; then \ - ./config.status --recheck; \ ./config.status; \ else \ ./configure --enable-maintainer-mode; \ fi - $(MAKE) $(MFLAGS) info bootstrap-build - -src/bootstrap-emacs${EXEEXT}: - (cd src; $(MAKE) $(MFLAGS) bootstrap-emacs${EXEEXT}) - -## There used to be a src; mostlyclean before all, but it does not -## seem to serve any purpose, and compiles things twice. -## http://lists.gnu.org/archive/html/emacs-devel/2008-06/msg00104.html -bootstrap-build: src/bootstrap-emacs$(EXEEXT) FRC - (cd lisp; $(MAKE) $(MFLAGS) bootstrap EMACS=../src/bootstrap-emacs${EXEEXT}) - $(MAKE) $(MFLAGS) all - (cd lisp; $(MAKE) $(MFLAGS) bootstrap-after) + $(MAKE) $(MFLAGS) info all .PHONY: check-declare
--- a/lisp/ChangeLog Fri Jun 20 23:27:07 2008 +0000 +++ b/lisp/ChangeLog Sat Jun 21 01:38:39 2008 +0000 @@ -1,3 +1,12 @@ +2008-06-21 Stefan Monnier <monnier@iro.umontreal.ca> + + * loadup.el: Don't add emacs-<VERS> name when bootstrapping. + + * Makefile.in (emacs-deps): Remove. + ($(lisp)/cus-load.el, $(lisp)/finder-inf.el): Re-add. + (all): Use them. + (autogen-clean): Remove. + 2008-06-20 Stefan Monnier <monnier@iro.umontreal.ca> * Makefile.in (all): New target.
--- a/lisp/Makefile.in Fri Jun 20 23:27:07 2008 +0000 +++ b/lisp/Makefile.in Sat Jun 21 01:38:39 2008 +0000 @@ -77,8 +77,6 @@ # The actual Emacs command run in the targets below. emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT) -# Prerequisites for running $(emacs) -emacs-deps = $(lisp)/subdirs.el # Common command to find subdirectories @@ -100,7 +98,9 @@ # `compile-main' tends to be slower than `recompile' but can be parallelized # with "make -j" and results in more deterministic compilation warnings. -all: compile-main +# cus-load ans finder-inf are not explicitly requested by anything, so +# we add them here to make sure they get built. +all: compile-main $(lisp)/cus-load.el $(lisp)/finder-inf.el doit: @@ -117,27 +117,31 @@ # bootstrap-after would modify loaddefs after src/emacs, resulting # in make install remaking src/emacs for no real reason: # http://lists.gnu.org/archive/html/emacs-devel/2008-02/msg00311.html -custom-deps: $(emacs-deps) doit +$(lisp)/cus-load.el: + $(MAKE) $(MFLAGS) custom-deps +custom-deps: doit wd=$(lisp); $(setwins_almost); \ echo Directories: $$wins; \ $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins -finder-data: $(emacs-deps) doit +$(lisp)/finder-inf.el: + $(MAKE) $(MFLAGS) finder-data +finder-data: doit wd=$(lisp); $(setwins_almost); \ echo Directories: $$wins; \ $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins # The chmod +w is to handle env var CVSREAD=1. Files named # are identified by being the value of `generated-autoload-file'. -autoloads: $(emacs-deps) $(LOADDEFS) doit +autoloads: $(LOADDEFS) doit chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \ $(lisp)/emacs-lisp/cl-loaddefs.el wd=$(lisp); $(setwins_almost); \ echo Directories: $$wins; \ $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins -# Note: every rule that runs $(emacs) and is called during bootstrap must -# depend on this. +# This is required by the witness-emacs target in ../src/Makefile, so +# we know that if we have an emacs executable, we also have a subdirs.el. $(lisp)/subdirs.el: $(MAKE) $(MFLAGS) update-subdirs update-subdirs: doit @@ -1254,7 +1258,7 @@ .PHONY: compile-first compile-main compile-last compile compile-always -compile-first: $(emacs-deps) $(LOADDEFS) autoloads $(COMPILE_FIRST) +compile-first: $(LOADDEFS) autoloads $(COMPILE_FIRST) for el in $(COMPILE_FIRST); do \ echo Compiling $$el; \ $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el || exit 1; \ @@ -1268,7 +1272,7 @@ # Calling make recursively because suffix rule cannot have prerequisites. # Explicitly pass EMACS (sometimes ../src/bootstrap-emacs) to those # sub-makes that run rules that use it, for the sake of some non-GNU makes. -compile: $(emacs-deps) $(LOADDEFS) autoloads compile-first +compile: $(LOADDEFS) autoloads compile-first $(MAKE) $(MFLAGS) compile-main EMACS=$(EMACS) $(MAKE) $(MFLAGS) compile-last EMACS=$(EMACS) @@ -1349,7 +1353,7 @@ $(MH_E_DIR)/mh-xface.el mh-autoloads: $(MH_E_DIR)/mh-loaddefs.el -$(MH_E_DIR)/mh-loaddefs.el: $(emacs-deps) $(MH_E_SRC) +$(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC) $(emacs) -l autoload \ --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \ --eval "(setq generated-autoload-file \"$@\")" \ @@ -1371,21 +1375,21 @@ $(CAL_DIR)/holidays.el $(CAL_DIR)/lunar.el \ $(CAL_DIR)/solar.el -$(CAL_DIR)/cal-loaddefs.el: $(emacs-deps) $(CAL_SRC) +$(CAL_DIR)/cal-loaddefs.el: $(CAL_SRC) $(emacs) -l autoload \ --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \ --eval "(setq generated-autoload-file \"$@\")" \ --eval "(setq make-backup-files nil)" \ -f batch-update-autoloads $(CAL_DIR) -$(CAL_DIR)/diary-loaddefs.el: $(emacs-deps) $(CAL_SRC) +$(CAL_DIR)/diary-loaddefs.el: $(CAL_SRC) $(emacs) -l autoload \ --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \ --eval "(setq generated-autoload-file \"$@\")" \ --eval "(setq make-backup-files nil)" \ -f batch-update-autoloads $(CAL_DIR) -$(CAL_DIR)/hol-loaddefs.el: $(emacs-deps) $(CAL_SRC) +$(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC) $(emacs) -l autoload \ --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \ --eval "(setq generated-autoload-file \"$@\")" \ @@ -1405,25 +1409,12 @@ # local changes. (Because loaddefs.el is an automatically generated # file, we don't want to store it in the source repository). -autogen-clean: - cd $(lisp); rm -f $(AUTOGENEL) - -maintainer-clean: distclean bootstrap-clean - -bootstrap-clean: autogen-clean - cd $(lisp); rm -f *.elc */*.elc - -# Generate/update files for the bootstrap process. +bootstrap-clean: + cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL) -bootstrap: update-subdirs autoloads compile - -# Generate/update files after the bootstrap process. -# custom-deps needs `preloaded-file-list'. - -bootstrap-after: finder-data custom-deps - -distclean: +distclean: bootstrap-clean -rm -f ./Makefile +maintainer-clean: distclean .PHONY: check-declare
--- a/lisp/loadup.el Fri Jun 20 23:27:07 2008 +0000 +++ b/lisp/loadup.el Sat Jun 21 01:38:39 2008 +0000 @@ -343,14 +343,9 @@ (message "Dumping data as file temacs.dump") (dump-emacs "temacs.dump" "temacs") (kill-emacs)) - (let ((name (concat "emacs-" emacs-version))) - (while (string-match "[^-+_.a-zA-Z0-9]+" name) - (setq name (concat (downcase (substring name 0 (match-beginning 0))) - "-" - (substring name (match-end 0))))) - (if (memq system-type '(ms-dos windows-nt cygwin)) - (message "Dumping under the name emacs") - (message "Dumping under names emacs and %s" name))) + (if (memq system-type '(ms-dos windows-nt cygwin)) + (message "Dumping under the name emacs") + (message "Dumping under the name emacs")) (condition-case () (delete-file "emacs") (file-error nil)) @@ -361,12 +356,17 @@ (dump-emacs "emacs" "temacs") (message "%d pure bytes used" pure-bytes-used) ;; Recompute NAME now, so that it isn't set when we dump. - (if (not (memq system-type '(ms-dos windows-nt cygwin))) + (if (not (or (memq system-type '(ms-dos windows-nt cygwin)) + ;; Don't bother adding another name if we're just + ;; building bootstrap-emacs. + (equal (nth 3 command-line-args) "bootstrap") + (equal (nth 4 command-line-args) "bootstrap"))) (let ((name (concat "emacs-" emacs-version))) (while (string-match "[^-+_.a-zA-Z0-9]+" name) (setq name (concat (downcase (substring name 0 (match-beginning 0))) "-" (substring name (match-end 0))))) + (message "Adding name %s" name) (add-name-to-file "emacs" name t))) (kill-emacs)))
--- a/src/ChangeLog Fri Jun 20 23:27:07 2008 +0000 +++ b/src/ChangeLog Sat Jun 21 01:38:39 2008 +0000 @@ -1,3 +1,16 @@ +2008-06-21 Stefan Monnier <monnier@iro.umontreal.ca> + + * Makefile.in (emacs${EXEEXT}): Link the new emacs to bootstrap-emacs. + (bootstrapclean): Remove. + (.el.elc): New rule. + (PRECOMP): New var. + (../lisp/subdirs.el): Remove. + (bootstrap-emacs${EXEEXT}): Remove subdirs.el and charpro.el dependency. + (witness-emacs): New target. + (mostlyclean): Remove witness-emacs as well. + (../lisp/loaddefs.el, ${lisp} ${SOME_MACHINE_LISP}): + Add witness-emacs dependency. + 2008-06-20 Chong Yidong <cyd@stupidchicken.com> * font.c (Ffont_face_attributes): Omit key-attribute pairs not
--- a/src/Makefile.in Fri Jun 20 23:27:07 2008 +0000 +++ b/src/Makefile.in Sat Jun 21 01:38:39 2008 +0000 @@ -912,6 +912,9 @@ ln temacs${EXEEXT} emacs${EXEEXT} #else LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump + @: This new Emacs is as functional and more efficient then + @: bootstrap-emacs, so let us replace it. + -ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT} #endif /* ! defined (CANNOT_DUMP) */ -./emacs -q -batch -f list-load-path-shadows @@ -1268,12 +1271,10 @@ cd ${emacsapp}Contents/MacOS/; cp ../../../../src/emacs${EXEEXT} Emacs${EXEEXT} #endif -bootstrapclean: - rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT} mostlyclean: rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a rm -f ../etc/DOC - rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT} + rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT} witness-emacs rm -f buildobj.lst clean: mostlyclean rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT} @@ -1319,22 +1320,49 @@ /* Bootstrapping. */ - -bootstrap: bootstrap-emacs${EXEEXT} +/* Bootstrapping right is difficult because of the circular dependencies. + Furthermore, we have to deal with the fact that many compilation targets + such as loaddefs.el or *.elc can typically be produced by any old + Emacs executable, so we would like to avoid rebuilding them whenever + we build a new Emacs executable. + To solve the circularity, we use 2 different Emacs executables, + "emacs" is the main target and "bootstrap-emacs" is the one used + to build the *.elc and loaddefs.el files. + To solve the freshness issue, we use a third file "witness-emacs" + which is used to witness the fact that there is a bootstrap-emacs + executable. */ -../lisp/subdirs.el: - cd $(lispsource); $(MAKE) update-subdirs +/* These suffix rules do not allow additional dependencies, sadly, so + adding a bootstrap-emacs%{EXEEXT} dependency does not work --Stef */ +.el.elc: + cd ${lispsource}; $(MAKE) $(MFLAGS) $@ EMACS=../src/bootstrap-emacs${EXEEXT} + +/* Files that need to be compiled early to speed up further compilation. */ +PRECOMP=../lisp/emacs-lisp/bytecomp.elc ../lisp/emacs-lisp/byte-opt.elc +${PRECOMP}: witness-emacs -../lisp/loaddefs.el: bootstrap-emacs${EXEEXT} - cd $(lispsource); $(MAKE) autoloads EMACS=../src/bootstrap-emacs${EXEEXT} +/* Since the .el.elc rule cannot specify an extra dependency, we do it here. + The byte-compiler dependency is not necessary, but it substantially + speeds up byte-compilation of the other files. + Of course, it also has the downside of forcing a recompilation of all + those files whenever a file in $PRECOMP changes. */ +${lisp} ${SOME_MACHINE_LISP}: witness-emacs ${PRECOMP} + +../lisp/loaddefs.el: witness-emacs + cd $(lispsource); $(MAKE) $(MFLAGS) autoloads EMACS=../src/bootstrap-emacs${EXEEXT} /* Dump an Emacs executable named bootstrap-emacs containing the files from loadup.el in source form. */ -bootstrap-emacs${EXEEXT}: temacs${EXEEXT} ${lispsource}international/charprop.el ../lisp/subdirs.el +bootstrap-emacs${EXEEXT}: temacs${EXEEXT} #ifdef CANNOT_DUMP ln temacs${EXEEXT} bootstrap-emacs${EXEEXT} #else $(RUN_TEMACS) --batch --load loadup bootstrap mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT} #endif /* ! defined (CANNOT_DUMP) */ + +witness-emacs: + cd $(lispsource); $(MAKE) $(MFLAGS) update-subdirs + $(MAKE) $(MFLAGS) bootstrap-emacs${EXEEXT} + touch witness-emacs