knazarov.com/Makefile

59 lines
1.7 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))
2023-08-19 17:30:05 +00:00
all: $(PAGES_DST) $(PROJECTS_DST) $(POSTS_DST) $(ODIR)/style.css $(ODIR)/favicon.ico $(ODIR)/index.html $(ODIR)/posts/index.html $(ODIR)/rss.xml $(ODIR)/rss.png
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)
2023-08-17 22:59:22 +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" > "$@"
2023-08-02 19:47:54 +00:00
$(ODIR)/rss.png: rss.png
cp rss.png $(ODIR)/rss.png
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
2023-08-19 17:30:05 +00:00
$(ODIR)/favicon.ico: favicon.ico
cp favicon.ico $(ODIR)/favicon.ico
2021-08-15 20:11:40 +00:00
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-12 12:40:15 +00:00
serve:
darkhttpd output/
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