-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
63 lines (49 loc) · 1.5 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
SHELL := bash
.ONESHELL:
.DELETE_ON_ERROR:
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --warn-undefined-variables
FENNEL ?= fennel
VUSTED ?= vusted
FNL_FLAGS ?= --correlate
FNL_EXTRA_FLAGS ?=
VUSTED_FLAGS ?= --shuffle --output=utfTerminal
VUSTED_EXTRA_FLAGS ?=
REPO_ROOT:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
TEST_ROOT:=$(REPO_ROOT)/test
SPEC_ROOT:=$(TEST_ROOT)
TEST_DEPS:=$(TEST_ROOT)/.test-deps
FNL_SPECS:=$(wildcard $(SPEC_ROOT)/*_spec.fnl)
LUA_SPECS:=$(FNL_SPECS:%.fnl=%.lua)
FNL_SRC:=$(wildcard fnl/nvim-laurel/*.fnl)
REPO_FNL_DIR := $(REPO_ROOT)/fnl
REPO_FNL_PATH := $(REPO_FNL_DIR)/?.fnl;$(REPO_FNL_DIR)/?/init.fnl
REPO_MACRO_DIR := $(REPO_FNL_DIR)
REPO_MACRO_PATH := $(REPO_MACRO_DIR)/?.fnl;$(REPO_MACRO_DIR)/?/init.fnl
.DEFAULT_GOAL := help
.PHONY: help
help: ## Show this help
@echo
@echo 'Usage:'
@echo ' make <target> [flags...]'
@echo
@echo 'Targets:'
@egrep -h '^\S+: .*## \S+' $(MAKEFILE_LIST) | sed 's/: .*##/:/' | column -t -c 2 -s ':' | sed 's/^/ /'
@echo
fnl/nvim-laurel/: ## Create link for backward compatibility
@ln -dsvL "$(REPO_ROOT)/fnl/laurel" "$(REPO_ROOT)/fnl/nvim-laurel"
%_spec.lua: %_spec.fnl ## Compile fnl spec file into lua
@$(FENNEL) \
$(FNL_FLAGS) \
$(FNL_EXTRA_FLAGS) \
--add-macro-path "$(REPO_MACRO_PATH);$(SPEC_ROOT)/?.fnl" \
--compile $< > $@
.PHONY: clean
clean: ## Clean lua test files compiled from fnl
@rm $(LUA_SPECS) || exit 0
.PHONY: test
test: $(LUA_SPECS) ## Run test
@$(VUSTED) \
$(VUSTED_FLAGS) \
$(VUSTED_EXTRA_FLAGS) \
$(TEST_ROOT)