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-15 14:09:40 -04:00
|
|
|
define copy =
|
|
|
|
echo "[copy] "$@
|
|
|
|
cp $< $@
|
|
|
|
endef
|
|
|
|
|
2020-07-14 01:10:33 -04:00
|
|
|
ifneq ($(BUILDDIR),$(DATADIR))
|
|
|
|
$(BUILDDIR)/%: $(DATADIR)/%
|
2020-07-15 14:09:40 -04:00
|
|
|
@$(call copy)
|
2020-07-14 01:10:33 -04:00
|
|
|
endif
|
|
|
|
|
2020-07-15 14:09:40 -04:00
|
|
|
$(BUILDDIR)/nsfw/%: $(DATADIR)/%
|
|
|
|
@$(call copy)
|
|
|
|
|
|
|
|
|
|
|
|
define resize =
|
|
|
|
echo "[resize] "$@
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
convert -resize "$(1)x$(1)$(2)" $(3) $< $@
|
|
|
|
endef
|
|
|
|
|
|
|
|
crop = -gravity center -crop 1:1+0
|
|
|
|
|
2020-07-14 01:10:33 -04:00
|
|
|
$(BUILDDIR)/%_small.png: $(DATADIR)/%.png
|
2020-07-15 14:09:40 -04:00
|
|
|
@$(call resize,$(SMALL),^,$(crop))
|
2020-07-14 01:10:33 -04:00
|
|
|
|
|
|
|
$(BUILDDIR)/%_med.png: $(DATADIR)/%.png
|
2020-07-15 14:09:40 -04:00
|
|
|
@$(call resize,$(MED),>)
|
|
|
|
|
|
|
|
$(BUILDDIR)/nsfw/%_small.png: $(DATADIR)/%.png
|
|
|
|
@$(call resize,$(SMALL),^,$(crop))
|
|
|
|
|
|
|
|
$(BUILDDIR)/nsfw/%_med.png: $(DATADIR)/%.png
|
|
|
|
@$(call resize,$(MED),>)
|
|
|
|
|
|
|
|
|
|
|
|
define single =
|
|
|
|
echo "[single] "$@
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
$(MAKEPAGES) single $< -o $@ $(1)
|
|
|
|
endef
|
2020-07-14 01:10:33 -04:00
|
|
|
|
|
|
|
$(BUILDDIR)/%/index.html: $(DATADIR)/%/info.yaml
|
2020-07-15 14:09:40 -04:00
|
|
|
@$(call single)
|
2020-07-14 01:10:33 -04:00
|
|
|
|
|
|
|
$(BUILDDIR)/nsfw/%/index.html: $(DATADIR)/%/info.yaml
|
2020-07-15 14:09:40 -04:00
|
|
|
@$(call single,-n)
|
|
|
|
|
|
|
|
define depend-single =
|
|
|
|
echo "[deps] "$@
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
$(MAKEPAGES) depend-single $< -o $@ $(1)
|
|
|
|
endef
|
2020-07-14 01:10:33 -04:00
|
|
|
|
2020-07-15 05:58:58 -04:00
|
|
|
$(TMPDIR)/%.d: %.yaml
|
2020-07-15 14:09:40 -04:00
|
|
|
@$(call depend-single)
|
|
|
|
|
|
|
|
$(TMPDIR)/nsfw/%.d: %.yaml
|
|
|
|
@$(call depend-single,-n -p nsfw)
|
2020-07-15 05:58:58 -04:00
|
|
|
|
|
|
|
include $(TMPDIR)/$(YAMLS:.yaml=.d)
|
2020-07-15 14:09:40 -04:00
|
|
|
include $(TMPDIR)/nsfw/$(YAMLS:.yaml=.d)
|
2020-07-15 05:58:58 -04:00
|
|
|
|
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
|