Integration of new features for admin > payments :
[platal.git] / Makefile
... / ...
CommitLineData
1
2# $Id: Makefile,v 1.5 2004/11/25 20:18:39 x99laine Exp $
3################################################################################
4# definitions
5
6VERSNUM := $(shell grep VERSION ChangeLog | head -1 | sed -e "s/VERSION //;s/ .*//")
7VERSTAG := $(shell grep VERSION ChangeLog | head -1 | grep 'XX' > /dev/null 2> /dev/null && echo 'beta')
8
9VERSION = $(VERSNUM)$(VERSTAG)
10
11PKG_NAME = platal
12PKG_DIST = $(PKG_NAME)-$(VERSION)
13PKG_FILES = AUTHORS ChangeLog COPYING README Makefile
14PKG_DIRS = configs htdocs include install.d plugins po scripts templates upgrade
15
16VCS_FILTER = ! -name .arch-ids ! -name CVS
17
18define download
19@echo "Downloading $@ from $(DOWNLOAD_SRC)"
20wget $(DOWNLOAD_SRC) -O $@ -q || ($(RM) $@; exit 1)
21endef
22
23################################################################################
24# global targets
25
26all: build
27
28build: core conf static banana wiki openid medals jquery
29
30check:
31 @!(find . -name '*.php' -exec php -l {} ";" | grep -v 'No syntax errors detected')
32
33test:
34 make -C core test
35
36q:
37 @echo -e "Code statistics\n"
38 @sloccount $(filter-out wiki/ spool/, $(wildcard */)) 2> /dev/null | egrep '^[a-z]*:'
39
40%: %.in Makefile ChangeLog
41 sed -e 's,@VERSION@,$(VERSION),g' $< > $@
42
43################################################################################
44# targets
45
46##
47## core
48##
49
50core:
51 [ -d core/.git ] || ( git submodule init && git submodule update )
52 make -C core all
53
54##
55## conf
56##
57
58conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp spool/banana
59
60spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp spool/run spool/banana:
61 mkdir -p $@
62 chmod o+w $@
63
64htdocs/.htaccess: htdocs/.htaccess.in Makefile
65 @REWRITE_BASE="/~$$(id -un)"; \
66 test "$$REWRITE_BASE" = "/~web" && REWRITE_BASE="/"; \
67 sed -e "s,@REWRITE_BASE@,$$REWRITE_BASE,g" $< > $@
68
69##
70## static content
71##
72static: htdocs/javascript@VERSION
73
74%@VERSION: % Makefile ChangeLog
75 cd $< && rm -f $(VERSION) && ln -sf . $(VERSION)
76
77##
78## wiki
79##
80
81WIKI_NEEDS = \
82 wiki/local/farmconfig.php \
83 wiki/pub/skins/empty \
84 wiki/cookbook/e-protect.php \
85 spool/wiki.d \
86 htdocs/uploads \
87 htdocs/wiki \
88
89wiki: get-wiki build-wiki
90
91build-wiki: $(WIKI_NEEDS) | get-wiki
92
93htdocs/uploads:
94 cd htdocs && ln -sf ../spool/uploads
95
96htdocs/wiki:
97 cd htdocs && ln -sf ../wiki/pub wiki
98
99
100spool/wiki.d:
101 mkdir -p $@
102 chmod o+w $@
103 cd $@ && ln -sf ../../include/wiki/wiki.d/* .
104
105
106wiki/cookbook/e-protect.php:
107 cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php
108
109wiki/local/farmconfig.php:
110 cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php
111
112wiki/pub/skins/empty:
113 cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty
114
115
116get-wiki:
117 @if ! test -d wiki; then \
118 wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \
119 tar -xzvf pmwiki-latest.tgz; \
120 rm pmwiki-latest.tgz; \
121 mv pmwiki-* wiki; \
122 fi
123
124##
125## openid
126##
127
128openid: get-openid spool/openid/store
129
130# There is no obvious way to automatically use the latest version
131OPENID_VERSION = 2.1.3
132get-openid:
133 @if ! test -d include/Auth; then \
134 wget http://openidenabled.com/files/php-openid/packages/php-openid-$(OPENID_VERSION).tar.bz2; \
135 tar -xjf php-openid-$(OPENID_VERSION).tar.bz2; \
136 mv php-openid-$(OPENID_VERSION)/Auth include/; \
137 rm php-openid-$(OPENID_VERSION).tar.bz2; \
138 rm -r php-openid-$(OPENID_VERSION); \
139 fi
140
141spool/openid/store:
142 mkdir -p $@
143 chmod o+w $@
144
145##
146## banana
147##
148banana: htdocs/images/banana htdocs/css/banana.css
149htdocs/images/banana: banana-sub
150 cd $(@D) && ln -snf ../../banana/img $(@F)
151
152htdocs/css/banana.css: banana-sub
153 cd $(@D) && ln -snf ../../banana/css/style.css $(@F)
154
155banana-sub:
156 make -C banana
157
158##
159## Medal thumbnails
160##
161MEDAL_PICTURES=$(wildcard htdocs/images/medals/*.jpg)
162MEDAL_THUMBNAILS=$(subst /medals/,/medals/thumb/,$(MEDAL_PICTURES))
163
164medals: $(MEDAL_THUMBNAILS)
165
166$(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F))
167 convert -resize x50 $(subst /medals/thumb/,/medals/,$@) $@
168
169##
170## jquery
171##
172JQUERY_VERSION=1.4.2
173JQUERY_PLUGINS=color form
174JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS)))
175
176JQUERY_UI_VERSION=1.6
177JQUERY_UI=core tabs
178JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI)))
179
180JSTREE_VERSION=1.0rc2
181JSTREE_PATH=htdocs/javascript/jquery.jstree.js
182
183# TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue
184# is that the version we use is not available anymore on the Internet, and the latest version
185# we could use is not backward compatible with our current code.
186jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES) $(JSTREE_PATH)
187
188htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: DOWNLOAD_SRC = http://jquery.com/src/$(@F)
189htdocs/javascript/jquery-$(JQUERY_VERSION).min.js:
190 @-rm htdocs/javascript/jquery-*.min.js
191 @$(download)
192
193htdocs/javascript/jquery.js: htdocs/javascript/jquery-$(JQUERY_VERSION).min.js
194 ln -snf $(<F) $@
195
196$(JQUERY_PLUGINS_PATHES): DOWNLOAD_SRC = http://plugins.jquery.com/files/$(@F)_0.txt
197$(JQUERY_PLUGINS_PATHES):
198 @-rm htdocs/javascript/jquery.ui*.$*.js
199 @$(download)
200
201htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js: DOWNLOAD_SRC = http://jquery-ui.googlecode.com/svn/tags/$(JQUERY_UI_VERSION)/ui/ui.$*.js
202htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js:
203 @$(download)
204
205$(JQUERY_UI_PATHES): htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js
206 ln -snf $(<F) $@
207
208$(JSTREE_PATH):
209 rm -f htdocs/javascript/jquery.jstree-*.js
210 mkdir spool/tmp/jstree
211 wget http://jstree.googlecode.com/files/jsTree.v.$(JSTREE_VERSION).zip -O spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip
212 unzip spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip -d spool/tmp/jstree/
213 mv -f spool/tmp/jstree/themes/default/style.css htdocs/css/jstree.css
214 mv -f spool/tmp/jstree/themes/default/d.png htdocs/images/jstree.png
215 mv -f spool/tmp/jstree/jquery.jstree.js htdocs/javascript/jquery.jstree-$(JSTREE_VERSION).js
216 sed -i -e 's/"d\.png"/"..\/images\/jstree.png"/' htdocs/css/jstree.css
217 sed -i -e 's/"throbber\.gif"/"..\/images\/wait.gif"/' htdocs/css/jstree.css
218 sed -i -e 's/#ffffee/inherit/' htdocs/css/jstree.css
219 ln -snf jquery.jstree-$(JSTREE_VERSION).js htdocs/javascript/jquery.jstree.js
220 rm -Rf spool/tmp/jstree
221
222
223##
224## lists rpc
225##
226start-listrpc: spool/run
227 sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid -m -b -x $$PWD/bin/lists.rpc.py --start
228 @sleep 2
229 @sudo -u list kill -0 $$(cat spool/run/listrpc.pid)
230
231start-listrpc-fg: spool/run
232 sudo -u list ./bin/lists.rpc.py
233
234stop-listrpc:
235 -sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid --stop
236 @-rm -f spool/run/listrpc.pid
237
238restart-listrpc: stop-listrpc start-listrpc
239
240################################################################################
241
242.PHONY: build dist clean core http* check test
243.PHONY: wiki build-wiki
244.PHONY: banana banana-sub htdocs/images/banana htdocs/css/banana.css
245.PHONY: start-listrpc start-listrpc-fg stop-listrpc restart-listrpc