WIDTH?=1404 HEIGHT?=1872 DEVICE?=root@10.11.99.1 MANAGER?=/opt/bin/templatectl SOURCE=templates BUILD=build $(shell mkdir -p "$(BUILD)") TEMPLATES=$(foreach vector,$(shell find "$(SOURCE)" -iname "*.svg" -type f),$(subst .svg,,$(subst $(SOURCE)/,,$(vector)))-push) all: $(TEMPLATES) clean: rm "$(BUILD)"/* $(BUILD)/%.png: $(SOURCE)/%.svg inkscape "$^" -o "$@" -w $(WIDTH) -h $(HEIGHT) 2>/dev/null %-push: $(BUILD)/%.png $(SOURCE)/%.svg $(SOURCE)/%.meta ssh "$(DEVICE)" $(MANAGER) --version scp "$(BUILD)"/$*.png "$(SOURCE)"/$*.svg "$(DEVICE):/usr/share/remarkable/templates" echo '$(MANAGER) add $(shell cat "$(SOURCE)/$*.meta") --filename "$*"' | ssh "$(DEVICE)" .PHONY: all clean