summaryrefslogtreecommitdiff
path: root/Makefile
blob: 8b62fe067990dccc13806b74bedf41aab647a086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
87
#SHELL := /bin/bash
MAKE=make
BUILD_DIR = vendor

#TODO: add install target

CSS=$(wildcard *.css)
CSS=$(subst .tiny,,$(shell find themes -type f -name '*.css'))
COMPRESSED_CSS := $(patsubst %.css,%.tiny.css,$(CSS))
PWD=`pwd`

## Catch-all tagets
default: predepend cfg cherrypy.config dirs template css docs dbs $(BUILD_DIR)/exmachina #$(BUILD_DIR)/bjsonrpc
all: default

build:
	mkdir -p $(BUILD_DIR)

predepend:
	su -c "apt-get -y install augeas-tools python-bjsonrpc python-augeas python-simplejson pandoc python-cheetah"
	touch predepend

$(BUILD_DIR)/exmachina: build
	git clone git://github.com/tomgalloway/exmachina $(BUILD_DIR)/exmachina

$(BUILD_DIR)/bjsonrpc: build
	git clone git://github.com/deavid/bjsonrpc.git $(BUILD_DIR)/bjsonrpc

dbs: data/users.sqlite3

data/users.sqlite3: data/users.sqlite3.distrib
	cp data/users.sqlite3.distrib data/users.sqlite3

dirs:
	@mkdir -p data/cherrypy_sessions

cfg: Makefile
	test -f cfg.py || cp cfg.sample.py cfg.py

cherrypy.config: Makefile
	@echo [global]\\n\
server.socket_host = \'0.0.0.0\'\\n\
server.socket_port = 8000\\n\
server.thread_pool = 10\\n\
tools.staticdir.root = \"$(PWD)\"\\n\
tools.sessions.on = True\\n\
tools.auth.on = True\\n\
tools.sessions.storage_type = \"file\"\\n\
tools.sessions.timeout = 90\\n\
tools.sessions.storage_path = \"$(PWD)/data/cherrypy_sessions\"\\n\
\\n\
[/static]\\n\
tools.staticdir.on = True\\n\
tools.staticdir.dir = \"static\"\\n\
\\n\
[/favicon.ico]\\n\
tools.staticfile.on = True\\n\
tools.staticfile.filename = \"$(PWD)/static/theme/favicon.ico\"\\n\
> cherrypy.config

%.tiny.css: %.css
	@cat $< | python -c 'import re,sys;print re.sub("\s*([{};,:])\s*", "\\1", re.sub("/\*.*?\*/", "", re.sub("\s+", " ", sys.stdin.read())))' > $@
css: $(COMPRESSED_CSS)

template:
	@$(MAKE) -s -C templates
templates: template

docs:
	@$(MAKE) -s -C doc
doc: docs

html:
	@$(MAKE) -s -C doc html

clean:
	@rm -f cherrypy.config data/cherrypy_sessions/*
	@find themes -name "*.tiny.css" -exec rm {} \;
	@find . -name "*~" -exec rm {} \;
	@find . -name ".#*" -exec rm {} \;
	@find . -name "#*" -exec rm {} \;
	@find . -name "*.pyc" -exec rm {} \;
	@find . -name "*.bak" -exec rm {} \;
	@$(MAKE) -s -C doc clean
	@$(MAKE) -s -C templates clean
	rm -rf $(BUILD_DIR)
	rm -f predepend