branch: externals/org
commit ee395b9b8e2e7486fa4ad6936a3964e2f41b192c
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    Add new make target for native compilation
    
    * lisp/Makefile (LISPN): New variable listing all the valid .eln
    targets.
    (_ORGCM_):
    (compile-native):
    (native): New compile target.
    (%.eln): Rule how to compile .eln files from .el files.
    * mk/default.mk (ELN): Command to perform native compilation of a
    single .eln file.
    * mk/targets.mk (.PHONY):
    (CONF_CALL): List the new targets and variables.
    (native): Add target.
---
 lisp/Makefile | 10 +++++++++-
 mk/default.mk |  5 +++++
 mk/targets.mk |  7 +++++--
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/lisp/Makefile b/lisp/Makefile
index f507f18a27..c57095f651 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -10,7 +10,8 @@ LISPA         := $(LISPV) $(LISPI)
 LISPB  := $(LISPA:%el=%elc) org-install.elc
 LISPF  := $(filter-out $(LISPA),$(sort $(wildcard *.el)))
 LISPC  := $(filter-out $(LISPB) $(LISPN:%el=%elc),$(LISPF:%el=%elc))
-_ORGCM_ := dirall single source slint1 slint2
+LISPN  := $(filter-out $(LISPB) $(LISPN:%el=%eln),$(LISPF:%el=%eln))
+_ORGCM_ := dirall single native source slint1 slint2
 -include local.mk
 
 .PHONY:        all compile compile-dirty \
@@ -28,6 +29,7 @@ endif
 
 compile-dirall:        dirall
 compile-single: single $(LISPC)
+compile-native: native $(LISPN)
 compile-source:        source dirall
 compile-slint1:        dirall slint1
 compile-slint2:        source dirall slint1
@@ -38,6 +40,8 @@ dirall:
        @$(ELCDIR)
 single:
        @$(info ==================== $@ ====================)
+native:
+       @$(info ==================== $@ ====================)
 source: cleanelc
        @$(info ==================== $@ ====================)
        @$(foreach elc,$(LISPC),$(MAKE) $(elc) && $(RM) $(elc);)
@@ -49,6 +53,10 @@ slint1:
        @$(info Compiling single $(abspath $<)...)
        -@$(ELC) $<
 
+%.eln: %.el
+       @$(info Native compiling single $(abspath $<)...)
+       -@$(ELN) $<
+
 autoloads:     cleanauto $(LISPI) $(LISPV)
 
 $(LISPV):      $(LISPF)
diff --git a/mk/default.mk b/mk/default.mk
index 13c5a56ed8..c07f910019 100644
--- a/mk/default.mk
+++ b/mk/default.mk
@@ -156,6 +156,10 @@ ELCDIR     = $(BATCHL) \
 ELC    = $(BATCHL) \
          --eval '(batch-byte-compile)'
 
+# How to native-compile a single file
+ELN    = $(BATCHL) \
+         --eval '(batch-native-compile)'
+
 # How to make a pdf file from a texinfo file
 TEXI2PDF = texi2pdf --batch --clean --expand
 
@@ -202,6 +206,7 @@ INSTALL_INFO = install-info
 ORGCM  = dirall
 # ORGCM        = dirall #   1x slowdown compared to default compilation method
 # ORGCM        = single #   4x one Emacs process per compilation
+# ORGCM        = native #   4x one Emacs process per native compilation
 # ORGCM        = source #   5x ditto, but remove compiled file immediately
 # ORGCM        = slint1 #   3x possibly elicit more warnings
 # ORGCM        = slint2 #   7x possibly elicit even more warnings
diff --git a/mk/targets.mk b/mk/targets.mk
index 06016561cf..22f1f6e6d1 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -27,7 +27,7 @@ ifneq ($(GITSTATUS),)
   GITVERSION := $(GITVERSION:.dirty=).dirty
 endif
 
-.PHONY:        all oldorg update update2 up0 up1 up2 single $(SUBDIRS) \
+.PHONY:        all oldorg update update2 up0 up1 up2 single native $(SUBDIRS) \
        check test install $(INSTSUB) \
        info html pdf card refcard doc docs \
        autoloads cleanall clean $(CLEANDIRS:%=clean%) \
@@ -41,7 +41,7 @@ CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
 CONF_DEST = lispdir infodir datadir testdir
 CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA BTEST_RE
 CONF_EXEC = CP MKDIR RM RMR FIND CHMOD SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO 
INSTALL_INFO
-CONF_CALL = BATCH BATCHL ELC ELCDIR NOBATCH BTEST MAKE_LOCAL_MK 
MAKE_ORG_INSTALL MAKE_ORG_VERSION
+CONF_CALL = BATCH BATCHL ELC ELN ELCDIR NOBATCH BTEST MAKE_LOCAL_MK 
MAKE_ORG_INSTALL MAKE_ORG_VERSION
 config-eol:: EOL = \#
 config-eol:: config-all
 config config-all::
@@ -74,6 +74,9 @@ update update2::      up0 all
 single:        ORGCM=single
 single:        compile
 
+native: ORGCM=native
+native: compile
+
 .PRECIOUS:     local.mk
 local.mk:
        $(info ======================================================)

Reply via email to