EMACSOPT = -batch --no-site-file --multibyte
# Extra flags to pass to the byte compiler
-BYTE_COMPILE_EXTRA_FLAGS =
+BYTE_COMPILE_EXTRA_FLAGS =
# For example to not display the undefined function warnings you can use this:
# BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not unresolved)))'
# The example above is just for developers, it should not be used by default.
eshell/esh-groups.el
# Files to compile before others during a bootstrap. This is done to
-# speed up the bootstrap process. The CC files are compiled first
-# because CC mode tweaks the compilation process, and requiring
-# cc-mode when it is not compiled doesn't work during the
-# bootstrapping.
+# speed up the bootstrap process.
COMPILE_FIRST = \
- $(lisp)/emacs-lisp/byte-opt.el \
- $(lisp)/emacs-lisp/bytecomp.el \
- $(lisp)/subr.el \
- $(lisp)/progmodes/cc-mode.el \
- $(lisp)/progmodes/cc-vars.el
+ $(lisp)/emacs-lisp/bytecomp.elc \
+ $(lisp)/emacs-lisp/byte-opt.elc \
+ $(lisp)/emacs-lisp/autoload.elc
# 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
esac; \
done
+# `compile-main' tends to be slower than `recompile' but can be parallelized
+# with "make -j" and results in more deterministic compilation warnings.
+# cus-load and 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
+ @: Let us check that we byte-compiled all the files.
+ $(MAKE) $(MFLAGS) compile-last EMACS=$(EMACS)
+
doit:
# custom-deps and finder-data both used to scan _all_ the *.el files.
-# Now they avoid auto-generated files, which should avoid this
-# historical problem:
-# In parallel builds, they should not run at the same time as anything
-# else that might modify any .el files, eg autoloads (or each other).
+# This could lead to problems in parallel builds if automatically
+# generated *.el files (eg loaddefs etc) were being changed at the same time.
# One solution was to add autoloads as a prerequisite:
# http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-01/msg00469.html
# http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-12/msg00171.html
-# However, this means that running these targets modifies loaddefs.el,
+# However, this meant that running these targets modified loaddefs.el,
# every time (due to time-stamping). Calling these rules from
# 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
+# Nowadays these commands don't scan automatically generated files,
+# since they will never contain any useful information
+# (see finder-no-scan-regexp and custom-dependencies-no-scan-regexp).
+$(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 bootstrap-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
.PHONY: update-elclist
-## Post-bootstrap, find the list of .elc files, exclude the members
-## of COMPILE_FIRST, and use sed to update ELCFILES in Makefile.in.
+## Post-bootstrap, find the list of .elc files and use sed to update
+## ELCFILES in Makefile.in.
## Errors in the final sed are non-fatal, since they have no effect on
## building Emacs. chmod +w is for CVSREAD=1.
## "echo" is non-portable with regards to backslashes, eg between zsh
update-elclist:
echo "/^ELCFILES/,/^$$/c\\" > temp.sed
echo "ELCFILES =" | sed -e 's/$$/ \\\\\\/' >> temp.sed
- exclude=`echo $(COMPILE_FIRST) | sed -e 's, ,\\\\|,g' -e 's,\/,\\\\/,g'`; \
- LC_COLLATE=C ls $(lisp)/*.elc $(lisp)/*/*.elc | sed -e "/$$exclude/d" -e "s|^$(lisp)| \$$(lisp)|" -e 's/$$/ \\\\\\/' -e '$$ s/ \\\\//' >> temp.sed
+ LC_COLLATE=C ls $(lisp)/*.elc $(lisp)/*/*.elc | sed -e "s|^$(lisp)| \$$(lisp)|" -e 's/$$/ \\\\\\/' -e '$$ s/ \\\\//' >> temp.sed
echo "" >> temp.sed
-sed -f temp.sed $(lisp)/Makefile.in > temp-elcfiles || rm temp-elcfiles
rm temp.sed
$(lisp)/emacs-lisp/backquote.elc \
$(lisp)/emacs-lisp/benchmark.elc \
$(lisp)/emacs-lisp/bindat.elc \
+ $(lisp)/emacs-lisp/byte-opt.elc \
$(lisp)/emacs-lisp/byte-run.elc \
+ $(lisp)/emacs-lisp/bytecomp.elc \
$(lisp)/emacs-lisp/check-declare.elc \
$(lisp)/emacs-lisp/checkdoc.elc \
$(lisp)/emacs-lisp/cl-compat.elc \
$(lisp)/informat.elc \
$(lisp)/international/ccl.elc \
$(lisp)/international/characters.elc \
- $(lisp)/international/codepage.elc \
$(lisp)/international/encoded-kb.elc \
$(lisp)/international/fontset.elc \
$(lisp)/international/isearch-x.elc \
$(lisp)/international/robin.elc \
$(lisp)/international/titdic-cnv.elc \
$(lisp)/international/utf-7.elc \
- $(lisp)/isearch-multi.elc \
$(lisp)/isearch.elc \
$(lisp)/isearchb.elc \
$(lisp)/iswitchb.elc \
$(lisp)/mail/mailpost.elc \
$(lisp)/mail/metamail.elc \
$(lisp)/mail/mspools.elc \
+ $(lisp)/mail/pmail.elc \
+ $(lisp)/mail/pmaildesc.elc \
+ $(lisp)/mail/pmailedit.elc \
+ $(lisp)/mail/pmailhdr.elc \
+ $(lisp)/mail/pmailkwd.elc \
+ $(lisp)/mail/pmailmm.elc \
+ $(lisp)/mail/pmailmsc.elc \
+ $(lisp)/mail/pmailout.elc \
+ $(lisp)/mail/pmailsort.elc \
+ $(lisp)/mail/pmailsum.elc \
$(lisp)/mail/reporter.elc \
$(lisp)/mail/rfc2368.elc \
$(lisp)/mail/rfc822.elc \
$(lisp)/minibuf-eldef.elc \
$(lisp)/minibuffer.elc \
$(lisp)/misc.elc \
+ $(lisp)/misearch.elc \
$(lisp)/mouse-copy.elc \
$(lisp)/mouse-drag.elc \
$(lisp)/mouse-sel.elc \
$(lisp)/net/hmac-md5.elc \
$(lisp)/net/imap.elc \
$(lisp)/net/ldap.elc \
+ $(lisp)/net/mairix.elc \
$(lisp)/net/net-utils.elc \
$(lisp)/net/netrc.elc \
$(lisp)/net/newst-backend.elc \
$(lisp)/net/tramp.elc \
$(lisp)/net/trampver.elc \
$(lisp)/net/webjump.elc \
+ $(lisp)/net/xesam.elc \
$(lisp)/net/zeroconf.elc \
$(lisp)/newcomment.elc \
$(lisp)/novice.elc \
$(lisp)/obsolete/lazy-lock.elc \
$(lisp)/obsolete/old-whitespace.elc \
$(lisp)/obsolete/options.elc \
+ $(lisp)/obsolete/resume.elc \
$(lisp)/obsolete/rnews.elc \
$(lisp)/obsolete/rnewspost.elc \
$(lisp)/obsolete/sc.elc \
$(lisp)/obsolete/x-menu.elc \
$(lisp)/org/org-agenda.elc \
$(lisp)/org/org-archive.elc \
+ $(lisp)/org/org-attach.elc \
$(lisp)/org/org-bbdb.elc \
$(lisp)/org/org-bibtex.elc \
$(lisp)/org/org-clock.elc \
$(lisp)/org/org-export-latex.elc \
$(lisp)/org/org-faces.elc \
$(lisp)/org/org-gnus.elc \
+ $(lisp)/org/org-id.elc \
$(lisp)/org/org-info.elc \
+ $(lisp)/org/org-install.elc \
$(lisp)/org/org-irc.elc \
$(lisp)/org/org-jsinfo.elc \
+ $(lisp)/org/org-list.elc \
$(lisp)/org/org-mac-message.elc \
$(lisp)/org/org-macs.elc \
$(lisp)/org/org-mew.elc \
$(lisp)/org/org-mhe.elc \
$(lisp)/org/org-mouse.elc \
+ $(lisp)/org/org-plot.elc \
$(lisp)/org/org-publish.elc \
$(lisp)/org/org-remember.elc \
$(lisp)/org/org-rmail.elc \
$(lisp)/progmodes/cc-fonts.elc \
$(lisp)/progmodes/cc-langs.elc \
$(lisp)/progmodes/cc-menus.elc \
+ $(lisp)/progmodes/cc-mode.elc \
$(lisp)/progmodes/cc-styles.elc \
$(lisp)/progmodes/cc-subword.elc \
+ $(lisp)/progmodes/cc-vars.elc \
$(lisp)/progmodes/cfengine.elc \
$(lisp)/progmodes/cmacexp.elc \
$(lisp)/progmodes/compile.elc \
$(lisp)/repeat.elc \
$(lisp)/replace.elc \
$(lisp)/reposition.elc \
- $(lisp)/resume.elc \
$(lisp)/reveal.elc \
$(lisp)/rfn-eshadow.elc \
$(lisp)/rot13.elc \
$(lisp)/speedbar.elc \
$(lisp)/startup.elc \
$(lisp)/strokes.elc \
+ $(lisp)/subr.elc \
$(lisp)/t-mouse.elc \
$(lisp)/tabify.elc \
$(lisp)/talk.elc \
$(lisp)/tar-mode.elc \
$(lisp)/tempo.elc \
$(lisp)/term.elc \
- $(lisp)/term/mac-win.elc \
+ $(lisp)/term/common-win.elc \
+ $(lisp)/term/internal.elc \
+ $(lisp)/term/ns-win.elc \
$(lisp)/term/pc-win.elc \
$(lisp)/term/rxvt.elc \
$(lisp)/term/sun.elc \
$(lisp)/textmodes/reftex-vars.elc \
$(lisp)/textmodes/reftex.elc \
$(lisp)/textmodes/remember.elc \
+ $(lisp)/textmodes/rst.elc \
$(lisp)/textmodes/sgml-mode.elc \
$(lisp)/textmodes/spell.elc \
$(lisp)/textmodes/table.elc \
$(lisp)/url/url-util.elc \
$(lisp)/url/url-vars.elc \
$(lisp)/url/url.elc \
- $(lisp)/url/vc-dav.elc \
$(lisp)/userlock.elc \
+ $(lisp)/vc-annotate.elc \
$(lisp)/vc-arch.elc \
$(lisp)/vc-bzr.elc \
$(lisp)/vc-cvs.elc \
+ $(lisp)/vc-dav.elc \
+ $(lisp)/vc-dir.elc \
$(lisp)/vc-dispatcher.elc \
$(lisp)/vc-git.elc \
$(lisp)/vc-hg.elc \
$(lisp)/xml.elc \
$(lisp)/xt-mouse.elc
+# The src/Makefile.in has its own set of dependencies and when they decide
+# that one Lisp file needs to be re-compiled, we had better recompile it as
+# well, otherwise every subsequent make will again call us, until we finally
+# end up deciding that yes, the file deserves recompilation.
+# One option is to try and reproduce exactly the same dependencies here as
+# we have in src/Makefile.in, but it turns out to be painful
+# (e.g. src/Makefile.in may have a dependency for ../lisp/foo.elc where we
+# only know of $(lisp)/foo.elc). So instead we provide a direct way for
+# src/Makefile.in to rebuild a particular Lisp file, no questions asked.
+compile-onefile:
+ @echo Compiling $(THEFILE)
+ @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(THEFILE)
+
# Files MUST be compiled one by one. If we compile several files in a
# row (i.e., in the same instance of Emacs) we can't make sure that
# the compilation environment is clean. We also set the load-path of
.PHONY: compile-first compile-main compile-last compile compile-always
-compile-first: $(emacs-deps) $(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; \
- done
+compile-first: $(COMPILE_FIRST)
compile-main: $(ELCFILES)
# 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)
$(MAKE) $(MFLAGS) compile EMACS=$(EMACS)
## In case any files are missing from ELCFILES.
+## Why is the UnicodeData check needed, when these files are no-byte-compile?
compile-last:
@wd=$(lisp); $(setwins); \
els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
- for el in $(COMPILE_FIRST) $$els; do \
+ for el in $$els; do \
test -f $$el || continue; \
test -f $${el}c && continue; \
grep 'no-byte-compile: t' $$el > /dev/null && continue; \
+ head -n 1 $$el | grep '^;; Automatically generated from UnicodeData.txt.' > /dev/null && continue; \
sel=`echo $$el | sed "s|^$(lisp)|\\$$(lisp)|"`; \
echo "Maintainer warning: $$sel missing from \$$ELCFILES?"; \
echo "Compiling $$el"; \
# Recompile all Lisp files which are newer than their .elc files and compile
# new ones.
-# FIXME this could use the 'compile' target now, and let make figure out
-# what needs to be done. That would be parallelizable, but would not
-# pick up new files not in ELCFILES.
+# This has the same effect as compile-main (followed up with compile-last,
+# if ELCFILES is out of date). recompile has some advantages:
+# i) It is faster (on a single processor), since it only has to start
+# Emacs once. It was 33% faster on a test with a random 10% of the .el
+# files needing recompilation.
+# ii) The explicit cc-mode dependency.
+# recompile's disadvantages are:
+# i) Not parallelizable.
+# ii) Compiling multiple files in the same instance of Emacs is wrong,
+# since the environment of later files is affected by definitions in
+# earlier ones.
recompile: doit $(LOADDEFS) $(lisp)/progmodes/cc-mode.elc
$(emacs) --eval "(batch-byte-recompile-directory 0)" $(lisp)
-# CC Mode uses a compile time macro system which causes a compile time
-# dependency in cc-mode.elc on the macros in cc-langs.el and the
-# version string in cc-defs.el.
-$(lisp)/progmodes/cc-mode.elc: \
- $(lisp)/progmodes/cc-mode.el \
- $(lisp)/progmodes/cc-langs.el \
- $(lisp)/progmodes/cc-defs.el
- $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $@
-
# Update MH-E internal autoloads. These are not to be confused with
# the autoloads for the MH-E entry points, which are already in loaddefs.el.
MH_E_DIR = $(lisp)/mh-e
$(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 \"$@\")" \
$(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 \"$@\")" \
# local changes. (Because loaddefs.el is an automatically generated
# file, we don't want to store it in the source repository).
-bootstrap-prepare:
- if test -x $(EMACS); then \
- $(MAKE) $(MFLAGS) autoloads EMACS=$(EMACS); \
- fi
+bootstrap-clean:
+ cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL)
-autogen-clean:
- cd $(lisp); rm -f $(AUTOGENEL)
+distclean:
+ -rm -f ./Makefile
maintainer-clean: distclean bootstrap-clean
-bootstrap-clean: autogen-clean
- cd $(lisp); rm -f *.elc */*.elc
+.PHONY: check-declare
+
+check-declare:
+ $(emacs) -l $(lisp)/emacs-lisp/check-declare \
+ --eval '(check-declare-directory "$(lisp)")'
-# Generate/update files for the bootstrap process.
+# Dependencies
-bootstrap: update-subdirs autoloads compile
+# CC Mode uses a compile time macro system which causes a compile time
+# dependency in cc-*.elc files on the macros in other cc-*.el and the
+# version string in cc-defs.el.
+$(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-awk.elc\
+ $(lisp)/progmodes/cc-cmds.elc $(lisp)/progmodes/cc-compat.elc\
+ $(lisp)/progmodes/cc-engine.elc $(lisp)/progmodes/cc-fonts.elc\
+ $(lisp)/progmodes/cc-langs.elc $(lisp)/progmodes/cc-menus.elc\
+ $(lisp)/progmodes/cc-mode.elc $(lisp)/progmodes/cc-styles.elc\
+ $(lisp)/progmodes/cc-subword.elc $(lisp)/progmodes/cc-vars.elc: \
+ $(lisp)/progmodes/cc-bytecomp.elc $(lisp)/progmodes/cc-defs.elc
-# Generate/update files after the bootstrap process.
-# custom-deps needs `preloaded-file-list'.
+$(lisp)/progmodes/cc-align.elc: \
+ $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc
-bootstrap-after: finder-data custom-deps
+$(lisp)/progmodes/cc-cmds.elc: \
+ $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc
-distclean:
- -rm -f ./Makefile
+$(lisp)/progmodes/cc-compat.elc: \
+ $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-styles.elc \
+ $(lisp)/progmodes/cc-engine.elc
-.PHONY: check-declare
+$(lisp)/progmodes/cc-defs.elc: $(lisp)/progmodes/cc-bytecomp.elc \
+ $(lisp)/emacs-lisp/cl.elc $(lisp)/emacs-lisp/regexp-opt.elc
-check-declare:
- $(emacs) -l $(lisp)/emacs-lisp/check-declare \
- --eval '(check-declare-directory "$(lisp)")'
+$(lisp)/progmodes/cc-engine.elc: $(lisp)/progmodes/cc-langs.elc \
+ $(lisp)/progmodes/cc-vars.elc
+
+$(lisp)/progmodes/cc-fonts.elc: $(lisp)/progmodes/cc-langs.elc \
+ $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
+ $(lisp)/font-lock.elc
+
+$(lisp)/progmodes/cc-langs.elc: $(lisp)/progmodes/cc-vars.elc \
+ $(lisp)/emacs-lisp/cl.elc
+
+$(lisp)/progmodes/cc-mode.elc: $(lisp)/progmodes/cc-langs.elc \
+ $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
+ $(lisp)/progmodes/cc-styles.elc $(lisp)/progmodes/cc-cmds.elc \
+ $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-menus.elc
+
+$(lisp)/progmodes/cc-styles.elc: $(lisp)/progmodes/cc-vars.elc \
+ $(lisp)/progmodes/cc-align.elc
+
+$(lisp)/progmodes/cc-subword.elc: $(lisp)/progmodes/cc-cmds.elc
+$(lisp)/progmodes/cc-vars.elc: $(lisp)/custom.elc $(lisp)/widget.elc
# Makefile ends here.