gallery/Makefile

53 lines
1.1 KiB
Makefile
Raw Normal View History

2020-07-14 01:10:33 -04:00
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
2020-07-15 05:58:44 -04:00
YAMLS != find $(DATADIR) -iname "*.yaml"
all:
2020-07-14 01:10:33 -04:00
ifneq ($(BUILDDIR),$(DATADIR))
$(BUILDDIR)/%: $(DATADIR)/%
2020-07-15 05:58:44 -04:00
@echo "[copy] "$@
@cp $< $@
2020-07-14 01:10:33 -04:00
endif
$(BUILDDIR)/%_small.png: $(DATADIR)/%.png
2020-07-15 05:58:44 -04:00
@echo "[resize] "$@
@mkdir -p $(dir $@)
@convert -resize "$(SMALL)x$(SMALL)^" -gravity center -crop 1:1+0 $< $@
2020-07-14 01:10:33 -04:00
$(BUILDDIR)/%_med.png: $(DATADIR)/%.png
2020-07-15 05:58:44 -04:00
@echo "[resize] "$@
@mkdir -p $(dir $@)
@convert -resize "$(MED)x$(MED)>" $< $@
2020-07-14 01:10:33 -04:00
$(BUILDDIR)/%/index.html: $(DATADIR)/%/info.yaml
2020-07-15 05:58:44 -04:00
@echo "[single] "$@
@mkdir -p $(dir $@)
@$(MAKEPAGES) single $< -o $@
2020-07-14 01:10:33 -04:00
$(BUILDDIR)/nsfw/%/index.html: $(DATADIR)/%/info.yaml
2020-07-15 05:58:44 -04:00
@echo "[single] "$@
@mkdir -p $(dir $@)
@$(MAKEPAGES) single $< -o $@ -n
2020-07-14 01:10:33 -04:00
2020-07-15 05:58:58 -04:00
$(TMPDIR)/%.d: %.yaml
@echo "[deps] "$@
@mkdir -p $(dir $@)
@$(MAKEPAGES) depend-single $< -o $@
include $(TMPDIR)/$(YAMLS:.yaml=.d)
2020-07-15 05:58:44 -04:00
.PHONY: clean distclean
2020-07-14 01:10:33 -04:00
clean:
2020-07-15 05:58:44 -04:00
rm -rf $(BUILDDIR) $(TMPDIR)
distclean: clean
rm -rf dist-newstyle