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