Update core
[platal.git] / Makefile
CommitLineData
b6cdf7b4 1
0337d704 2# $Id: Makefile,v 1.5 2004/11/25 20:18:39 x99laine Exp $
3################################################################################
4# definitions
5
8fc4efa3 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')
5b677a86 8
8fc4efa3 9VERSION = $(VERSNUM)$(VERSTAG)
0337d704 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
5594f3a9
FB
18define download
19@echo "Downloading $@ from $(DOWNLOAD_SRC)"
20wget $(DOWNLOAD_SRC) -O $@ -q || ($(RM) $@; exit 1)
21endef
22
0337d704 23################################################################################
24# global targets
25
26all: build
27
e97df22e 28build: core conf static banana wiki openid medals jquery
0337d704 29
cef8ceb2 30check:
1eaaa62d 31 @!(find . -name '*.php' -exec php -l {} ";" | grep -v 'No syntax errors detected')
cef8ceb2 32
fd48ab5f
FB
33test:
34 make -C core test
35
63528107 36q:
37 @echo -e "Code statistics\n"
38 @sloccount $(filter-out wiki/ spool/, $(wildcard */)) 2> /dev/null | egrep '^[a-z]*:'
39
5e73ff67 40%: %.in Makefile ChangeLog
0337d704 41 sed -e 's,@VERSION@,$(VERSION),g' $< > $@
42
8b944f3e
FB
43up: update
44update:
45 @git fetch && git rebase `git symbolic-ref HEAD | sed -e 's~refs/heads/~origin/~'` && git submodule update
46
0337d704 47################################################################################
b66268df 48# targets
91f37c81 49
9380b1bf 50##
51## core
52##
53
7e846cdf 54core:
ba47d308 55 [ -d core/.git ] || ( git submodule init && git submodule update )
7e846cdf
FB
56 make -C core all
57
58##
59## conf
60##
61
5f0ecf6c 62conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp spool/banana
9380b1bf 63
5f0ecf6c 64spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp spool/run spool/banana:
91f37c81 65 mkdir -p $@
66 chmod o+w $@
67
b6cdf7b4 68htdocs/.htaccess: htdocs/.htaccess.in Makefile
69 @REWRITE_BASE="/~$$(id -un)"; \
70 test "$$REWRITE_BASE" = "/~web" && REWRITE_BASE="/"; \
71 sed -e "s,@REWRITE_BASE@,$$REWRITE_BASE,g" $< > $@
9380b1bf 72
73##
e97df22e
VZ
74## static content
75##
e5b254d5
FB
76static: htdocs/javascript/core.js htdocs/javascript@VERSION
77
78htdocs/javascript/core.js:
79 cd htdocs/javascript/ && ln -s ../../core/htdocs/javascript/core.js
e97df22e
VZ
80
81%@VERSION: % Makefile ChangeLog
82 cd $< && rm -f $(VERSION) && ln -sf . $(VERSION)
83
84##
9380b1bf 85## wiki
86##
87
88WIKI_NEEDS = \
89 wiki/local/farmconfig.php \
90 wiki/pub/skins/empty \
91 wiki/cookbook/e-protect.php \
92 spool/wiki.d \
93 htdocs/uploads \
94 htdocs/wiki \
95
96wiki: get-wiki build-wiki
97
98build-wiki: $(WIKI_NEEDS) | get-wiki
99
c31c4e6a 100htdocs/uploads:
9380b1bf 101 cd htdocs && ln -sf ../spool/uploads
102
103htdocs/wiki:
104 cd htdocs && ln -sf ../wiki/pub wiki
105
106
91f37c81 107spool/wiki.d:
b66268df 108 mkdir -p $@
109 chmod o+w $@
2c799249 110 cd $@ && ln -sf ../../include/wiki/wiki.d/* .
91f37c81 111
9380b1bf 112
4887dc90 113wiki/cookbook/e-protect.php:
2c799249 114 cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php
0337d704 115
796aea34 116wiki/local/farmconfig.php:
2c799249 117 cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php
b66268df 118
119wiki/pub/skins/empty:
2c799249 120 cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty
b66268df 121
9380b1bf 122
d207e9f5 123get-wiki:
124 @if ! test -d wiki; then \
91a3c521
FB
125 wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \
126 tar -xzvf pmwiki-latest.tgz; \
127 rm pmwiki-latest.tgz; \
128 mv pmwiki-* wiki; \
bba430bf
AA
129 fi
130
131##
132## openid
133##
134
a1af4a99 135openid: get-openid spool/openid/store
bba430bf
AA
136
137# There is no obvious way to automatically use the latest version
91a3c521
FB
138OPENID_VERSION = 2.2.2
139OPENID_COMMIT = 782224d
bba430bf 140get-openid:
b69727b4 141 @if ! test -d include/Auth; then \
91a3c521
FB
142 wget --no-check-certificate \
143 https://github.com/openid/php-openid/tarball/$(OPENID_VERSION) \
144 -O php-openid-$(OPENID_VERSION).tar.gz; \
145 tar -xzf php-openid-$(OPENID_VERSION).tar.gz; \
146 mv openid-php-openid-$(OPENID_COMMIT)/Auth include/; \
147 rm php-openid-$(OPENID_VERSION).tar.gz; \
148 rm -r openid-php-openid-$(OPENID_COMMIT); \
d207e9f5 149 fi
150
a1af4a99
AA
151spool/openid/store:
152 mkdir -p $@
153 chmod o+w $@
154
9380b1bf 155##
156## banana
157##
c3b581dc 158banana: htdocs/images/banana htdocs/css/banana.css
1fccdc24 159htdocs/images/banana: banana-sub
bdf8bbb2 160 cd $(@D) && ln -snf ../../banana/img $(@F)
08dbcb5a 161
1fccdc24 162htdocs/css/banana.css: banana-sub
bdf8bbb2 163 cd $(@D) && ln -snf ../../banana/css/style.css $(@F)
5b677a86 164
1fccdc24
FB
165banana-sub:
166 make -C banana
5b677a86 167
bd6a5fe3
VZ
168##
169## Medal thumbnails
170##
171MEDAL_PICTURES=$(wildcard htdocs/images/medals/*.jpg)
172MEDAL_THUMBNAILS=$(subst /medals/,/medals/thumb/,$(MEDAL_PICTURES))
173
174medals: $(MEDAL_THUMBNAILS)
5b677a86 175
bd6a5fe3
VZ
176$(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F))
177 convert -resize x50 $(subst /medals/thumb/,/medals/,$@) $@
08dbcb5a 178
8c5c6d64 179##
180## jquery
181##
aa0909f4 182JQUERY_VERSION=1.4.4
21fb012b 183JQUERY_PLUGINS=color form
5594f3a9
FB
184JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS)))
185
aa0909f4 186JQUERY_UI_VERSION=1.8.7
d0b836c9 187JQUERY_UI=core tabs datepicker widget
889d9807 188JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI)))
16019034 189
aa0909f4
FB
190JQUERY_TMPL_VERSION=vBeta1.0.0
191JQUERY_TMPL_PATH=htdocs/javascript/jquery.tmpl.js
192
150a0a91
SJ
193JSTREE_VERSION=1.0rc2
194JSTREE_PATH=htdocs/javascript/jquery.jstree.js
195
dd916657
VZ
196# TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue
197# is that the version we use is not available anymore on the Internet, and the latest version
198# we could use is not backward compatible with our current code.
31d63ae1 199jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES) $(JQUERY_TMPL_PATH) $(JSTREE_PATH) htdocs/javascript/jquery.ui.datepicker-fr.js
5594f3a9 200
889d9807
FB
201htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: DOWNLOAD_SRC = http://jquery.com/src/$(@F)
202htdocs/javascript/jquery-$(JQUERY_VERSION).min.js:
07ea8c0e 203 @-rm htdocs/javascript/jquery-*.min.js
5594f3a9 204 @$(download)
8c5c6d64 205
889d9807 206htdocs/javascript/jquery.js: htdocs/javascript/jquery-$(JQUERY_VERSION).min.js
07ea8c0e 207 ln -snf $(<F) $@
889d9807 208
21fb012b 209$(JQUERY_PLUGINS_PATHES): DOWNLOAD_SRC = http://plugins.jquery.com/files/$(@F)_0.txt
5594f3a9 210$(JQUERY_PLUGINS_PATHES):
07ea8c0e 211 @-rm htdocs/javascript/jquery.ui*.$*.js
5594f3a9 212 @$(download)
de99248c 213
1b50c20c 214htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js: DOWNLOAD_SRC = http://jquery-ui.googlecode.com/svn/tags/$(JQUERY_UI_VERSION)/ui/minified/jquery.ui.$*.min.js
889d9807 215htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js:
16019034
FB
216 @$(download)
217
31d63ae1
FB
218htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).datepicker-fr.js: DOWNLOAD_SRC = http://jquery-ui.googlecode.com/svn/tags/$(JQUERY_UI_VERSION)/ui/minified/i18n/jquery.ui.datepicker-fr.min.js
219htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).datepicker-fr.js:
220 @$(download)
221
222$(JQUERY_UI_PATHES) htdocs/javascript/jquery.ui.datepicker-fr.js: htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js
07ea8c0e 223 ln -snf $(<F) $@
889d9807 224
aa0909f4
FB
225htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js: DOWNLOAD_SRC = https://github.com/jquery/jquery-tmpl/raw/$(JQUERY_TMPL_VERSION)/jquery.tmpl.min.js --no-check-certificate
226htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js:
227 @-rm htdocs/javascript/jquery.tmpl*.js
228 @$(download)
229
230$(JQUERY_TMPL_PATH): htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js
231 ln -snf $(<F) $@
232
150a0a91
SJ
233$(JSTREE_PATH):
234 rm -f htdocs/javascript/jquery.jstree-*.js
235 mkdir spool/tmp/jstree
236 wget http://jstree.googlecode.com/files/jsTree.v.$(JSTREE_VERSION).zip -O spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip
237 unzip spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip -d spool/tmp/jstree/
238 mv -f spool/tmp/jstree/themes/default/style.css htdocs/css/jstree.css
239 mv -f spool/tmp/jstree/themes/default/d.png htdocs/images/jstree.png
240 mv -f spool/tmp/jstree/jquery.jstree.js htdocs/javascript/jquery.jstree-$(JSTREE_VERSION).js
ac639b4c
PC
241 sed -i -e 's/"d\.png"/"..\/images\/jstree.png"/' htdocs/css/jstree.css
242 sed -i -e 's/"throbber\.gif"/"..\/images\/wait.gif"/' htdocs/css/jstree.css
243 sed -i -e 's/#ffffee/inherit/' htdocs/css/jstree.css
150a0a91
SJ
244 ln -snf jquery.jstree-$(JSTREE_VERSION).js htdocs/javascript/jquery.jstree.js
245 rm -Rf spool/tmp/jstree
246
247
c5644a5b
FB
248##
249## lists rpc
250##
251start-listrpc: spool/run
252 sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid -m -b -x $$PWD/bin/lists.rpc.py --start
253 @sleep 2
254 @sudo -u list kill -0 $$(cat spool/run/listrpc.pid)
255
256start-listrpc-fg: spool/run
257 sudo -u list ./bin/lists.rpc.py
258
259stop-listrpc:
260 -sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid --stop
261 @-rm -f spool/run/listrpc.pid
262
263restart-listrpc: stop-listrpc start-listrpc
264
0337d704 265################################################################################
b66268df 266
c3b581dc
FB
267.PHONY: build dist clean core http* check test
268.PHONY: wiki build-wiki
269.PHONY: banana banana-sub htdocs/images/banana htdocs/css/banana.css
c5644a5b 270.PHONY: start-listrpc start-listrpc-fg stop-listrpc restart-listrpc
8b944f3e 271.PHONY: up update