-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (28 loc) · 985 Bytes
/
Copy pathMakefile
File metadata and controls
38 lines (28 loc) · 985 Bytes
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
FENNEL ?= fennel
FENNEL_FLAGS ?= --correlate --no-compiler-sandbox --add-macro-path $(SRC_DIR)
SRC_DIR ?= fnl
RES_DIR ?= lua
FNL_SRC = $(shell find $(SRC_DIR) -type f -name "*.fnl" -and -not -iname "*macro*")
FNL_MACROS = $(shell find $(SRC_DIR) -type f -name "*macro*.fnl")
LUA_RES = $(patsubst $(SRC_DIR)/%.fnl,$(RES_DIR)/%.lua,$(FNL_SRC))
# Compile all files using `nfnl` (requires `nvim` with `nfnl` installed)
all:
nvim --headless -c 'lua require("nfnl.api")["compile-all-files"](".")' -c "q"
check:
nvim --headless -u NONE -c 'set rtp+=.' -c 'lua dofile("scripts/check.lua")' -c 'qall!'
check-ci:
nix develop .#ci -c $(MAKE) check
# Compile using standalone `fennel` compiler
fennel: $(LUA_RES)
$(RES_DIR)/%.lua: $(SRC_DIR)/%.fnl
@mkdir -p $(shell dirname $@)
@echo "Compiling '$(<)' into '$(@)'"
@$(FENNEL) \
--correlate \
--no-compiler-sandbox \
--add-macro-path $(FNL_MACROS) \
--compile $(<) > $(@)
clean:
rm -rf $(RES_DIR)
love:
@echo "not war"