knazarov.com/Makefile

54 lines
1.6 KiB
Makefile
Raw Normal View History

2023-06-11 17:41:26 +00:00
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
2021-08-15 20:11:40 +00:00
ODIR=output
2023-06-11 17:41:26 +00:00
2021-08-19 21:25:18 +00:00
PAGES_SRC := $(wildcard content/pages/*)
PAGES_DST := $(patsubst content/pages/%,$(ODIR)/%/index.html,$(PAGES_SRC))
2021-08-15 20:11:40 +00:00
2021-08-19 21:25:18 +00:00
PROJECTS_SRC := $(wildcard content/projects/*)
PROJECTS_DST := $(patsubst content/projects/%,$(ODIR)/projects/%/index.html,$(PROJECTS_SRC))
2021-08-19 21:25:18 +00:00
POSTS_SRC := $(wildcard content/posts/*)
POSTS_DST := $(patsubst content/posts/%,$(ODIR)/posts/%/index.html,$(POSTS_SRC))
2021-09-12 16:16:30 +00:00
all: $(PAGES_DST) $(PROJECTS_DST) $(POSTS_DST) $(ODIR)/style.css $(ODIR)/index.html $(ODIR)/posts/index.html $(ODIR)/rss.xml
2021-08-15 20:11:40 +00:00
2021-08-19 21:25:18 +00:00
$(ODIR)/%/index.html: content/pages/%/note.md
mkdir -p "$(dir $@)"
2021-08-19 21:25:18 +00:00
cat "$<" | ./bin/mdpage.sh --notitle > "$@"
2021-08-19 21:25:18 +00:00
$(ODIR)/projects/%/index.html: content/projects/%/note.md
2021-08-15 20:11:40 +00:00
mkdir -p "$(dir $@)"
2021-08-19 21:25:18 +00:00
cat "$<" | ./bin/mdpage.sh > "$@"
2021-08-15 20:11:40 +00:00
2021-08-19 21:25:18 +00:00
$(ODIR)/posts/%/index.html: content/posts/%/note.md
mkdir -p "$(dir $@)"
2021-08-19 21:25:18 +00:00
cat "$<" | ./bin/mdpage.sh > "$@"
$(ODIR)/posts/index.html: $(POSTS_SRC)
2021-08-19 21:25:18 +00:00
./bin/toc.sh content/posts "/posts" | awk -f ./bin/markdown.awk | ./bin/page.sh Posts > "$@"
2021-09-12 16:16:30 +00:00
$(ODIR)/rss.xml: $(POSTS_SRC)
./bin/rss.sh content/posts "https://knazarov.com" "/posts" > "$@"
2021-08-19 21:25:18 +00:00
$(ODIR)/index.html: content/index.md
cat content/index.md | ./bin/mdpage.sh --notitle > "$@"
2021-08-15 20:11:40 +00:00
$(ODIR)/style.css: style.css
cp style.css $(ODIR)/style.css
clean:
rm -rf $(ODIR)/*
2021-08-21 14:15:20 +00:00
deploy:
rsync -avP --delete output/ root@knazarov.com:/var/www/knazarov.com/
2021-08-21 16:43:11 +00:00
2023-06-11 17:41:26 +00:00
install:
install -d $(DESTDIR)$(PREFIX)/srv/knazarov.com
rsync -av --no-o --no-g output/ $(DESTDIR)$(PREFIX)/srv/knazarov.com
2021-08-21 16:43:11 +00:00
analytics:
2023-06-11 17:41:26 +00:00
ssh root@knazarov.com "cat /var/log/nginx/access.log" | ./bin/analytics.sh