makefile tweaks

This commit is contained in:
Rhiannon Morris 2021-05-20 22:45:10 +02:00
parent f148d06e03
commit bb903be015

View file

@ -26,7 +26,7 @@ LANGFILTER = $(TMPDIR)/langfilter
LAANTAS_SCRIPT = $(TMPDIR)/laantas-script
EXECS = $(LANGFILTER)
CABAL_FLAGS ?= -O
CABAL_FLAGS ?= -O -v0
.PHONY: all
all: build
@ -35,6 +35,7 @@ all: build
build: $(OUTPUT)
$(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER) $(LAANTAS_SCRIPT)
@echo "[pandoc] $<"
mkdir -p $(dir $@)
LAANTAS_SCRIPT="$(LAANTAS_SCRIPT)" \
DIRNAME="$(subst $(PAGESDIR),$(BUILDDIR),$(dir $<))" \
@ -42,35 +43,48 @@ $(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER) $(LAANTAS_SCRIPT)
--filter $(LANGFILTER)
$(BUILDDIR)/%: $(PAGESDIR)/%
mkdir -p $(dir $@)
cp $< $@
$(copy)
$(BUILDDIR)/%: %
$(copy)
define copy
@echo "[copy] $<"
mkdir -p $(dir $@)
cp $< $@
endef
$(LANGFILTER): langfilter/*.hs langfilter/langfilter.cabal
cabal build langfilter $(CABAL_FLAGS)
mkdir -p $(dir $@)
find dist-newstyle -name $(notdir $@) \
-print -type f -exec cp {} $(TMPDIR) \;
$(cabal-exe)
$(LAANTAS_SCRIPT): laantas-script/*.hs laantas-script/laantas-script.cabal
cabal build laantas-script $(CABAL_FLAGS)
$(LAANTAS_SCRIPT): laantas-script/*
$(cabal-exe)
define cabal-exe
@echo "[build] $(notdir $@)"
cabal build $(notdir $@) $(CABAL_FLAGS)
mkdir -p $(dir $@)
find dist-newstyle -name $(notdir $@) \
-type f -exec cp {} $(TMPDIR) \;
find dist-newstyle -name $(notdir $@) -type f -exec cp {} $(TMPDIR) \;
endef
upload: build
@rsync -rPLzh --delete -e 'ssh -l $(REMOTE_USER) -i $(IDFILE)' \
@echo "[upload]"
@rsync --recursive --partial --progress --copy-links \
--compress --human-readable --hard-links --size-only \
--delete --delete-after \
--rsh='ssh -l $(REMOTE_USER) -i $(IDFILE)' \
$(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/
.PHONY: clean distclean
clean:
@echo "[clean]"
rm -rf $(BUILDDIR)
distclean: clean
rm -rf $(TMPDIR)
distclean: clean
@echo "[distclean]"
cabal clean
.SILENT: