grid.in.th/Makefile -rw-r--r-- 1.1 KiB View raw
                                                                                
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
POETRY?=	poetry
PELICAN?=	${POETRY} run pelican
PORT?=		8000

BASEDIR!=	pwd
CONTENT?=	${BASEDIR}/content
OUTPUT?=	${BASEDIR}/output
CONF_LOCAL?=	${BASEDIR}/pelicanconf.py
CONF_PUBLISH?=	${BASEDIR}/publishconf.py

RSYNC?=		rsync
RSYNC_TARGET?=	sirn_gridth@ssh.phx.nearlyfreespeech.net:grid.in.th
RSYNC_SSH?=	ssh -o UserKnownHostsFile=${BASEDIR}/known_hosts

SRCS!=		find content/ themes/ -type f


## Default target
## This would be unnecessary if Gmake support .MAIN. Sigh.
##

all: setup html

.PHONY: all


## Setup
##

.setup: pyproject.toml
	${POETRY} install
	@touch .setup

setup: .setup

.PHONY: setup


## Local
##

preview: setup
	${PELICAN} ${CONTENT} -o ${OUTPUT} -s ${CONF_LOCAL}

clean:
	rm -rf "${OUTPUT}"
	rm -f .setup
	rm -f .html

serve: setup
	${PELICAN} -lr ${CONTENT} -o ${OUTPUT} -s ${CONF_LOCAL} -p ${PORT}

.PHONY: preview clean serve


## Publish
##

.html: ${SRCS}
	${PELICAN} ${CONTENT} -o ${OUTPUT} -s ${CONF_PUBLISH}
	@touch .html

html: .html

publish: html
	${RSYNC} -rpcLDvz \
		-e "${RSYNC_SSH}" \
		--chmod=D0755,F0644 \
		--exclude=.webassets-cache \
		${OUTPUT}/ \
		${RSYNC_TARGET}

.PHONY: html publish