use long flags in makefile

This commit is contained in:
Rhiannon Morris 2021-03-07 20:49:25 +01:00
parent 9c11993f7e
commit da23a052f0

View file

@ -1,3 +1,5 @@
CABALFLAGS ?= --verbose=0 --jobs
DATADIR := data DATADIR := data
TMPDIR := _tmp TMPDIR := _tmp
BUILDDIR := _build BUILDDIR := _build
@ -33,14 +35,14 @@ build: $(BUILDDIR)/index.html $(BSTATIC)
$(BUILDDIR)/index.html: $(DATADIR)/index.yaml $(MAKEPAGES) $(BUILDDIR)/index.html: $(DATADIR)/index.yaml $(MAKEPAGES)
echo "[index] "$@ echo "[index] "$@
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(MAKEPAGES) $(MPFLAGS) index -R $(ROOT) $< -o $@ $(MAKEPAGES) $(MPFLAGS) index --root $(ROOT) $< --output $@
$(BUILDDIR)/%: % $(BUILDDIR)/%: %
$(call copy) $(call copy)
$(BUILDDIR)/%: $(TMPDIR)/% $(BUILDDIR)/%: $(TMPDIR)/%
$(call copy,-l) $(call copy,--link)
$(TMPDIR)/%_small.png: $(DATADIR)/%.png $(TMPDIR)/%_small.png: $(DATADIR)/%.png
@ -60,7 +62,7 @@ $(TMPDIR)/%_med.jpg: $(DATADIR)/%.jpg
$(MAKEPAGES): make-pages/*.hs make-pages/make-pages.cabal $(MAKEPAGES): make-pages/*.hs make-pages/make-pages.cabal
echo "[make-pages]" echo "[make-pages]"
mkdir -p $(dir $@) mkdir -p $(dir $@)
cabal v2-build all -O0 -v0 -j cabal v2-build all $(CABALFLAGS)
find dist-newstyle -name make-pages -executable -type f \ find dist-newstyle -name make-pages -executable -type f \
-exec cp {} $@ \; -exec cp {} $@ \;
@ -87,12 +89,12 @@ distclean: clean
echo "[clean $(TMPDIR)]" echo "[clean $(TMPDIR)]"
rm -rf $(TMPDIR) rm -rf $(TMPDIR)
echo "[cabal clean]" echo "[cabal clean]"
cabal -v0 v2-clean cabal --verbose=0 v2-clean
.PHONY: list-tags .PHONY: list-tags
list-tags: $(MAKEPAGES) list-tags: $(MAKEPAGES)
$(MAKEPAGES) list-tags -Un $(MAKEPAGES) list-tags --untagged --nsfw
HOST ?= gallery.niss.website HOST ?= gallery.niss.website
@ -105,7 +107,7 @@ upload: build
@rsync --recursive --partial --progress --copy-links \ @rsync --recursive --partial --progress --copy-links \
--compress --human-readable --hard-links --size-only \ --compress --human-readable --hard-links --size-only \
--delete --delete-after \ --delete --delete-after \
-e 'ssh -l $(REMOTE_USER) -i $(IDFILE)' \ --rsh='ssh -l $(REMOTE_USER) -i $(IDFILE)' \
$(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/ $(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/
@ -113,7 +115,7 @@ upload: build
define copy define copy
echo "[copy] "$@ echo "[copy] "$@
mkdir -p "$(dir $@)" mkdir -p "$(dir $@)"
cp $(1) -L "$^" "$@" cp $(1) --dereference "$^" "$@"
endef endef
# args: # args:
@ -131,8 +133,12 @@ endef
define depend-gallery define depend-gallery
echo "[deps] "$@ echo "[deps] "$@
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(MAKEPAGES) $(MPFLAGS) depend-gallery $< -o "$@" \ $(MAKEPAGES) $(MPFLAGS) depend-gallery $< \
-B "$(BUILDDIR)" -D "$(DATADIR)" -T "$(TMPDIR)" -I "$(INFONAME)" --output "$@" \
--build-dir "$(BUILDDIR)" \
--data-dir "$(DATADIR)" \
--tmp-dir "$(TMPDIR)" \
--info "$(INFONAME)"
endef endef
# args: # args:
@ -143,8 +149,11 @@ endef
define depend-single define depend-single
echo "[deps] "$@ echo "[deps] "$@
mkdir -p "$(dir $@)" mkdir -p "$(dir $@)"
$(MAKEPAGES) $(MPFLAGS) depend-single \ $(MAKEPAGES) $(MPFLAGS) depend-single $(4) \
$(4) -o "$@" -p "$(1)" -B "$(2)" -D "$(3)" $< --output "$@" \
--prefix "$(1)" \
--build-dir "$(2)" \
--data-dir "$(3)" $<
endef endef
# args # args
@ -154,7 +163,11 @@ endef
define gallery define gallery
echo "[gallery] "$@ echo "[gallery] "$@
mkdir -p "$(dir $@)" mkdir -p "$(dir $@)"
$(MAKEPAGES) $(MPFLAGS) gallery -i "$(1)" -R $(ROOT) -p "$(2)" $(3) -o "$@" \ $(MAKEPAGES) $(MPFLAGS) gallery $(3) \
--index "$(1)" \
--root "$(ROOT)" \
--prefix "$(2)" \
--output "$@" \
$(filter $(DATADIR)/%/$(INFONAME),$^) $(filter $(DATADIR)/%/$(INFONAME),$^)
endef endef
@ -165,7 +178,12 @@ endef
define single define single
echo "[single] "$@ echo "[single] "$@
mkdir -p "$(dir $@)" mkdir -p "$(dir $@)"
$(MAKEPAGES) $(MPFLAGS) single -R $(ROOT) -D "$(1)" -p "$(2)" $< -o "$@" $(3) $(MAKEPAGES) $(MPFLAGS) single $(3) \
--root $(ROOT) \
--data-dir "$(1)" \
--prefix "$(2)" \
--output "$@" \
$<
endef endef
# args: # args:
@ -176,8 +194,12 @@ endef
define rss define rss
echo "[rss] "$@ echo "[rss] "$@
mkdir -p "$(dir $@)" mkdir -p "$(dir $@)"
$(MAKEPAGES) $(MPFLAGS) rss -i "$(1)" \ $(MAKEPAGES) $(MPFLAGS) rss $(4) \
-R "$(ROOT)" -p "$(2)" -D "$(3)" -o "$@" $(4) \ --index "$(1)" \
--root "$(ROOT)" \
--prefix "$(2)" \
--data-dir "$(3)" \
--output "$@" \
$(filter $(DATADIR)/%/$(INFONAME),$^) $(filter $(DATADIR)/%/$(INFONAME),$^)
endef endef