2020-07-14 01:10:33 -04:00
|
|
|
DATADIR = data
|
|
|
|
TMPDIR = _tmp
|
|
|
|
BUILDDIR = _build
|
2020-07-16 10:07:28 -04:00
|
|
|
INFONAME = info.yaml
|
2020-07-14 01:10:33 -04:00
|
|
|
|
|
|
|
# SMALL = thumbnails, MED = single pages (link to full size)
|
|
|
|
SMALL := 200
|
2020-07-17 06:29:13 -04:00
|
|
|
MED := 1000
|
2020-07-14 01:10:33 -04:00
|
|
|
|
2020-07-16 10:07:28 -04:00
|
|
|
MAKEPAGES = $(TMPDIR)/make-pages
|
2020-07-14 01:10:33 -04:00
|
|
|
|
2020-07-17 06:29:13 -04:00
|
|
|
YAMLS != find $(DATADIR) -name $(INFONAME)
|
2020-07-15 05:58:44 -04:00
|
|
|
|
2020-07-17 06:29:13 -04:00
|
|
|
SCRIPTS := $(wildcard script/*.js)
|
2020-07-18 05:44:30 -04:00
|
|
|
|
|
|
|
STYLES := $(wildcard style/*.css)
|
|
|
|
STYLESVGS = $(wildcard style/*.svg)
|
|
|
|
STYLEPNGS = $(wildcard style/*.png) \
|
|
|
|
$(STYLESVGS:.svg=.png) $(STYLESVGS:.svg=_small.png)
|
|
|
|
|
2020-07-17 06:29:13 -04:00
|
|
|
FONTS := $(shell find fonts \
|
|
|
|
-iname '*.eot' -or -iname '*.svg' -or \
|
|
|
|
-iname '*.ttf' -or -iname '*.woff' -or \
|
|
|
|
-iname '*.woff2' -or -iname '*.css')
|
2020-07-18 05:44:30 -04:00
|
|
|
|
|
|
|
STATIC := $(SCRIPTS) $(STYLES) $(STYLEPNGS) $(STYLESVGS) $(FONTS)
|
2020-07-17 06:29:13 -04:00
|
|
|
BSTATIC := $(patsubst %,$(BUILDDIR)/%,$(STATIC))
|
|
|
|
|
|
|
|
all: make-pages $(BUILDDIR)/index.html $(BSTATIC)
|
|
|
|
|
|
|
|
$(BUILDDIR)/%: %
|
|
|
|
echo "[copy] "$@
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
cp $< $@
|
2020-07-15 05:58:44 -04:00
|
|
|
|
2020-07-18 05:44:30 -04:00
|
|
|
$(BUILDDIR)/%: $(TMPDIR)/%
|
|
|
|
echo "[copy] "$@
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
define inkscape =
|
|
|
|
echo "[svg] "$@
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
inkscape $< -e $@ -w $(1) >/dev/null
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(TMPDIR)/%.png: %.svg
|
|
|
|
$(call inkscape,32)
|
|
|
|
|
|
|
|
$(TMPDIR)/%_small.png: %.svg
|
|
|
|
$(call inkscape,16)
|
|
|
|
|
2020-07-16 10:29:32 -04:00
|
|
|
$(BUILDDIR)/index.html: $(DATADIR)/galleries.yaml $(MAKEPAGES)
|
2020-07-18 05:44:43 -04:00
|
|
|
echo "[index] "$@
|
2020-07-16 10:07:28 -04:00
|
|
|
mkdir -p $(dir $@)
|
2020-07-17 06:29:13 -04:00
|
|
|
$(MAKEPAGES) $(MPFLAGS) index $< -o $@
|
2020-07-15 14:09:40 -04:00
|
|
|
|
2020-07-17 06:29:13 -04:00
|
|
|
$(MAKEPAGES): make-pages/*.hs make-pages/make-pages.cabal
|
2020-07-16 10:07:28 -04:00
|
|
|
echo "[make-pages]"
|
|
|
|
mkdir -p $(dir $@)
|
2020-07-17 06:29:13 -04:00
|
|
|
cabal v2-build all -O0 -j
|
2020-07-16 10:07:28 -04:00
|
|
|
find dist-newstyle -name make-pages -executable -type f \
|
|
|
|
-exec cp {} $@ \;
|
2020-07-14 01:10:33 -04:00
|
|
|
|
2020-07-18 05:35:42 -04:00
|
|
|
$(TMPDIR)/galleries.mk: $(DATADIR)/galleries.yaml $(DATADIR) $(MAKEPAGES)
|
2020-07-17 06:29:13 -04:00
|
|
|
echo "[deps] "$@
|
2020-07-16 10:07:28 -04:00
|
|
|
mkdir -p $(dir $@)
|
2020-07-17 06:29:13 -04:00
|
|
|
$(MAKEPAGES) $(MPFLAGS) depend-gallery $< -o $@ \
|
2020-07-16 10:07:28 -04:00
|
|
|
-B $(BUILDDIR) -D $(DATADIR) -T $(TMPDIR) -I $(INFONAME)
|
2020-07-15 14:09:40 -04:00
|
|
|
|
2020-07-18 05:35:42 -04:00
|
|
|
-include $(TMPDIR)/galleries.mk
|
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-16 10:07:28 -04:00
|
|
|
echo "[clean]"
|
2020-07-15 05:58:44 -04:00
|
|
|
rm -rf $(BUILDDIR) $(TMPDIR)
|
|
|
|
distclean: clean
|
2020-07-16 10:07:28 -04:00
|
|
|
echo "[distclean]"
|
2020-07-15 05:58:44 -04:00
|
|
|
rm -rf dist-newstyle
|
2020-07-16 10:07:28 -04:00
|
|
|
|
|
|
|
.SILENT:
|