dotfiles/emacs/.emacs.d/GNUmakefile
2018-06-07 10:40:18 -07:00

51 lines
1.6 KiB
Makefile

SHELL = bash
EMACS := emacs
.SECONDARY:
AUTOLOADS_FILE = site-lisp/site-autoloads.el
UNWANTED = $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-%
SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)))
INIT_LISPS = init/oni-org-init.elc init/oni-js2-init.elc init/oni-gnus-init.elc \
init/oni-cmake-init.elc init/oni-cpp-init.elc \
$(addsuffix .elc,$(basename $(wildcard init/*.org)))
VENDOR_DIRS = $(wildcard vendor-lisp/*)
ifeq ($(OS),Windows_NT)
include windows.mk
endif
.PHONY: all snippets
all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) snippets
%.elc: %.el
@echo -e "\e[31mELC\e[0m $<"
@$(EMACS) -batch \
-directory "$(HOME)/.emacs.d/site-lisp" \
-directory "$(HOME)/.emacs.d/vendor-lisp/emacs-slack" \
-directory "$(HOME)/.emacs.d/vendor-lisp/circe" \
-directory "$(HOME)/.emacs.d/vendor-lisp/circe-serenity" \
-eval "(package-initialize)" \
-eval "(byte-compile-file \"$<\")"
### Site Lisp
$(AUTOLOADS_FILE): $(SITE_LISPS)
@echo -e "\e[32mGEN\e[0m $@"
@$(EMACS) -batch \
-eval "(setq generated-autoload-file \"$(CURDIR)/$@\")" \
-eval "(update-directory-autoloads \"$(CURDIR)/site-lisp/\")"
### Snippets
SNIPPET_DIRS = $(wildcard snippets/*)
COMPILED_SNIPPETS = $(addsuffix /.yas-compiled-snippets.el, $(SNIPPET_DIRS))
%/.yas-compiled-snippets.el: %/*
@echo -e "\e[36mYAS\e[0m $(CURDIR)/snippets"
@$(EMACS) -batch \
-eval "(package-initialize)" \
-l yasnippet \
-eval "(yas-compile-directory \"$(CURDIR)/snippets\")"
snippets: $(COMPILED_SNIPPETS)