-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
70 lines (48 loc) · 1.19 KB
/
Makefile
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
PY?=python3
PELICAN?=pelican
PELICANOPTS=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
PUBLICDIR=$(BASEDIR)/public
OUTPUTDIR=$(BASEDIR)/public
CONFFILE=$(BASEDIR)/pelicanconf.py
.PHONY: default
default: theme-prod content-prod
.PHONY: dev
dev:
yarn
cd theme && yarn
node_modules/.bin/nf start
.PHONY: theme
theme: yarn-install
cd theme && yarn start
.PHONY: theme-prod
theme-prod: yarn-install
cd theme && yarn run build
.PHONY: content
content: poetry-install
PYTHONUNBUFFERED=no poetry run $(PELICAN) $(INPUTDIR) --output $(OUTPUTDIR) --settings $(CONFFILE) -r $(PELICANOPTS)
.PHONY: content-prod
content-prod: poetry-install
PYTHON_ENV=production poetry run $(PELICAN) $(INPUTDIR) --output $(OUTPUTDIR) --settings $(CONFFILE) $(PELICANOPTS)
.PHONY: poetry-install
poetry-install:
if ! poetry --version; then \
pip install poetry; \
fi
poetry install
.PHONY: yarn-install
yarn-install:
yarn install
.PHONY: clean
rm -rf $(OUTPUTDIR)
.PHONY: serve
serve:
mkdir -p $(PUBLICDIR)
ifdef PORT
@echo Serving on http://0.0.0.0:$(PORT)/ ...
cd $(PUBLICDIR) && $(PY) -m http.server $(PORT)
else
@echo Serving on http://0.0.0.0:8000/ ...
cd $(PUBLICDIR) && $(PY) -m http.server 8000
endif