From b9916f2e2bf507c5f0f111e051d16888464e72cd Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sat, 4 Aug 2012 15:50:39 +0200 Subject: [PATCH] Makefile: enable one-process-per-source compilations again * default.mk: Re-introduce ELC for single file compilation. * targets.mk: New targets compile-single and compile-single-source that get handed off to lisp/Makefile. * lisp/Makefile: Implement pattern rule using $(ELC). Implement target compile-single that uses a separate Emacs process for each target by invoking the pattern rule. Implement target compile-single-source that additionally removes the compiled file directly after it has been produced, so compilation will always use source files only, never byte-compiled files. * Makefile: Document new targets. These new targets are meant to check for problems with interdependencies in Org. --- Makefile | 98 ++++++++++++++++++++++++++------------------------- default.mk | 4 +++ lisp/Makefile | 8 ++++- targets.mk | 4 +-- 4 files changed, 63 insertions(+), 51 deletions(-) diff --git a/Makefile b/Makefile index b411d30a2..2cf3718bb 100644 --- a/Makefile +++ b/Makefile @@ -18,84 +18,86 @@ help helpall:: $(info Getting Help) $(info ============) $(info ) - $(info make help - show brief help) - $(info make targets - ditto) - $(info make helpall - show extended help) + $(info make help - show brief help) + $(info make targets - ditto) + $(info make helpall - show extended help) $(info ) $(info Build and Check) $(info ===============) - $(info make - build Org ELisp and all documentation) - $(info make all - ditto) - $(info make compile - build Org ELisp files) - $(info make autoloads - create org-install.el to load org in-place) - $(info make check - build Org ELisp files and run test suite) + $(info make - build Org ELisp and all documentation) + $(info make all - ditto) + $(info make compile - build Org ELisp files) + $(info make autoloads - create org-install.el to load org in-place) + $(info make check - build Org ELisp files and run test suite) helpall:: - $(info make test - ditto) - $(info make compile-dirty - build only stale Org ELisp files) - $(info make test-dirty - check without building first) + $(info make test - ditto) + $(info make compile-dirty - build only stale Org ELisp files) + $(info make compile-single - build using one Emacs process per file) + $(info make compile-source - ditto, but immediately remove byte-compiled file ) + $(info make test-dirty - check without building first) $(info ) $(info Compatibility) $(info =============) - $(info make oldorg - what the old make did: compile autoloads info) + $(info make oldorg - what the old make did: compile autoloads info) $(info ) $(info Convenience) $(info ===========) - $(info make up0 - pull from upstream) - $(info make up1 - pull from upstream, build and check) - $(info make up2 - pull from upstream, build, check and install) - $(info make update - pull from upstream and build) - $(info make update2 - pull from upstream, build and install) - $(info make uncompiled - combine cleanlisp and autoloads) - $(info make local.mk - create new local.mk as template for adaptation) + $(info make up0 - pull from upstream) + $(info make up1 - pull from upstream, build and check) + $(info make up2 - pull from upstream, build, check and install) + $(info make update - pull from upstream and build) + $(info make update2 - pull from upstream, build and install) + $(info make uncompiled - combine cleanlisp and autoloads) + $(info make local.mk - create new local.mk as template for adaptation) $(info ) $(info Cleaning) $(info ========) - $(info make clean - remove built Org ELisp files and documentation) - $(info make cleanall - remove everything that can be built and all remnants) - $(info make cleandirs - clean in etc/, lisp/ and doc/) - $(info make cleancontrib - remove remnants in contrib/) - $(info make cleantesting - remove remnants in testing/) - $(info make cleanutils - remove remnants in UTILITIES/) - $(info make cleandoc - remove built documentation) - $(info make cleandocs - ditto) - $(info make cleanlisp - remove built Org ELisp files) - $(info make cleanelc - ditto) - $(info make cleantest - remove test directory) - $(info make clean-install - remove previous Org installation) + $(info make clean - remove built Org ELisp files and documentation) + $(info make cleanall - remove everything that can be built and all remnants) + $(info make cleandirs - clean in etc/, lisp/ and doc/) + $(info make cleancontrib - remove remnants in contrib/) + $(info make cleantesting - remove remnants in testing/) + $(info make cleanutils - remove remnants in UTILITIES/) + $(info make cleandoc - remove built documentation) + $(info make cleandocs - ditto) + $(info make cleanlisp - remove built Org ELisp files) + $(info make cleanelc - ditto) + $(info make cleantest - remove test directory) + $(info make clean-install - remove previous Org installation) $(info ) $(info Configuration Check) $(info ===================) help helpall:: - $(info make config - check main configuration) + $(info make config - check main configuration) helpall:: - $(info make config-test - check test configuration) - $(info make config-exe - check executables configuration) - $(info make config-cmd - check command configuration) - $(info make config-all - check all configuration) - $(info make config-eol - check all configuration, mark end-of-line) + $(info make config-test - check test configuration) + $(info make config-exe - check executables configuration) + $(info make config-cmd - check command configuration) + $(info make config-all - check all configuration) + $(info make config-eol - check all configuration, mark end-of-line) $(info ) $(info Documentation) $(info =============) help helpall:: - $(info make doc - build all documentation) + $(info make doc - build all documentation) helpall:: - $(info make docs - ditto) + $(info make docs - ditto) help helpall:: - $(info make info - build Info documentation) + $(info make info - build Info documentation) helpall:: - $(info make html - build HTML documentation) - $(info make pdf - build PDF documentation) - $(info make card - build reference cards) - $(info make refcard - ditto) + $(info make html - build HTML documentation) + $(info make pdf - build PDF documentation) + $(info make card - build reference cards) + $(info make refcard - ditto) help helpall:: $(info ) $(info Installation) $(info ============) - $(info make install - build and install Org) + $(info make install - build and install Org) helpall:: - $(info make install-etc - build and install files in /etc) - $(info make install-lisp - build and install Org Elisp files) - $(info make install-info - build and install Info documentation) + $(info make install-etc - build and install files in /etc) + $(info make install-lisp - build and install Org Elisp files) + $(info make install-info - build and install Info documentation) help helpall:: @echo "" diff --git a/default.mk b/default.mk index c03791901..2ac552b1a 100644 --- a/default.mk +++ b/default.mk @@ -90,6 +90,10 @@ MAKE_ORG_VERSION = $(BATCHL) \ ELCDIR = $(BATCHL) \ --eval '(batch-byte-recompile-directory 0)' +# How to byte-compile a single file +ELC = $(BATCHL) \ + --eval '(batch-byte-compile)' + # How to make a pdf file from a texinfo file TEXI2PDF = texi2pdf --batch --clean diff --git a/lisp/Makefile b/lisp/Makefile index b4b3e2282..ee0caaf8f 100644 --- a/lisp/Makefile +++ b/lisp/Makefile @@ -10,7 +10,7 @@ LISPA = $(LISPV) $(LISPI) LISPF = $(filter-out $(LISPA),$(wildcard *.el)) LISPC = $(filter-out $(LISPN:%el=%elc),$(LISPF:%el=%elc)) -.PHONY: all compile compile-dirty \ +.PHONY: all compile compile-dirty compile-single \ autoloads \ install clean cleanauto cleanall clean-install @@ -18,6 +18,12 @@ LISPC = $(filter-out $(LISPN:%el=%elc),$(LISPF:%el=%elc)) all compile:: autoloads all compile compile-dirty:: $(LISPI) $(LISPV) $(ELCDIR) +compile-single: clean autoloads $(LISPC) +compile-source: clean autoloads + @$(foreach elc,$(LISPC),$(MAKE) $(elc) && $(RM) $(elc);) + +%.elc: %.el + -$(ELC) $(<) autoloads: cleanauto $(LISPI) $(LISPV) diff --git a/targets.mk b/targets.mk index 871c338a3..5db69f3c4 100644 --- a/targets.mk +++ b/targets.mk @@ -28,7 +28,7 @@ endif cleancontrib cleantesting cleanutils cleanrel clean-install cleanelc cleandirs \ cleanlisp cleandoc cleandocs cleantest \ - compile compile-dirty uncompiled \ + compile compile-single compile-source compile-dirty uncompiled \ config config-test config-exe config-all config-eol CONF_BASE = EMACS DESTDIR @@ -75,7 +75,7 @@ local.mk: all compile:: $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;) -compile compile-dirty:: +compile compile-dirty compile-single compile-source:: $(MAKE) -C lisp $@ all clean-install:: $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)