lang/Makefile

44 lines
929 B
Makefile
Raw Normal View History

2020-08-18 03:35:36 -04:00
TMPDIR ?= _tmp
BUILDDIR ?= _build
PAGESDIR ?= pages
DATADIR ?= data
TEMPLATE ?= $(DATADIR)/template.html
PAGES != find $(PAGESDIR) -name '*.md'
OUTPUTPAGES = $(patsubst $(PAGESDIR)/%.md,$(BUILDDIR)/%.html,$(PAGES))
2020-08-18 04:33:25 -04:00
STYLE != find style -type f
OUTPUTSTYLE = $(patsubst %,$(BUILDDIR)/%,$(STYLE))
OUTPUT = $(OUTPUTPAGES) $(OUTPUTSTYLE)
2020-08-18 03:35:36 -04:00
2020-08-18 12:33:25 -04:00
LANGFILTER = $(TMPDIR)/langfilter
EXECS = $(LANGFILTER)
2020-08-18 03:35:36 -04:00
.PHONY: all
all: build
.PHONY: build
2020-08-18 04:33:25 -04:00
build: $(OUTPUT)
2020-08-18 03:35:36 -04:00
2020-08-18 12:33:25 -04:00
$(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER)
2020-08-18 03:35:36 -04:00
mkdir -p $(dir $@)
2020-08-18 12:33:25 -04:00
pandoc -s --toc --template $(TEMPLATE) --filter $(LANGFILTER) -o $@ $<
2020-08-18 03:35:36 -04:00
2020-08-18 04:33:25 -04:00
$(BUILDDIR)/%: %
mkdir -p $(dir $@)
cp $< $@
2020-08-18 12:33:25 -04:00
$(LANGFILTER): langfilter/*.hs langfilter/langfilter.cabal
mkdir -p $(dir $@)
cabal build -v0 all
find dist-newstyle -name $(notdir $@) \
-print -type f -exec cp {} $(TMPDIR) \;
2020-08-18 03:35:36 -04:00
.PHONY: clean distclean
clean:
rm -rf $(BUILDDIR)
distclean: clean
rm -rf $(TMPDIR)