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