Makefile 3.39 KB
Newer Older
1 2 3
# Makefile for updating bits.debian.org
# This makefile can also be used in local to recreate the blog.

4 5
PY?=python
PELICAN?=pelican
6 7 8 9 10 11 12
PELICANOPTS=-v

BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
13
# Directory where the generated blog must be copied in dillon.debian.org
14
OUTPUTDIRMASTER=/srv/bits-master.debian.org/htdocs
15

16 17 18 19 20 21 22 23 24 25
DEBUG ?= 0
ifeq ($(DEBUG), 1)
	PELICANOPTS += -D
endif

RELATIVE ?= 0
ifeq ($(RELATIVE), 1)
	PELICANOPTS += --relative-urls
endif

26 27 28 29
help:
	@echo 'Makefile for a pelican Web site                                              '
	@echo '                                                                             '
	@echo 'Usage:                                                                       '
30
	@echo '   make html                           (re)generate the web site                '
31
	@echo '   make mhtml                          (re)generate the web site in dillon.d.o  '
32
	@echo '   make clean                          remove the generated files               '
33
	@echo '   make mclean                         remove the generated files in dillon.d.o '
34 35 36 37 38 39 40 41
	@echo '   make regenerate                     regenerate files upon modification '
	@echo '   make serve [PORT=8000]              serve site at http://localhost:8000'
	@echo '   make serve-global [SERVER=0.0.0.0]  serve (as root) to $(SERVER):80    '
	@echo '   make devserver [PORT=8000]          start/restart develop_server.sh    '
	@echo '   make stopserver                     stop local server                  '
#	@echo '   make publish                        generate using production settings       '
	@echo '   make mpublish                       generate and push the blog post          '

42 43
	@echo '                                                                             '

44 45 46
######################################
# Rules to generate the blog locally #
######################################
47 48 49 50 51 52 53 54 55 56 57

html: clean $(OUTPUTDIR)/index.html
	@echo 'Done'

$(OUTPUTDIR)/%.html:
	$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)

clean:
	find $(OUTPUTDIR) -mindepth 1 -delete
	touch $(OUTPUTDIR)/.gitkeep

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
regenerate:
	$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)

serve:
ifdef PORT
	cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
else
	cd $(OUTPUTDIR) && $(PY) -m pelican.server
endif

serve-global:
ifdef SERVER
	cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER)
else
	cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0
endif


devserver:
ifdef PORT
	$(BASEDIR)/develop_server.sh restart $(PORT)
else
	$(BASEDIR)/develop_server.sh restart
endif

stopserver:
	$(BASEDIR)/develop_server.sh stop
	@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'

87 88 89 90
publish:
	$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)

#############################################
91
# Rules for publishing in dillon.debian.org #
92 93
#############################################

94
mhtml: mclean $(OUTPUTDIRMASTER)/index.html
95
	chmod -R g+w $(OUTPUTDIRMASTER)/*
96 97 98
	@echo 'Done'

$(OUTPUTDIRMASTER)/%.html:
99
	$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIRMASTER) -s $(CONFFILE) $(PELICANOPTS)
100 101 102

mclean:
	find $(OUTPUTDIRMASTER) -mindepth 1 -delete
103

104 105 106
mpublish: mhtml
	/usr/local/bin/static-update-component bits.debian.org

107
.PHONY: html help clean regenerate serve serve-global devserver stopserver mhtml mclean publish mpublish