dotfiles/emacs/.emacs.d/GNUmakefile

53 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 := $(filter-out $(UNWANTED),$(wildcard site-lisp/*.el))
COMPILED_SITE_LISPS := $(addsuffix c,$(SITE_LISPS))
INIT_LISPS := $(wildcard init/*.el)
COMPILED_INIT_LISPS := $(addsuffix c,$(INIT_LISPS))
VENDOR_DIRS := $(wildcard vendor-lisp/*)
BASE_DIR := $(CURDIR)
.PHONY: all snippets
all: $(COMPILED_SITE_LISPS) init.elc $(COMPILED_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): $(COMPILED_SITE_LISPS)
@echo -e "\e[32mGEN\e[0m $@"
@$(EMACS) -batch \
-eval "(setq generated-autoload-file \"$(BASE_DIR)/$@\")" \
-eval "(update-directory-autoloads \"$(BASE_DIR)/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 $(BASE_DIR)/snippets"
@$(EMACS) -batch \
-eval "(package-initialize)" \
-l yasnippet \
-eval "(yas-compile-directory \"$(BASE_DIR)/snippets\")"
snippets: $(COMPILED_SNIPPETS)
ifeq ($(OS),Windows_NT)
include windows.mk
endif