makefile tweaks
This commit is contained in:
parent
f148d06e03
commit
bb903be015
1 changed files with 31 additions and 17 deletions
48
Makefile
48
Makefile
|
@ -26,7 +26,7 @@ LANGFILTER = $(TMPDIR)/langfilter
|
||||||
LAANTAS_SCRIPT = $(TMPDIR)/laantas-script
|
LAANTAS_SCRIPT = $(TMPDIR)/laantas-script
|
||||||
EXECS = $(LANGFILTER)
|
EXECS = $(LANGFILTER)
|
||||||
|
|
||||||
CABAL_FLAGS ?= -O
|
CABAL_FLAGS ?= -O -v0
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build
|
all: build
|
||||||
|
@ -35,6 +35,7 @@ all: build
|
||||||
build: $(OUTPUT)
|
build: $(OUTPUT)
|
||||||
|
|
||||||
$(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER) $(LAANTAS_SCRIPT)
|
$(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER) $(LAANTAS_SCRIPT)
|
||||||
|
@echo "[pandoc] $<"
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
LAANTAS_SCRIPT="$(LAANTAS_SCRIPT)" \
|
LAANTAS_SCRIPT="$(LAANTAS_SCRIPT)" \
|
||||||
DIRNAME="$(subst $(PAGESDIR),$(BUILDDIR),$(dir $<))" \
|
DIRNAME="$(subst $(PAGESDIR),$(BUILDDIR),$(dir $<))" \
|
||||||
|
@ -42,35 +43,48 @@ $(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER) $(LAANTAS_SCRIPT)
|
||||||
--filter $(LANGFILTER)
|
--filter $(LANGFILTER)
|
||||||
|
|
||||||
$(BUILDDIR)/%: $(PAGESDIR)/%
|
$(BUILDDIR)/%: $(PAGESDIR)/%
|
||||||
mkdir -p $(dir $@)
|
$(copy)
|
||||||
cp $< $@
|
|
||||||
|
|
||||||
$(BUILDDIR)/%: %
|
$(BUILDDIR)/%: %
|
||||||
mkdir -p $(dir $@)
|
$(copy)
|
||||||
cp $< $@
|
|
||||||
|
define copy
|
||||||
|
@echo "[copy] $<"
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
cp $< $@
|
||||||
|
endef
|
||||||
|
|
||||||
$(LANGFILTER): langfilter/*.hs langfilter/langfilter.cabal
|
$(LANGFILTER): langfilter/*.hs langfilter/langfilter.cabal
|
||||||
cabal build langfilter $(CABAL_FLAGS)
|
$(cabal-exe)
|
||||||
mkdir -p $(dir $@)
|
|
||||||
find dist-newstyle -name $(notdir $@) \
|
|
||||||
-print -type f -exec cp {} $(TMPDIR) \;
|
|
||||||
|
|
||||||
$(LAANTAS_SCRIPT): laantas-script/*.hs laantas-script/laantas-script.cabal
|
$(LAANTAS_SCRIPT): laantas-script/*
|
||||||
cabal build laantas-script $(CABAL_FLAGS)
|
$(cabal-exe)
|
||||||
mkdir -p $(dir $@)
|
|
||||||
find dist-newstyle -name $(notdir $@) \
|
define cabal-exe
|
||||||
-type f -exec cp {} $(TMPDIR) \;
|
@echo "[build] $(notdir $@)"
|
||||||
|
cabal build $(notdir $@) $(CABAL_FLAGS)
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
find dist-newstyle -name $(notdir $@) -type f -exec cp {} $(TMPDIR) \;
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
upload: build
|
upload: build
|
||||||
@rsync -rPLzh --delete -e 'ssh -l $(REMOTE_USER) -i $(IDFILE)' \
|
@echo "[upload]"
|
||||||
$(BUILDDIR)/ $(HOST):$(REMOTE_DIR)/
|
@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
|
.PHONY: clean distclean
|
||||||
clean:
|
clean:
|
||||||
|
@echo "[clean]"
|
||||||
rm -rf $(BUILDDIR)
|
rm -rf $(BUILDDIR)
|
||||||
distclean: clean
|
|
||||||
rm -rf $(TMPDIR)
|
rm -rf $(TMPDIR)
|
||||||
|
distclean: clean
|
||||||
|
@echo "[distclean]"
|
||||||
cabal clean
|
cabal clean
|
||||||
|
|
||||||
|
.SILENT:
|
||||||
|
|
Loading…
Reference in a new issue