aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 60859455d7d36bedea025e8b85bc6ea969dc0c29 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
TOP := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
LOAD_PATH = -L $(TOP) -L $(TOP)vendor
PKG = soria

ELS_ALL = $(wildcard *.el)
ELS = $(filter-out $(PKG)-autoloads.el,$(ELS_ALL))
OBJECTS = $(ELS:.el=.elc)

EMACS ?= emacs
BATCH = $(EMACS) --quick --batch $(LOAD_PATH)

##
# General

.PHONY: all
all: clean test

.PHONY: version
version:
	@$(EMACS) --version

.PHONY: clean
clean:
	@rm -rf $(TOP)vendor/* $(PKG)-autoloads.el* $(OBJECTS)

.PHONY: build
build: $(OBJECTS)

$(OBJECTS): %.elc: %.el
	@$(BATCH) --kill -l bytecomp --eval '(byte-recompile-file (expand-file-name "$(TOP)$<") nil 0)'

##
# Test

.PHONY: ci
ci: version all

.PHONY: test
test: lint git-validation checkdoc load-test

# Maybe it would've been nicer to use Cask or something like that, but it
# doesn't have too many dependencies so it should be fine for now.
.PHONY: vendor
vendor:
	@mkdir -p $(TOP)vendor
ifeq ("$(wildcard $(TOP)vendor/elisp-lint.el)","")
	@echo "Downloading 'elisp-lint' into 'vendor' directory"
	@wget -q -O $(TOP)vendor/elisp-lint.el https://raw.githubusercontent.com/gonewest818/elisp-lint/master/elisp-lint.el
endif
# Required by elisp-lint.el
ifeq ("$(wildcard $(TOP)vendor/package-lint.el)","")
	@echo "Downloading 'package-lint' into 'vendor' directory"
	@wget -q -O $(TOP)vendor/package-lint.el https://raw.githubusercontent.com/purcell/package-lint/master/package-lint.el
endif
# Required by elisp-lint.el
ifeq ("$(wildcard $(TOP)vendor/dash.el)","")
	@echo "Downloading 'dash' into 'vendor' directory"
	@wget -q -O vendor/dash.el https://raw.githubusercontent.com/magnars/dash.el/master/dash.el
endif

.PHONY: fix-stdlib-changes
fix-stdlib-changes:
# HACK: God knows why this file is needed, but an empty expression makes
# package-lint shut up.
	@mkdir -p vendor/data
	@echo "()" > vendor/data/stdlib-changes

.PHONY: lint
lint: vendor fix-stdlib-changes
	@$(BATCH) -l elisp-lint.el -f elisp-lint-files-batch $(ELS)

.PHONY: git-validation
git-validation:
ifeq (, $(shell which git-validation 2> /dev/null))
	@echo "You don't have 'git-validation' installed, consider installing it (see the CONTRIBUTING.org file)."
else
	@git-validation -q -range 7d38ca68163c..HEAD -travis-pr-only=false
endif

.PHONY: load-test
load-test:
	@$(BATCH) -nw --load soria-theme.el \
		--eval "(progn \
		          (add-to-list 'custom-theme-load-path \"$(TOP)\") \
		          (load-theme 'soria t) \
		          (message \"%s\" soria-theme-hide-helm-header))"

.PHONY: checkdoc
checkdoc:
	@chmod +x ./bin/checkdoc.sh
	@./bin/checkdoc.sh $(BATCH) -nw --load soria-theme.el