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