gallery/Makefile

59 lines
1.4 KiB
Makefile
Raw Normal View History

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)
STYLES := $(wildcard style/*.css style/*.png)
FONTS := $(shell find fonts \
-iname '*.eot' -or -iname '*.svg' -or \
-iname '*.ttf' -or -iname '*.woff' -or \
-iname '*.woff2' -or -iname '*.css')
STATIC := $(SCRIPTS) $(STYLES) $(FONTS)
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-16 10:29:32 -04:00
$(BUILDDIR)/index.html: $(DATADIR)/galleries.yaml $(MAKEPAGES)
2020-07-16 10:07:28 -04:00
echo "[index]"
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: