From 6eabbccae7260fe7335832de9cbc66259fe2dfb1 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Sat, 18 Jul 2020 11:58:41 +0200 Subject: [PATCH] clean up makefile slightly --- Makefile | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 8e9dff0..14603b1 100644 --- a/Makefile +++ b/Makefile @@ -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)/