yummy.cricket/Makefile

68 lines
2.1 KiB
Makefile

PAGES = index.html pubkey.txt rainbow-quox/index.html \
# dnd/index.html $(wildcard dnd/*/index.html)
MEDIA = \
$(wildcard media/*.png) $(wildcard media/*.gif) $(wildcard media/*.webp) \
$(wildcard media/*.svg) \
$(wildcard media/flags/*) $(wildcard media/buttons/*) \
$(wildcard media/icons/*) $(wildcard media/bg/*) 8831.png 8831-quox.png \
$(wildcard rainbow-quox/front/*) $(wildcard rainbow-quox/back/*) \
$(wildcard rainbow-quox/*.svg) rainbow-quox/palette.svg \
# $(wildcard dnd/*.png) $(wildcard dnd/*.webp) $(wildcard dnd/*/*.webp)
CSS = $(shell find fonts -type f) \
$(patsubst %.scss,%.css, \
$(wildcard rainbow-quox/style/*) $(wildcard style/*)) \
# dnd/base.css dnd/bio.css dnd/index.css $(wildcard dnd/*/style.css)
SCRIPTS = $(patsubst %.ts,%.js, \
$(wildcard script/*.ts rainbow-quox/script/color/*.ts \
rainbow-quox/script/*.ts))
MISC = $(shell find .well-known -type f)
ALL = $(CSS) $(PAGES) $(MEDIA) $(SCRIPTS) $(MISC)
BUILDDIR ?= /srv/www/yummy
TMPDIR ?= _tmp
HOST ?= yummy.cricket
SSH_PORT ?= 35353
REMOTE_USER ?= nginx
REMOTE_DIR ?= yummy
all: build
build: $(patsubst %,$(BUILDDIR)/%,$(ALL))
upload: build
@rsync --recursive --partial --progress --copy-links \
--compress --human-readable --hard-links \
--delete --delete-after \
--rsh='ssh -l $(REMOTE_USER) -p $(SSH_PORT)' \
$(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/
$(BUILDDIR)/%: %
@echo '[copy] ' $<
mkdir -p $(dir $@)
cp $< $@
$(BUILDDIR)/%.js: %.ts
@echo '[tsc] ' $<
tsc --strict --noUncheckedIndexedAccess --noEmitOnError \
--lib dom,es2023 --target es2022 \
--outDir $(dir $@) $^
$(BUILDDIR)/rainbow-quox/palette.svg: rainbow-quox/make-palette/*
@echo '[make-palette] rainbow-quox/palette.svg'
cd rainbow-quox/make-palette; \
cabal run -v0 -- make-palette $(abspath $@)
$(BUILDDIR)/%.css: %.scss $(wildcard $(dir %)/lib/*.scss)
@echo '[sass] ' $<
mkdir -p $(dir $@)
sass --no-source-map -I style $< $@ \
--silence-deprecation mixed-decls
clean:
@echo '[clean]'
$(RM) -r $(TMPDIR) $(BUILDDIR)
.PHONY: clean all build upload
.SILENT: