a-nourishing-network/Makefile

74 lines
1.9 KiB
Makefile
Raw Normal View History

2020-11-13 16:40:54 +01:00
PY?=python3
PELICAN?=pelican
PELICANOPTS=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif
RELATIVE ?= 0
ifeq ($(RELATIVE), 1)
PELICANOPTS += --relative-urls
endif
SERVER ?= "0.0.0.0"
PORT ?= 0
ifneq ($(PORT), 0)
PELICANOPTS += -p $(PORT)
endif
help:
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make devserver [PORT=8000] serve and regenerate together '
@echo ' make print generate the HTML and PDF files '
2020-11-13 16:40:54 +01:00
@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 ' '
# Make on the server
2020-11-13 16:40:54 +01:00
html:
@echo '----------------'
2020-11-13 16:40:54 +01:00
"$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
@echo '----------------'
python3 rss-to-ap/rss-to-ap.py
@echo '----------------'
2020-11-13 16:40:54 +01:00
# Work-in-process mode
devserver:
"$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
2020-11-13 16:40:54 +01:00
# Print
md=$(wildcard print/*.md)
md2html=$(md:%.md=%.html)
md2pdf=$(md:%.md=%.pdf)
2020-11-13 16:40:54 +01:00
%.html: %.md
2021-01-29 15:22:49 +01:00
pandoc --from markdown --to html -c ../themes/basic/static/css/print.css -s $< -o $@
2020-11-13 16:40:54 +01:00
%.pdf: %.md themes/basic/static/css/print.css
pandoc --pdf-engine=weasyprint -c themes/basic/static/css/print.css $< -o $@
print: $(md2html) $(md2pdf)
2020-11-13 16:40:54 +01:00
2020-11-13 17:26:13 +01:00