Add Makefile for blog compilation and deployment
This commit is contained in:
parent
9c7a4ff039
commit
0bbbbcd85e
1 changed files with 43 additions and 0 deletions
43
Makefile
Normal file
43
Makefile
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# pelican variables
|
||||||
|
P_OUTPUT?=output
|
||||||
|
P_OPT?=
|
||||||
|
|
||||||
|
# deploy variables
|
||||||
|
D_BIN?=rsync
|
||||||
|
D_OPT?=-avz --delete
|
||||||
|
D_DST?="blog:$(D_FOLDER)"
|
||||||
|
|
||||||
|
# venv variables
|
||||||
|
|
||||||
|
VENV_SOURCE?=.venv
|
||||||
|
REQUIREMENT?=requirements.txt
|
||||||
|
PYTHON_BIN?=python
|
||||||
|
VENV_CMD?=. $(VENV_SOURCE)/bin/activate
|
||||||
|
|
||||||
|
# Pelican part
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: $(VENV_SOURCE)/dep
|
||||||
|
$(VENV_CMD) && pelican -o $(P_OUTPUT) $(P_OPT)
|
||||||
|
|
||||||
|
.PHONY: deploy
|
||||||
|
deploy:
|
||||||
|
[ -d $(P_OUTPUT) ] && $(D_BIN) $(D_OPT) $(P_OUTPUT)/ $(D_DST)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
[ -d $(P_OUTPUT) ] && rm -rf $(P_OUTPUT)
|
||||||
|
|
||||||
|
# venv management
|
||||||
|
$(VENV_SOURCE):
|
||||||
|
$(PYTHON_BIN) -m venv $(VENV_SOURCE)
|
||||||
|
|
||||||
|
$(REQUIREMENT):
|
||||||
|
|
||||||
|
$(VENV_SOURCE)/dep: $(VENV_SOURCE) $(REQUIREMENT)
|
||||||
|
touch $(VENV_SOURCE)/dep
|
||||||
|
$(VENV_CMD) && pip install -r $(REQUIREMENT)
|
||||||
|
|
||||||
|
.PHONY: clean-venv
|
||||||
|
clean-venv:
|
||||||
|
[ -d $(VENV_SOURCE) ] && rm -rf $(VENV_SOURCE)
|
Loading…
Add table
Add a link
Reference in a new issue