53 lines
1.1 KiB
Makefile
53 lines
1.1 KiB
Makefile
TMPDIR ?= _tmp
|
|
BUILDDIR ?= _build
|
|
PAGESDIR ?= pages
|
|
DATADIR ?= data
|
|
TEMPLATE ?= $(DATADIR)/template.html
|
|
|
|
STATICEXTS := yaml
|
|
|
|
PAGES != find $(PAGESDIR) -name '*.md'
|
|
STATICS != parallel find $(PAGESDIR) -name '\*.{}' ::: $(STATICEXTS)
|
|
OUTPUTPAGES = \
|
|
$(patsubst $(PAGESDIR)/%.md,$(BUILDDIR)/%.html,$(PAGES)) \
|
|
$(patsubst $(PAGESDIR)/%,$(BUILDDIR)/%,$(STATICS))
|
|
|
|
STYLE != find style -type f
|
|
OUTPUTSTYLE = $(patsubst %,$(BUILDDIR)/%,$(STYLE))
|
|
|
|
OUTPUT = $(OUTPUTPAGES) $(OUTPUTSTYLE)
|
|
|
|
LANGFILTER = $(TMPDIR)/langfilter
|
|
EXECS = $(LANGFILTER)
|
|
|
|
.PHONY: all
|
|
all: build
|
|
|
|
.PHONY: build
|
|
build: $(OUTPUT)
|
|
|
|
$(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER)
|
|
mkdir -p $(dir $@)
|
|
pandoc -s --toc --template $(TEMPLATE) \
|
|
--filter $(LANGFILTER) -o $@ $<
|
|
|
|
$(BUILDDIR)/%: $(PAGESDIR)/%
|
|
mkdir -p $(dir $@)
|
|
cp $< $@
|
|
|
|
$(BUILDDIR)/%: %
|
|
mkdir -p $(dir $@)
|
|
cp $< $@
|
|
|
|
$(LANGFILTER): langfilter/*.hs langfilter/langfilter.cabal
|
|
mkdir -p $(dir $@)
|
|
cabal build -v0 all
|
|
find dist-newstyle -name $(notdir $@) \
|
|
-print -type f -exec cp {} $(TMPDIR) \;
|
|
|
|
|
|
.PHONY: clean distclean
|
|
clean:
|
|
rm -rf $(BUILDDIR)
|
|
distclean: clean
|
|
rm -rf $(TMPDIR)
|