49 lines
1.1 KiB
Makefile
49 lines
1.1 KiB
Makefile
|
|
SRC_FNL := application.fnl credentials.fnl init.fnl
|
|
SRC_LUA := httpserver.lua fifo.lua fifosock.lua
|
|
SRC_OUT := $(SRC_FNL:fnl=lua) configuration.lua
|
|
|
|
UPLOADER := ~/.local/bin/nodemcu-uploader
|
|
|
|
PLANT := peacock
|
|
# PLANT := lipstick
|
|
# PLANT := peace-lily
|
|
# PLANT := euphorbia-milii
|
|
|
|
UPLOAD_PORT := /dev/ttyUSB0
|
|
UPLOAD_BAUD := 115200
|
|
|
|
LUAC_CROSS := ~/Code/nodemcu-firmware/luac.cross
|
|
LUAC_OUT := luac.out
|
|
|
|
FENNEL_GLOBALS := file,tmr,wifi,node
|
|
|
|
.PHONY: upload
|
|
upload: $(SRC_OUT) $(SRC_LUA) $(UPLOADER)
|
|
$(UPLOADER) --port $(UPLOAD_PORT) --baud $(UPLOAD_BAUD) upload $(SRC_OUT) $(SRC_LUA)
|
|
|
|
$(UPLOADER):
|
|
pip install --user nodemcu-uploader
|
|
|
|
.PHONY: clean
|
|
clean: $(SRC_OUT)
|
|
rm $(SRC_OUT) configuration.lua
|
|
|
|
.PHONY: all
|
|
all: $(SRC_OUT) $(UPLOADER)
|
|
@echo $(SRC_OUT)
|
|
|
|
.PHONY: build
|
|
build: $(SRC_OUT) $(LUAC_OUT)
|
|
|
|
# PHONY to deal with quick recompilation not tagging the files properly
|
|
.PHONY: configuration.lua
|
|
configuration.lua: configuration-$(PLANT).fnl
|
|
./fennel --globals $(FENNEL_GLOBALS) --compile $< > $@
|
|
|
|
%.lua: %.fnl
|
|
./fennel --globals $(FENNEL_GLOBALS) --compile $< > $@
|
|
|
|
$(LUAC_OUT): $(SRC_OUT)
|
|
$(LUAC_CROSS) -o $(LUAC_OUT) $^
|