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 | ||
43 | ################################################################################ | |
b66268df | 44 | # targets |
91f37c81 | 45 | |
9380b1bf | 46 | ## |
47 | ## core | |
48 | ## | |
49 | ||
7e846cdf | 50 | core: |
ba47d308 | 51 | [ -d core/.git ] || ( git submodule init && git submodule update ) |
7e846cdf FB |
52 | make -C core all |
53 | ||
54 | ## | |
55 | ## conf | |
56 | ## | |
57 | ||
58 | conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp | |
9380b1bf | 59 | |
c5644a5b | 60 | spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp spool/run: |
91f37c81 | 61 | mkdir -p $@ |
62 | chmod o+w $@ | |
63 | ||
b6cdf7b4 | 64 | htdocs/.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" $< > $@ | |
9380b1bf | 68 | |
69 | ## | |
e97df22e VZ |
70 | ## static content |
71 | ## | |
72 | static: htdocs/javascript@VERSION | |
73 | ||
74 | %@VERSION: % Makefile ChangeLog | |
75 | cd $< && rm -f $(VERSION) && ln -sf . $(VERSION) | |
76 | ||
77 | ## | |
9380b1bf | 78 | ## wiki |
79 | ## | |
80 | ||
81 | WIKI_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 | ||
89 | wiki: get-wiki build-wiki | |
90 | ||
91 | build-wiki: $(WIKI_NEEDS) | get-wiki | |
92 | ||
c31c4e6a | 93 | htdocs/uploads: |
9380b1bf | 94 | cd htdocs && ln -sf ../spool/uploads |
95 | ||
96 | htdocs/wiki: | |
97 | cd htdocs && ln -sf ../wiki/pub wiki | |
98 | ||
99 | ||
91f37c81 | 100 | spool/wiki.d: |
b66268df | 101 | mkdir -p $@ |
102 | chmod o+w $@ | |
2c799249 | 103 | cd $@ && ln -sf ../../include/wiki/wiki.d/* . |
91f37c81 | 104 | |
9380b1bf | 105 | |
4887dc90 | 106 | wiki/cookbook/e-protect.php: |
2c799249 | 107 | cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php |
0337d704 | 108 | |
796aea34 | 109 | wiki/local/farmconfig.php: |
2c799249 | 110 | cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php |
b66268df | 111 | |
112 | wiki/pub/skins/empty: | |
2c799249 | 113 | cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty |
b66268df | 114 | |
9380b1bf | 115 | |
d207e9f5 | 116 | get-wiki: |
117 | @if ! test -d wiki; then \ | |
118 | wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \ | |
bba430bf AA |
119 | tar -xzvf pmwiki-latest.tgz; \ |
120 | rm pmwiki-latest.tgz; \ | |
121 | mv pmwiki-* wiki; \ | |
122 | fi | |
123 | ||
124 | ## | |
125 | ## openid | |
126 | ## | |
127 | ||
a1af4a99 | 128 | openid: get-openid spool/openid/store |
bba430bf AA |
129 | |
130 | # There is no obvious way to automatically use the latest version | |
34d91db6 | 131 | OPENID_VERSION = 2.1.3 |
bba430bf | 132 | get-openid: |
b69727b4 | 133 | @if ! test -d include/Auth; then \ |
34d91db6 VZ |
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); \ | |
d207e9f5 | 139 | fi |
140 | ||
a1af4a99 AA |
141 | spool/openid/store: |
142 | mkdir -p $@ | |
143 | chmod o+w $@ | |
144 | ||
9380b1bf | 145 | ## |
146 | ## banana | |
147 | ## | |
c3b581dc | 148 | banana: htdocs/images/banana htdocs/css/banana.css |
1fccdc24 | 149 | htdocs/images/banana: banana-sub |
bdf8bbb2 | 150 | cd $(@D) && ln -snf ../../banana/img $(@F) |
08dbcb5a | 151 | |
1fccdc24 | 152 | htdocs/css/banana.css: banana-sub |
bdf8bbb2 | 153 | cd $(@D) && ln -snf ../../banana/css/style.css $(@F) |
5b677a86 | 154 | |
1fccdc24 FB |
155 | banana-sub: |
156 | make -C banana | |
5b677a86 | 157 | |
bd6a5fe3 VZ |
158 | ## |
159 | ## Medal thumbnails | |
160 | ## | |
161 | MEDAL_PICTURES=$(wildcard htdocs/images/medals/*.jpg) | |
162 | MEDAL_THUMBNAILS=$(subst /medals/,/medals/thumb/,$(MEDAL_PICTURES)) | |
163 | ||
164 | medals: $(MEDAL_THUMBNAILS) | |
5b677a86 | 165 | |
bd6a5fe3 VZ |
166 | $(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F)) |
167 | convert -resize x50 $(subst /medals/thumb/,/medals/,$@) $@ | |
08dbcb5a | 168 | |
8c5c6d64 | 169 | ## |
170 | ## jquery | |
171 | ## | |
07ea8c0e | 172 | JQUERY_VERSION=1.4.2 |
5e35e81b | 173 | JQUERY_PLUGINS=color |
5594f3a9 FB |
174 | JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS))) |
175 | ||
07ea8c0e | 176 | JQUERY_UI_VERSION=1.6 |
16019034 | 177 | JQUERY_UI=core tabs |
889d9807 | 178 | JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI))) |
16019034 | 179 | |
dd916657 VZ |
180 | # TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue |
181 | # is that the version we use is not available anymore on the Internet, and the latest version | |
182 | # we could use is not backward compatible with our current code. | |
2f8bacc2 | 183 | jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES) |
5594f3a9 | 184 | |
889d9807 FB |
185 | htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: DOWNLOAD_SRC = http://jquery.com/src/$(@F) |
186 | htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: | |
07ea8c0e | 187 | @-rm htdocs/javascript/jquery-*.min.js |
5594f3a9 | 188 | @$(download) |
8c5c6d64 | 189 | |
889d9807 | 190 | htdocs/javascript/jquery.js: htdocs/javascript/jquery-$(JQUERY_VERSION).min.js |
07ea8c0e | 191 | ln -snf $(<F) $@ |
889d9807 | 192 | |
5594f3a9 FB |
193 | $(JQUERY_PLUGINS_PATHES): DOWNLOAD_SRC = http://plugins.jquery.com/files/$(@F).txt |
194 | $(JQUERY_PLUGINS_PATHES): | |
07ea8c0e | 195 | @-rm htdocs/javascript/jquery.ui*.$*.js |
5594f3a9 | 196 | @$(download) |
de99248c | 197 | |
889d9807 FB |
198 | htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js: DOWNLOAD_SRC = http://jquery-ui.googlecode.com/svn/tags/$(JQUERY_UI_VERSION)/ui/ui.$*.js |
199 | htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js: | |
16019034 FB |
200 | @$(download) |
201 | ||
889d9807 | 202 | $(JQUERY_UI_PATHES): htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js |
07ea8c0e | 203 | ln -snf $(<F) $@ |
889d9807 | 204 | |
c5644a5b FB |
205 | ## |
206 | ## lists rpc | |
207 | ## | |
208 | start-listrpc: spool/run | |
209 | sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid -m -b -x $$PWD/bin/lists.rpc.py --start | |
210 | @sleep 2 | |
211 | @sudo -u list kill -0 $$(cat spool/run/listrpc.pid) | |
212 | ||
213 | start-listrpc-fg: spool/run | |
214 | sudo -u list ./bin/lists.rpc.py | |
215 | ||
216 | stop-listrpc: | |
217 | -sudo -u list /sbin/start-stop-daemon --pidfile spool/run/listrpc.pid --stop | |
218 | @-rm -f spool/run/listrpc.pid | |
219 | ||
220 | restart-listrpc: stop-listrpc start-listrpc | |
221 | ||
0337d704 | 222 | ################################################################################ |
b66268df | 223 | |
c3b581dc FB |
224 | .PHONY: build dist clean core http* check test |
225 | .PHONY: wiki build-wiki | |
226 | .PHONY: banana banana-sub htdocs/images/banana htdocs/css/banana.css | |
c5644a5b | 227 | .PHONY: start-listrpc start-listrpc-fg stop-listrpc restart-listrpc |