knazarov.com/Makefile

53 lines
1.5 KiB
Makefile

ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
ODIR=output
PAGES_SRC := $(wildcard content/pages/*)
PAGES_DST := $(patsubst content/pages/%,$(ODIR)/%/index.html,$(PAGES_SRC))
PROJECTS_SRC := $(wildcard content/projects/*)
PROJECTS_DST := $(patsubst content/projects/%,$(ODIR)/projects/%/index.html,$(PROJECTS_SRC))
POSTS_SRC := $(wildcard content/posts/*)
POSTS_DST := $(patsubst content/posts/%,$(ODIR)/posts/%/index.html,$(POSTS_SRC))
all: $(PAGES_DST) $(PROJECTS_DST) $(POSTS_DST) $(ODIR)/style.css $(ODIR)/index.html $(ODIR)/posts/index.html $(ODIR)/rss.xml
$(ODIR)/%/index.html: content/pages/%/note.md
mkdir -p "$(dir $@)"
cat "$<" | ./bin/mdpage.sh --notitle > "$@"
$(ODIR)/projects/%/index.html: content/projects/%/note.md
mkdir -p "$(dir $@)"
cat "$<" | ./bin/mdpage.sh > "$@"
$(ODIR)/posts/%/index.html: content/posts/%/note.md
mkdir -p "$(dir $@)"
cat "$<" | ./bin/mdpage.sh > "$@"
$(ODIR)/posts/index.html: $(POSTS_SRC)
./bin/toc.sh content/posts "/posts" | awk -f ./bin/markdown.awk | ./bin/page.sh Posts > "$@"
$(ODIR)/rss.xml: $(POSTS_SRC)
./bin/rss.sh content/posts "https://knazarov.com" "/posts" > "$@"
$(ODIR)/index.html: content/index.md
cat content/index.md | ./bin/mdpage.sh --notitle > "$@"
$(ODIR)/style.css: style.css
cp style.css $(ODIR)/style.css
clean:
rm -rf $(ODIR)/*
deploy:
rsync -avP --delete output/ root@knazarov.com:/var/www/knazarov.com/
serve:
darkhttpd output/
install:
install -d $(DESTDIR)$(PREFIX)/srv/knazarov.com
rsync -av --no-o --no-g output/ $(DESTDIR)$(PREFIX)/srv/knazarov.com