mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 11:32:39 +02:00
57 lines
1.3 KiB
Makefile
57 lines
1.3 KiB
Makefile
PELICANOPTS=
|
|
|
|
BASEDIR=$(CURDIR)
|
|
INPUTDIR=$(BASEDIR)/content
|
|
OUTPUTDIR=$(BASEDIR)/output
|
|
CONFFILE=$(BASEDIR)/pelicanconf.py
|
|
PUBLISHCONF=$(BASEDIR)/publishconf.py
|
|
|
|
VENV := $(shell echo $${VIRTUAL_ENV-$(shell pwd)/.venv})
|
|
VIRTUALENV = virtualenv -p /usr/bin/python3.7
|
|
INSTALL_STAMP = $(VENV)/.install.stamp
|
|
|
|
PYTHON=$(VENV)/bin/python
|
|
PELICAN=$(VENV)/bin/pelican
|
|
PIP=$(VENV)/bin/pip
|
|
|
|
DEBUG ?= 0
|
|
ifeq ($(DEBUG), 1)
|
|
PELICANOPTS += -D
|
|
endif
|
|
|
|
install: $(INSTALL_STAMP)
|
|
$(INSTALL_STAMP): $(PYTHON) requirements.txt
|
|
$(VENV)/bin/pip install -r requirements.txt
|
|
touch $(INSTALL_STAMP)
|
|
|
|
virtualenv: $(PYTHON)
|
|
$(PYTHON):
|
|
$(VIRTUALENV) $(VENV)
|
|
|
|
html: install
|
|
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
|
|
|
|
clean:
|
|
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
|
|
rm -rf $(VENV)
|
|
|
|
serve: install
|
|
ifdef PORT
|
|
cd $(OUTPUTDIR) && $(PYTHON) -m pelican.server $(PORT)
|
|
else
|
|
cd $(OUTPUTDIR) && $(PYTHON) -m pelican.server 8000
|
|
endif
|
|
|
|
regenerate:
|
|
cd $(OUTPUTDIR) && $(PYTHON) -m pelican.server &
|
|
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
|
|
|
|
publish: install
|
|
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
|
|
echo "blog.notmyidea.org" > $(OUTPUTDIR)/CNAME
|
|
|
|
github: publish
|
|
ghp-import -n $(OUTPUTDIR)
|
|
git push origin gh-pages
|
|
|
|
.PHONY: html clean serve devserver publish
|