gallery/Makefile

52 lines
1.1 KiB
Makefile

DATADIR = data
TMPDIR = _tmp
BUILDDIR = _build
# SMALL = thumbnails, MED = single pages (link to full size)
SMALL := 200
MED := 1200
MAKEPAGES = cabal -v0 run -- make-pages
YAMLS != find $(DATADIR) -iname "*.yaml"
all:
ifneq ($(BUILDDIR),$(DATADIR))
$(BUILDDIR)/%: $(DATADIR)/%
@echo "[copy] "$@
@cp $< $@
endif
$(BUILDDIR)/%_small.png: $(DATADIR)/%.png
@echo "[resize] "$@
@mkdir -p $(dir $@)
@convert -resize "$(SMALL)x$(SMALL)^" -gravity center -crop 1:1+0 $< $@
$(BUILDDIR)/%_med.png: $(DATADIR)/%.png
@echo "[resize] "$@
@mkdir -p $(dir $@)
@convert -resize "$(MED)x$(MED)>" $< $@
$(BUILDDIR)/%/index.html: $(DATADIR)/%/info.yaml
@echo "[single] "$@
@mkdir -p $(dir $@)
@$(MAKEPAGES) single $< -o $@
$(BUILDDIR)/nsfw/%/index.html: $(DATADIR)/%/info.yaml
@echo "[single] "$@
@mkdir -p $(dir $@)
@$(MAKEPAGES) single $< -o $@ -n
$(TMPDIR)/%.d: %.yaml
@echo "[deps] "$@
@mkdir -p $(dir $@)
@$(MAKEPAGES) depend-single $< -o $@
include $(TMPDIR)/$(YAMLS:.yaml=.d)
.PHONY: clean distclean
clean:
rm -rf $(BUILDDIR) $(TMPDIR)
distclean: clean
rm -rf dist-newstyle