clean up makefile slightly

This commit is contained in:
Rhiannon Morris 2020-07-18 11:58:41 +02:00
parent 63d9b5a5cb
commit 6eabbccae7

View file

@ -26,17 +26,15 @@ FONTS := $(shell find fonts \
STATIC := $(SCRIPTS) $(STYLES) $(STYLEPNGS) $(STYLESVGS) $(FONTS)
BSTATIC := $(patsubst %,$(BUILDDIR)/%,$(STATIC))
all: make-pages $(BUILDDIR)/index.html $(BSTATIC)
.PHONY: all build
all: build
build: $(BUILDDIR)/index.html $(BSTATIC)
$(BUILDDIR)/%: %
echo "[copy] "$@
$(BUILDDIR)/index.html: $(DATADIR)/galleries.yaml $(MAKEPAGES)
echo "[index] "$@
mkdir -p $(dir $@)
cp $< $@
$(MAKEPAGES) $(MPFLAGS) index $< -o $@
$(BUILDDIR)/%: $(TMPDIR)/%
echo "[copy] "$@
mkdir -p $(dir $@)
cp $< $@
define inkscape =
echo "[svg] "$@
@ -50,10 +48,17 @@ $(TMPDIR)/%.png: %.svg
$(TMPDIR)/%_small.png: %.svg
$(call inkscape,16)
$(BUILDDIR)/index.html: $(DATADIR)/galleries.yaml $(MAKEPAGES)
echo "[index] "$@
$(BUILDDIR)/%: %
echo "[copy] "$@
mkdir -p $(dir $@)
$(MAKEPAGES) $(MPFLAGS) index $< -o $@
cp $< $@
$(BUILDDIR)/%: $(TMPDIR)/%
echo "[copy] "$@
mkdir -p $(dir $@)
cp $< $@
$(MAKEPAGES): make-pages/*.hs make-pages/make-pages.cabal
echo "[make-pages]"
@ -62,6 +67,7 @@ $(MAKEPAGES): make-pages/*.hs make-pages/make-pages.cabal
find dist-newstyle -name make-pages -executable -type f \
-exec cp {} $@ \;
$(TMPDIR)/galleries.mk: $(DATADIR)/galleries.yaml $(DATADIR) $(MAKEPAGES)
echo "[deps] "$@
mkdir -p $(dir $@)
@ -70,6 +76,7 @@ $(TMPDIR)/galleries.mk: $(DATADIR)/galleries.yaml $(DATADIR) $(MAKEPAGES)
-include $(TMPDIR)/galleries.mk
.PHONY: clean distclean
clean:
echo "[clean]"
@ -84,7 +91,8 @@ REMOTE_USER ?= www-data
IDFILE ?= ~/.ssh/xyz
REMOTE_DIR ?= gallery
upload: $(BUILDDIR)/index.html
.PHONY: upload
upload: build
@rsync -rPLzh --delete -e 'ssh -l $(REMOTE_USER) -i $(IDFILE)' \
$(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/