81 lines
1.5 KiB
Makefile
81 lines
1.5 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:
|
|
|
|
define copy =
|
|
echo "[copy] "$@
|
|
cp $< $@
|
|
endef
|
|
|
|
ifneq ($(BUILDDIR),$(DATADIR))
|
|
$(BUILDDIR)/%: $(DATADIR)/%
|
|
@$(call copy)
|
|
endif
|
|
|
|
$(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
|
|
|
|
$(BUILDDIR)/%_small.png: $(DATADIR)/%.png
|
|
@$(call resize,$(SMALL),^,$(crop))
|
|
|
|
$(BUILDDIR)/%_med.png: $(DATADIR)/%.png
|
|
@$(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
|
|
|
|
$(BUILDDIR)/%/index.html: $(DATADIR)/%/info.yaml
|
|
@$(call single)
|
|
|
|
$(BUILDDIR)/nsfw/%/index.html: $(DATADIR)/%/info.yaml
|
|
@$(call single,-n)
|
|
|
|
define depend-single =
|
|
echo "[deps] "$@
|
|
mkdir -p $(dir $@)
|
|
$(MAKEPAGES) depend-single $< -o $@ $(1)
|
|
endef
|
|
|
|
$(TMPDIR)/%.d: %.yaml
|
|
@$(call depend-single)
|
|
|
|
$(TMPDIR)/nsfw/%.d: %.yaml
|
|
@$(call depend-single,-n -p nsfw)
|
|
|
|
include $(TMPDIR)/$(YAMLS:.yaml=.d)
|
|
include $(TMPDIR)/nsfw/$(YAMLS:.yaml=.d)
|
|
|
|
.PHONY: clean distclean
|
|
clean:
|
|
rm -rf $(BUILDDIR) $(TMPDIR)
|
|
distclean: clean
|
|
rm -rf dist-newstyle
|