yummy.cricket/Makefile

66 lines
1.9 KiB
Makefile

CSS = $(wildcard style/*.css) $(shell find fonts -type f) \
rainbow-quox/style.css
PAGES = index.html pubkey.txt rainbow-quox/index.html
MEDIA = \
$(wildcard media/*.png) $(wildcard media/*.gif) $(wildcard media/*.webp) \
$(wildcard media/flags/*) $(wildcard media/buttons/*) \
$(wildcard media/icons/*) $(wildcard media/bg/*) 8831.png 8831-quox.png \
$(wildcard rainbow-quox/front/*.png) $(wildcard rainbow-quox/back/*.png)
SCRIPTS = $(patsubst %.ts,%.js,$(wildcard script/*.ts rainbow-quox/*.ts))
MISC = $(shell find .well-known -type f)
ALL = $(CSS) $(PAGES) $(MEDIA) $(SCRIPTS) $(MISC)
BUILDDIR ?= /srv/www/yummy
TMPDIR ?= _tmp
HOST ?= yummy.cricket
REMOTE_USER ?= www-data
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)' \
$(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/
$(BUILDDIR)/%: %
@echo $*
@mkdir -p $(dir $@)
@cp $< $@
$(BUILDDIR)/%.gif: %_bg.gif
@echo $(notdir $@)
@mkdir -p $(dir $(BUILDDIR)/$* $(TMPDIR)/$*)
@gifsicle -U $*_bg.gif -o $(TMPDIR)/$*_bg_u.gif
@convert -transparent '#ff9bc7' $(TMPDIR)/$*_bg_u.gif $(TMPDIR)/$*_t.gif
@gifsicle --disposal=previous $(TMPDIR)/$*_t.gif -o $(BUILDDIR)/$*.gif
$(BUILDDIR)/%_small.png: %.svg
@echo $(notdir $@)
@mkdir -p $(dir $@)
@inkscape -e $@ -h 16 $< >/dev/null
$(BUILDDIR)/%_large.png: %.svg
@echo $(notdir $@)
@mkdir -p $(dir $@)
@inkscape -e $@ -h 30 $< >/dev/null
$(BUILDDIR)/%_dim.png: %.png
@echo $(notdir $@)
@convert -channel A -evaluate Multiply 0.75 $< $@
$(BUILDDIR)/%.js: %.ts
tsc --strict --noUncheckedIndexedAccess --noEmitOnError \
--lib dom,es2023 --target es2015 \
--outDir $(dir $@) $^
clean:
$(RM) -r $(TMPDIR) $(BUILDDIR)
.PHONY: clean all build upload