knazarov.com/Makefile
2024-09-09 00:32:01 +01:00

45 lines
1.4 KiB
Makefile

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/
analytics:
ssh root@knazarov.com "cat /var/log/nginx/access.log" | ./bin/analytics.sh