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.
This commit is contained in:
Ihor Radchenko 2024-02-08 20:16:51 +01:00
parent bfc0cb3723
commit ee395b9b8e
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
3 changed files with 19 additions and 3 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 ======================================================)