-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile
72 lines (50 loc) · 2.18 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
############################################################-*-Makefile-*-####
# Makefile for compiling the major mode of Emacs
##############################################################################
##############################################################################
# Configuration
ROOT = .
SOURCE_DIR = $(ROOT)
##############################################################################
# Variables
# Emacs Lisp
MODE_NAME = sbt-mode
ELISP_COMMAND ?= emacs
ELISP_OPTIONS += -batch -no-site-file -q
ELISP_OPTIONS += -L $(ROOT)
ELISP_FILES += $(MODE_NAME)
ELISP_FILES += $(MODE_NAME)-buffer
ELISP_FILES += $(MODE_NAME)-comint
ELISP_FILES += $(MODE_NAME)-hydra
ELISP_FILES += $(MODE_NAME)-project
ELISP_FILES += $(MODE_NAME)-rgrep
ELISP_FILES += $(MODE_NAME)-vars
PKG_FILE = $(SOURCE_DIR)/$(MODE_NAME)-pkg.el
ELISP_SOURCES += $(ELISP_FILES:%=$(SOURCE_DIR)/%.el)
##############################################################################
RM ?= rm -f
RMDIR ?= rmdir
TOUCH ?= touch
VERSION := $(shell ${ELISP_COMMAND} $(ELISP_OPTIONS) --eval '(princ (format "%s\n" (nth 2 (read (find-file "$(PKG_FILE)")))))')
MODE_NAME_VERSION = $(MODE_NAME)-$(VERSION)
##############################################################################
# Commands
all: .latest-build
clean:
$(RM) *.elc .latest-* autoloads.el *.tar
[ ! -d $(MODE_NAME_VERSION) ] || $(RM) $(MODE_NAME_VERSION)/*
[ ! -d $(MODE_NAME_VERSION) ] || $(RMDIR) $(MODE_NAME_VERSION)
.PHONY: all
.PHONY: clean
##############################################################################
# Rules
.latest-build: $(ELISP_SOURCES)
$(ELISP_COMMAND) $(ELISP_OPTIONS) -f batch-byte-compile $(ELISP_SOURCES)
@$(TOUCH) $@
##############################################################################
autoloads: $(ELISP_SOURCES)
$(ELISP_COMMAND) $(ELISP_OPTIONS) --eval "(setq make-backup-files nil)" --eval "(setq generated-autoload-file (expand-file-name \"autoloads.el\"))" -f batch-update-autoloads `pwd`
package:
mkdir -p $(MODE_NAME_VERSION)
cp $(ELISP_SOURCES) $(PKG_FILE) $(MODE_NAME_VERSION)
tar cf $(MODE_NAME_VERSION).tar $(MODE_NAME_VERSION)