2018-06-06 04:33:59 +08:00
|
|
|
MDS := $(wildcard src/*.md src/*/*.md)
|
|
|
|
HTMLS := $(MDS:.md=.html)
|
|
|
|
PUBLISH_DIR := ../published/ # ul.elvish.io:elvish.io/published
|
|
|
|
|
|
|
|
default: gen
|
|
|
|
|
|
|
|
%.html: %.md tools/macros tools/highlighter tools/md-to-html
|
|
|
|
./tools/md-to-html $< $@
|
|
|
|
|
2018-06-06 04:38:39 +08:00
|
|
|
# For building tools/*.
|
2018-06-06 04:33:59 +08:00
|
|
|
%: %.go
|
|
|
|
go build -o $@ $<
|
|
|
|
|
2018-06-06 04:38:39 +08:00
|
|
|
# Generates the website into the dst directory.
|
2018-06-06 04:33:59 +08:00
|
|
|
gen: $(HTMLS)
|
|
|
|
genblog src dst
|
|
|
|
|
2018-06-06 04:38:39 +08:00
|
|
|
# Installs or updates genblog.
|
2018-06-06 04:33:59 +08:00
|
|
|
genblog:
|
|
|
|
cd $(GOPATH)/src/github.com/xiaq/genblog; \
|
|
|
|
git pull; \
|
|
|
|
go generate; \
|
|
|
|
go get
|
|
|
|
genblog -print-default-css > assets/genblog.css
|
|
|
|
|
2018-06-06 04:38:39 +08:00
|
|
|
# Copies the generated website into $(PUBLISH_DIR).
|
2018-06-06 04:33:59 +08:00
|
|
|
publish: gen
|
|
|
|
rsync -aLv --delete ./dst/ $(PUBLISH_DIR)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm $(HTMLS)
|
|
|
|
|
|
|
|
.PHONY: default gen genblog publish clean
|