From 52e1254001480c83075bc96f8128c2bba89625fb Mon Sep 17 00:00:00 2001 From: Hugo Thunnissen Date: Thu, 17 Aug 2023 11:52:38 +0200 Subject: [PATCH] Use compile scripts in makefile + add bytecomp step to native comp script --- Makefile | 8 +++++--- native-compile.bash | 13 +++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a1a03a5..c237cb4 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,11 @@ cask: $(CASK_DIR) .PHONY: compile compile: cask - cask emacs -batch -L . -L test \ - -f batch-byte-compile $$(cask files); \ - (ret=$$? ; cask clean-elc && exit $$ret) + bash ./compile.bash + +.PHONY: compile-native +compile-native: cask + bash ./native-compile.bash .PHONY: test test: compile diff --git a/native-compile.bash b/native-compile.bash index 3e88f3d..ac5d6e2 100644 --- a/native-compile.bash +++ b/native-compile.bash @@ -1,11 +1,20 @@ #!/bin/bash +rm ./**/*.elc +rm *.elc + for file in ./*.el; do echo 'Compiling '"$file"' ...' - cask emacs -batch -L . --eval '(setq native-compile-error-on-warn t)' -f batch-native-compile "$file" || break + cask emacs -batch -L . --eval '(progn '"(require 'comp)"' (setq byte-compile-error-on-warn t native-compile-target-directory (car native-comp-eln-load-path)) (nreverse native-comp-eln-load-path))' -f batch-byte+native-compile "$file" || break done for file in ./**/*.el; do echo 'Compiling '"$file"' ...' - cask emacs -batch -L . --eval '(setq byte-compile-error-on-warn t)' -f batch-native-compile "$file" || break + cask emacs -batch -L . --eval '(progn '"(require 'comp)"' (setq byte-compile-error-on-warn t native-compile-target-directory (car native-comp-eln-load-path)) (nreverse native-comp-eln-load-path))' -f batch-byte+native-compile "$file" || break done + + +if [[ -z $NO_REMOVE_ELC ]]; then + rm ./**/*.elc + rm *.elc +fi