Commit | Line | Data |
---|---|---|
b6cdf7b4 | 1 | |
0337d704 | 2 | # $Id: Makefile,v 1.5 2004/11/25 20:18:39 x99laine Exp $ |
3 | ################################################################################ | |
4 | # definitions | |
5 | ||
8fc4efa3 | 6 | VERSNUM := $(shell grep VERSION ChangeLog | head -1 | sed -e "s/VERSION //;s/ .*//") |
7 | VERSTAG := $(shell grep VERSION ChangeLog | head -1 | grep 'XX' > /dev/null 2> /dev/null && echo 'beta') | |
5b677a86 | 8 | |
8fc4efa3 | 9 | VERSION = $(VERSNUM)$(VERSTAG) |
0337d704 | 10 | |
11 | PKG_NAME = platal | |
12 | PKG_DIST = $(PKG_NAME)-$(VERSION) | |
13 | PKG_FILES = AUTHORS ChangeLog COPYING README Makefile | |
14 | PKG_DIRS = configs htdocs include install.d plugins po scripts templates upgrade | |
15 | ||
16 | VCS_FILTER = ! -name .arch-ids ! -name CVS | |
17 | ||
5594f3a9 FB |
18 | define download |
19 | @echo "Downloading $@ from $(DOWNLOAD_SRC)" | |
20 | wget $(DOWNLOAD_SRC) -O $@ -q || ($(RM) $@; exit 1) | |
21 | endef | |
22 | ||
0337d704 | 23 | ################################################################################ |
24 | # global targets | |
25 | ||
26 | all: build | |
27 | ||
e97df22e | 28 | build: core conf static banana wiki openid medals jquery |
0337d704 | 29 | |
cef8ceb2 | 30 | check: |
1eaaa62d | 31 | @!(find . -name '*.php' -exec php -l {} ";" | grep -v 'No syntax errors detected') |
cef8ceb2 | 32 | |
fd48ab5f FB |
33 | test: |
34 | make -C core test | |
35 | ||
63528107 | 36 | q: |
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 |
43 | up: update |
44 | update: | |
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 | 54 | core: |
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 | 62 | conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp spool/banana |
9380b1bf | 63 | |
5f0ecf6c | 64 | spool/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 | 68 | htdocs/.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 | ## | |
76 | static: htdocs/javascript@VERSION | |
77 | ||
78 | %@VERSION: % Makefile ChangeLog | |
79 | cd $< && rm -f $(VERSION) && ln -sf . $(VERSION) | |
80 | ||
81 | ## | |
9380b1bf | 82 | ## wiki |
83 | ## | |
84 | ||
85 | WIKI_NEEDS = \ | |
86 | wiki/local/farmconfig.php \ | |
87 | wiki/pub/skins/empty \ | |
88 | wiki/cookbook/e-protect.php \ | |
89 | spool/wiki.d \ | |
90 | htdocs/uploads \ | |
91 | htdocs/wiki \ | |
92 | ||
93 | wiki: get-wiki build-wiki | |
94 | ||
95 | build-wiki: $(WIKI_NEEDS) | get-wiki | |
96 | ||
c31c4e6a | 97 | htdocs/uploads: |
9380b1bf | 98 | cd htdocs && ln -sf ../spool/uploads |
99 | ||
100 | htdocs/wiki: | |
101 | cd htdocs && ln -sf ../wiki/pub wiki | |
102 | ||
103 | ||
91f37c81 | 104 | spool/wiki.d: |
b66268df | 105 | mkdir -p $@ |
106 | chmod o+w $@ | |
2c799249 | 107 | cd $@ && ln -sf ../../include/wiki/wiki.d/* . |
91f37c81 | 108 | |
9380b1bf | 109 | |
4887dc90 | 110 | wiki/cookbook/e-protect.php: |
2c799249 | 111 | cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php |
0337d704 | 112 | |
796aea34 | 113 | wiki/local/farmconfig.php: |
2c799249 | 114 | cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php |
b66268df | 115 | |
116 | wiki/pub/skins/empty: | |
2c799249 | 117 | cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty |
b66268df | 118 | |
9380b1bf | 119 | |
d207e9f5 | 120 | get-wiki: |
121 | @if ! test -d wiki; then \ | |
122 | wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \ | |
bba430bf AA |
123 | tar -xzvf pmwiki-latest.tgz; \ |
124 | rm pmwiki-latest.tgz; \ | |
125 | mv pmwiki-* wiki; \ | |
126 | fi | |
127 | ||
128 | ## | |
129 | ## openid | |
130 | ## | |
131 | ||
a1af4a99 | 132 | openid: get-openid spool/openid/store |
bba430bf AA |
133 | |
134 | # There is no obvious way to automatically use the latest version | |
34d91db6 | 135 | OPENID_VERSION = 2.1.3 |
bba430bf | 136 | get-openid: |
b69727b4 | 137 | @if ! test -d include/Auth; then \ |
34d91db6 VZ |
138 | wget http://openidenabled.com/files/php-openid/packages/php-openid-$(OPENID_VERSION).tar.bz2; \ |
139 | tar -xjf php-openid-$(OPENID_VERSION).tar.bz2; \ | |
140 | mv php-openid-$(OPENID_VERSION)/Auth include/; \ | |
141 | rm php-openid-$(OPENID_VERSION).tar.bz2; \ | |
142 | rm -r php-openid-$(OPENID_VERSION); \ | |
d207e9f5 | 143 | fi |
144 | ||
a1af4a99 AA |
145 | spool/openid/store: |
146 | mkdir -p $@ | |
147 | chmod o+w $@ | |
148 | ||
9380b1bf | 149 | ## |
150 | ## banana | |
151 | ## | |
c3b581dc | 152 | banana: htdocs/images/banana htdocs/css/banana.css |
1fccdc24 | 153 | htdocs/images/banana: banana-sub |
bdf8bbb2 | 154 | cd $(@D) && ln -snf ../../banana/img $(@F) |
08dbcb5a | 155 | |
1fccdc24 | 156 | htdocs/css/banana.css: banana-sub |
bdf8bbb2 | 157 | cd $(@D) && ln -snf ../../banana/css/style.css $(@F) |
5b677a86 | 158 | |
1fccdc24 FB |
159 | banana-sub: |
160 | make -C banana | |
5b677a86 | 161 | |
bd6a5fe3 VZ |
162 | ## |
163 | ## Medal thumbnails | |
164 | ## | |
165 | MEDAL_PICTURES=$(wildcard htdocs/images/medals/*.jpg) | |
166 | MEDAL_THUMBNAILS=$(subst /medals/,/medals/thumb/,$(MEDAL_PICTURES)) | |
167 | ||
168 | medals: $(MEDAL_THUMBNAILS) | |
5b677a86 | 169 | |
bd6a5fe3 VZ |
170 | $(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F)) |
171 | convert -resize x50 $(subst /medals/thumb/,/medals/,$@) $@ | |
08dbcb5a | 172 | |
8c5c6d64 | 173 | ## |
174 | ## jquery | |
175 | ## | |
511d02b9 | 176 | JQUERY_VERSION=1.4.4 |
21fb012b | 177 | JQUERY_PLUGINS=color form |
5594f3a9 FB |
178 | JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS))) |
179 | ||
511d02b9 | 180 | JQUERY_UI_VERSION=1.8.7 |
e43ad2a3 | 181 | JQUERY_UI=core tabs widget |
889d9807 | 182 | JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI))) |
16019034 | 183 | |
511d02b9 FB |
184 | JQUERY_TMPL_VERSION=vBeta1.0.0 |
185 | JQUERY_TMPL_PATH=htdocs/javascript/jquery.tmpl.js | |
186 | ||
150a0a91 SJ |
187 | JSTREE_VERSION=1.0rc2 |
188 | JSTREE_PATH=htdocs/javascript/jquery.jstree.js | |
189 | ||
dd916657 VZ |
190 | # TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue |
191 | # is that the version we use is not available anymore on the Internet, and the latest version | |
192 | # we could use is not backward compatible with our current code. | |
511d02b9 | 193 | jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES) $(JQUERY_TMPL_PATH) $(JSTREE_PATH) |
5594f3a9 | 194 | |
889d9807 FB |
195 | htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: DOWNLOAD_SRC = http://jquery.com/src/$(@F) |
196 | htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: | |
07ea8c0e | 197 | @-rm htdocs/javascript/jquery-*.min.js |
5594f3a9 | 198 | @$(download) |
8c5c6d64 | 199 | |
889d9807 | 200 | htdocs/javascript/jquery.js: htdocs/javascript/jquery-$(JQUERY_VERSION).min.js |
07ea8c0e | 201 | ln -snf $(<F) $@ |
889d9807 | 202 | |
21fb012b | 203 | $(JQUERY_PLUGINS_PATHES): DOWNLOAD_SRC = http://plugins.jquery.com/files/$(@F)_0.txt |
5594f3a9 | 204 | $(JQUERY_PLUGINS_PATHES): |
07ea8c0e | 205 | @-rm htdocs/javascript/jquery.ui*.$*.js |
5594f3a9 | 206 | @$(download) |
de99248c | 207 | |
e43ad2a3 | 208 | htdocs/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 | 209 | htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js: |
16019034 FB |
210 | @$(download) |
211 | ||
889d9807 | 212 | $(JQUERY_UI_PATHES): htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js |
07ea8c0e | 213 | ln -snf $(<F) $@ |
889d9807 | 214 | |
511d02b9 FB |
215 | htdocs/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 |
216 | htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js: | |
217 | @-rm htdocs/javascript/jquery.tmpl*.js | |
218 | @$(download) | |
219 | ||
220 | $(JQUERY_TMPL_PATH): htdocs/javascript/jquery.tmpl-$(JQUERY_TMPL_VERSION).js | |
221 | ln -snf $(<F) $@ | |
222 | ||
150a0a91 SJ |
223 | $(JSTREE_PATH): |
224 | rm -f htdocs/javascript/jquery.jstree-*.js | |
225 | mkdir spool/tmp/jstree | |
226 | wget http://jstree.googlecode.com/files/jsTree.v.$(JSTREE_VERSION).zip -O spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip | |
227 | unzip spool/tmp/jstree/jquery.jstree-$(JSTREE_VERSION).zip -d spool/tmp/jstree/ | |
228 | mv -f spool/tmp/jstree/themes/default/style.css htdocs/css/jstree.css | |
229 | mv -f spool/tmp/jstree/themes/default/d.png htdocs/images/jstree.png | |
230 | mv -f spool/tmp/jstree/jquery.jstree.js htdocs/javascript/jquery.jstree-$(JSTREE_VERSION).js | |
ac639b4c PC |
231 | sed -i -e 's/"d\.png"/"..\/images\/jstree.png"/' htdocs/css/jstree.css |
232 | sed -i -e 's/"throbber\.gif"/"..\/images\/wait.gif"/' htdocs/css/jstree.css | |
233 | sed -i -e 's/#ffffee/inherit/' htdocs/css/jstree.css | |
150a0a91 SJ |
234 | ln -snf jquery.jstree-$(JSTREE_VERSION).js htdocs/javascript/jquery.jstree.js |
235 | rm -Rf spool/tmp/jstree | |
236 | ||
237 | ||
c5644a5b FB |
238 | ## |
239 | ## lists rpc | |
240 | ## | |
241 | start-listrpc: spool/run | |
242 | sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid -m -b -x $$PWD/bin/lists.rpc.py --start | |
243 | @sleep 2 | |
244 | @sudo -u list kill -0 $$(cat spool/run/listrpc.pid) | |
245 | ||
246 | start-listrpc-fg: spool/run | |
247 | sudo -u list ./bin/lists.rpc.py | |
248 | ||
249 | stop-listrpc: | |
250 | -sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid --stop | |
251 | @-rm -f spool/run/listrpc.pid | |
252 | ||
253 | restart-listrpc: stop-listrpc start-listrpc | |
254 | ||
0337d704 | 255 | ################################################################################ |
b66268df | 256 | |
c3b581dc FB |
257 | .PHONY: build dist clean core http* check test |
258 | .PHONY: wiki build-wiki | |
259 | .PHONY: banana banana-sub htdocs/images/banana htdocs/css/banana.css | |
c5644a5b | 260 | .PHONY: start-listrpc start-listrpc-fg stop-listrpc restart-listrpc |
8b944f3e | 261 | .PHONY: up update |