summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c333c4cebcaf0fdeb5e9a2da5186dba37f9d6d9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.PHONY: all
all: clean linklog build

.PHONY: linklog
linklog:
	./update-linklog-json.sh

.PHONY: build
build: clean
	@echo "Building project..."

	# Build html
	ln -s templates_html templates
	zola build -o public_html
	unlink templates || true

	# Copy extra HTML pages
	(cd extra_pages_html && cp -a . ../public_html/)

	# Build gemini
	ln -s templates_gmi templates
	zola build -o public_gmi
	find public_gmi -type f -name '*.html' -exec sh -c \
		'for html do mv "$$html" "$${html%.html}.gmi"; done' sh {} +
	# Convert HTML blocks to gemtext
	./convert_gmi_html.py public_gmi
	unlink templates || true

.PHONY: dev
dev:
	unlink templates || true
	ln -s templates_html templates
	@echo "Starting development server..."
	trap 'unlink templates || true' EXIT; zola serve --drafts

.PHONY: deploy
deploy:
	@echo "Deploying project..."
	rsync -rvzP --delete --chown 80:80 public_html/* $(RSYNC_TARGET_HTML)
	rsync -rvzP --delete --chown 80:80 public_gmi/*  $(RSYNC_TARGET_GMI)

.PHONY: clean
clean:
	@echo "Cleaning project..."
	unlink templates || true
	rm -rf public*