Makefile (3051B)
1 PY?=python3 2 PELICAN?=pelican 3 PELICANOPTS= 4 5 BASEDIR=$(CURDIR) 6 INPUTDIR=$(BASEDIR)/content 7 OUTPUTDIR=$(BASEDIR)/output 8 #LOCALDIR=${HOME}/public_html/site 9 #LOCALDIR=${HOME}/pub/manbytesgnu.com 10 LOCALDIR=${HOME}/public_html/manbytesgnu.com 11 CONFFILE=$(BASEDIR)/pelicanconf.py 12 PUBLISHCONF=$(BASEDIR)/publishconf.py 13 KEYID=59A844A484AC11253D3A3E9DCDCBD24DD1D0E001 14 15 16 DEBUG ?= 0 17 ifeq ($(DEBUG), 1) 18 PELICANOPTS += -D 19 endif 20 21 RELATIVE ?= 0 22 ifeq ($(RELATIVE), 1) 23 PELICANOPTS += --relative-urls 24 endif 25 26 SERVER ?= "0.0.0.0" 27 28 PORT ?= 0 29 ifneq ($(PORT), 0) 30 PELICANOPTS += -p $(PORT) 31 endif 32 33 34 help: 35 @echo 'Makefile for a pelican Web site ' 36 @echo ' ' 37 @echo 'Usage: ' 38 @echo ' make html (re)generate the web site ' 39 @echo ' make clean remove the generated files ' 40 @echo ' make regenerate regenerate files upon modification ' 41 @echo ' make publish generate using production settings ' 42 @echo ' make serve [PORT=8000] serve site at http://localhost:8000' 43 @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 ' 44 @echo ' make devserver [PORT=8000] serve and regenerate together ' 45 @echo ' make devserver-global regenerate and serve on 0.0.0.0 ' 46 @echo ' ' 47 @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html ' 48 @echo 'Set the RELATIVE variable to 1 to enable relative urls ' 49 @echo ' ' 50 51 html: 52 "$(PELICAN)" "$(INPUTDIR)" -t ./lash -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) 53 54 clean: 55 [ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)" 56 57 regenerate: 58 "$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) 59 60 serve: 61 "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) 62 63 serve-global: 64 "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER) 65 66 devserver: 67 "$(PELICAN)" -lr "$(INPUTDIR)" -t ./lash -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) 68 69 devserver-global: 70 $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0 71 72 publish: 73 "$(PELICAN)" "$(INPUTDIR)" -t ./lash -o "$(OUTPUTDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS) 74 75 local: 76 "$(PELICAN)" "$(INPUTDIR)" -t ./lash -o "$(LOCALDIR)" -s "$(CONFFILE)" $(PELICANOPTS) 77 78 git: 79 cd $(LOCALDIR) && git rev-parse HEAD 80 rm -vrf $(LOCALDIR)/* 81 PYTHONPATH=$(BASEDIR) "$(PELICAN)" "$(INPUTDIR)" -t ./lash -o "$(LOCALDIR)" -s "$(CONFFILE)" $(PELICANOPTS) 82 rm -vrf $(LOCALDIR)/drafts 83 cd $(LOCALDIR) && git add * 84 cd $(LOCALDIR) && git commit -a --gpg-sign="$(KEYID)" 85 86 87 .PHONY: html help clean regenerate serve serve-global devserver publish