-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (66 loc) · 2.84 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.DEFAULT_GOAL := help
.PHONY: help
include .env
export
PY?=python3
PELICAN?=pelican
PELICANOPTS=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
BLOG_COMPOSE_FILE := docker-compose.dev.yml
DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif
RELATIVE ?= 0
ifeq ($(RELATIVE), 1)
PELICANOPTS += --relative-urls
endif
help: ## Print this help
@echo 'Makefile for a pelican Web site'
@echo ''
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
@echo 'Set the RELATIVE variable to 1 to enable relative urls'
@echo ''
@grep -E '^[0-9a-zA-Z_\-\.]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
html: ## (re)generate the web site
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
clean: ## remove the generated files
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
regenerate: ## regenerate files upon modification
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
serve: ## serve site at http://localhost:8000
ifdef PORT
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
#$(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
else
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
#$(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
endif
serve-global: ## serve (as root) to $(SERVER):80
ifdef SERVER
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b $(SERVER)
# $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b $(SERVER)
else
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0
endif
devserver: ## serve and regenerate together
ifdef PORT
$(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0
else
$(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0
endif
publish: ## generate html using production settings
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
requirements.txt: ## generate requirements.txt and requirements-dev.txt from pyproject.toml using poetry
poetry export -f requirements.txt --without-hashes --only main -o requirements.txt &&\
poetry export -f requirements.txt --without-hashes --only dev -o requirements-dev.txt
docker.publish: ## runs make publish from docker
docker compose -f docker-compose.dev.yml run --rm --entrypoint make blog publish
docker.html: ## runs make html from docker
docker compose -f docker-compose.dev.yml run --rm --entrypoint make blog html
docker.serve: ## runs make html from docker
docker compose -f docker-compose.dev.yml run --rm --service-ports --entrypoint make blog devserver