Moving to GitHub.
[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 maps raven
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
43up: update
44update:
45 @git fetch && git rebase `git symbolic-ref HEAD | sed -e 's~refs/heads/~origin/~'` && git submodule update
46
47doc:
48 @doxygen core/doc/doxygen.cfg
49
50################################################################################
51# targets
52
53##
54## core
55##
56
57core:
58 [ -d core/.git ] || ( git submodule init && git submodule update )
59 make -C core all
60
61##
62## conf
63##
64
65conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp spool/banana
66
67spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp spool/run spool/banana:
68 mkdir -p $@
69 chmod o+w $@
70
71htdocs/.htaccess: htdocs/.htaccess.in Makefile
72 @REWRITE_BASE="/~$$(id -un)"; \
73 test "$$REWRITE_BASE" = "/~web" && REWRITE_BASE="/"; \
74 sed -e "s,@REWRITE_BASE@,$$REWRITE_BASE,g" $< > $@
75
76##
77## static content
78##
79static: htdocs/javascript/core.js htdocs/javascript@VERSION htdocs/javascript/json2.js
80
81htdocs/javascript/core.js:
82 cd htdocs/javascript/ && ln -s ../../core/htdocs/javascript/core.js
83
84%@VERSION: % Makefile ChangeLog
85 cd $< && rm -f $(VERSION) && ln -sf . $(VERSION)
86
87htdocs/javascript/json2.js: DOWNLOAD_SRC = https://github.com/douglascrockford/JSON-js/raw/master/json2.js --no-check-certificate
88htdocs/javascript/json2.js:
89 @$(download)
90
91##
92## wiki
93##
94
95WIKI_NEEDS = \
96 wiki/local/farmconfig.php \
97 wiki/pub/skins/empty \
98 wiki/cookbook/e-protect.php \
99 spool/wiki.d \
100 htdocs/uploads \
101 htdocs/wiki \
102
103wiki: get-wiki build-wiki
104
105build-wiki: $(WIKI_NEEDS) | get-wiki
106
107htdocs/uploads:
108 cd htdocs && ln -sf ../spool/uploads
109
110htdocs/wiki:
111 cd htdocs && ln -sf ../wiki/pub wiki
112
113
114spool/wiki.d:
115 mkdir -p $@
116 chmod o+w $@
117 cd $@ && ln -sf ../../include/wiki/wiki.d/* .
118
119
120wiki/cookbook/e-protect.php:
121 cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php
122
123wiki/local/farmconfig.php:
124 cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php
125
126wiki/pub/skins/empty:
127 cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty
128
129
130get-wiki:
131 @if ! test -d wiki; then \
132 wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \
133 tar -xzvf pmwiki-latest.tgz; \
134 rm pmwiki-latest.tgz; \
135 mv pmwiki-* wiki; \
136 fi
137
138##
139## openid
140##
141
142openid:
143 -rm -rf include/Auth
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.5.1
173JQUERY_COLOR_VERSION=2.1.2
174JQUERY_PLUGINS=color form
175JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS)))
176
177JQUERY_UI_VERSION=1.8.10
178JQUERY_UI=core widget tabs datepicker autocomplete position
179JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI)))
180
181JQUERY_TMPL_VERSION=vBeta1.0.0
182JQUERY_TMPL_PATH=htdocs/javascript/jquery.tmpl.js
183
184JSTREE_VERSION=1.0rc2
185JSTREE_PATH=htdocs/javascript/jquery.jstree.js
186
187jquery: htdocs/javascript/jquery.xorg.js htdocs/javascript/jquery.ui.xorg.js $(JSTREE_PATH)
188
189htdocs/javascript/jquery.xorg.js: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_TMPL_PATH)
190 cat $^ > $@
191
192htdocs/javascript/jquery.ui.xorg.js: $(JQUERY_UI_PATHES) htdocs/javascript/jquery.ui.datepicker-fr.js
193 cat $^ > $@
194
195htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: DOWNLOAD_SRC = http://code.jquery.com/$(@F)
196htdocs/javascript/jquery-$(JQUERY_VERSION).min.js:
197 @-rm htdocs/javascript/jquery-*.min.js
198 @$(download)
199
200htdocs/javascript/jquery.js: htdocs/javascript/jquery-$(JQUERY_VERSION).min.js
201 ln -snf $(<F) $@
202
203htdocs/javascript/jquery.color-$(JQUERY_COLOR_VERSION).min.js: DOWNLOAD_SRC = http://code.jquery.com/color/$(@F)
204htdocs/javascript/jquery.color-$(JQUERY_COLOR_VERSION).min.js:
205 @-rm htdocs/javascript/jquery.color-*.min.js
206 @$(download)
207
208htdocs/javascript/jquery.color.js: htdocs/javascript/jquery.color-$(JQUERY_COLOR_VERSION).min.js
209 ln -snf $(<F) $@
210
211htdocs/javascript/jquery.form.js: DOWNLOAD_SRC = http://malsup.github.com/min/jquery.form.min.js
212htdocs/javascript/jquery.form.js:
213 @-rm htdocs/javascript/jquery.form*.js
214 @$(download)
215
216htdocs/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
217htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js:
218 @$(download)
219
220htdocs/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
221htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).datepicker-fr.js:
222 @$(download)
223
224$(JQUERY_UI_PATHES) htdocs/javascript/jquery.ui.datepicker-fr.js: htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js
225 ln -snf $(<F) $@
226
227htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js: DOWNLOAD_SRC = https://github.com/jquery/jquery-tmpl/raw/$(JQUERY_TMPL_VERSION)/jquery.tmpl.js --no-check-certificate
228htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js:
229 @-rm htdocs/javascript/jquery.tmpl*.js
230 @$(download)
231
232$(JQUERY_TMPL_PATH): htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js
233 ln -snf $(<F) $@
234
235$(JSTREE_PATH):
236 rm -f htdocs/javascript/jquery.jstree-*.js
237 mkdir spool/tmp/jstree
238 wget http://jstree.googlecode.com/files/jsTree.v.$(JSTREE_VERSION).zip -O spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip
239 unzip spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip -d spool/tmp/jstree/
240 mv -f spool/tmp/jstree/themes/default/style.css htdocs/css/jstree.css
241 mv -f spool/tmp/jstree/themes/default/d.png htdocs/images/jstree.png
242 mv -f spool/tmp/jstree/jquery.jstree.js htdocs/javascript/jquery.jstree-$(JSTREE_VERSION).js
243 sed -i -e 's/"d\.png"/"..\/images\/jstree.png"/' htdocs/css/jstree.css
244 sed -i -e 's/"throbber\.gif"/"..\/images\/wait.gif"/' htdocs/css/jstree.css
245 sed -i -e 's/#ffffee/inherit/' htdocs/css/jstree.css
246 ln -snf jquery.jstree-$(JSTREE_VERSION).js htdocs/javascript/jquery.jstree.js
247 rm -Rf spool/tmp/jstree
248
249##
250## Maps auxiliary scripts
251##
252maps: htdocs/javascript/markerclusterer.js
253
254## Try and use taged version asap (from http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/...).
255## Force to use https to retrieve images
256htdocs/javascript/markerclusterer.js:
257 wget 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer_compiled.js?r=308' -O $@.tmp -q || ($(RM) $@.tmp; false)
258 sed 's,http\(://google-maps-utility-library-v3.googlecode.com\),https\1,g' < $@.tmp > $@
259 $(RM) $@.tmp
260
261##
262## Raven-js
263##
264RAVEN_VERSION=1.1.2
265raven: $(addprefix htdocs/javascript/raven.,min.js min.map js)
266
267# Documentation: http://raven-js.readthedocs.org/en/latest/install/index.html
268htdocs/javascript/raven.%: DOWNLOAD_SRC = http://cdn.ravenjs.com/$(RAVEN_VERSION)/$(@F)
269htdocs/javascript/raven.%:
270 @-rm $@
271 $(download)
272
273
274##
275## lists rpc
276##
277start-listrpc: spool/run
278 sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid -m -b -x $$PWD/bin/lists.rpc.py --start
279 @sleep 2
280 @sudo -u list kill -0 $$(cat spool/run/listrpc.pid)
281
282start-listrpc-fg: spool/run
283 sudo -u list ./bin/lists.rpc.py
284
285stop-listrpc:
286 -sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid --stop
287 @-rm -f spool/run/listrpc.pid
288
289restart-listrpc: stop-listrpc start-listrpc
290
291################################################################################
292
293.PHONY: all build dist clean core http* q check test
294.PHONY: wiki build-wiki get-wiki
295.PHONY: openid
296.PHONY: banana banana-sub htdocs/images/banana htdocs/css/banana.css
297.PHONY: medals jquery maps raven
298.PHONY: start-listrpc start-listrpc-fg stop-listrpc restart-listrpc
299.PHONY: up update doc