2 # $Id: Makefile,v 1.5 2004/11/25 20:18:39 x99laine Exp $
3 ################################################################################
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')
9 VERSION
= $(VERSNUM
)$(VERSTAG
)
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
16 VCS_FILTER
= ! -name .arch-ids
! -name CVS
19 @echo
"Downloading $@ from $(DOWNLOAD_SRC)"
20 wget
$(DOWNLOAD_SRC
) -O
$@
-q ||
($(RM
) $@
; exit
1)
23 ################################################################################
28 build
: core conf static banana wiki openid medals jquery
31 @
!(find .
-name
'*.php' -exec php
-l
{} ";" | grep
-v
'No syntax errors detected')
37 @echo
-e
"Code statistics\n"
38 @sloccount
$(filter-out wiki
/ spool
/, $(wildcard */)) 2> /dev
/null | egrep
'^[a-z]*:'
40 %: %.in Makefile ChangeLog
41 sed
-e
's,@VERSION@,$(VERSION),g' $< > $@
45 @git fetch
&& git rebase
`git symbolic-ref HEAD | sed -e 's~refs/heads/~origin/~'` && git submodule update
47 ################################################################################
55 [ -d core
/.git
] ||
( git submodule init
&& git submodule update
)
62 conf
: spool
/templates_c spool
/mails_c classes
/platalglobals.php configs
/platal.cron htdocs
/.htaccess spool
/conf spool
/tmp spool
/banana
64 spool
/templates_c spool
/mails_c spool
/uploads spool
/conf spool
/tmp spool
/run spool
/banana
:
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" $< > $@
76 static
: htdocs
/javascript@VERSION
78 %@VERSION
: % Makefile ChangeLog
79 cd
$< && rm -f
$(VERSION
) && ln
-sf .
$(VERSION
)
86 wiki
/local
/farmconfig.php \
87 wiki
/pub
/skins
/empty \
88 wiki
/cookbook
/e-protect.php \
93 wiki
: get-wiki build-wiki
95 build-wiki
: $(WIKI_NEEDS
) | get-wiki
98 cd htdocs
&& ln
-sf ..
/spool
/uploads
101 cd htdocs
&& ln
-sf ..
/wiki
/pub wiki
107 cd
$@
&& ln
-sf ..
/..
/include/wiki
/wiki.d
/* .
110 wiki
/cookbook
/e-protect.php
:
111 cd wiki
/cookbook
&& ln
-sf ..
/..
/include/wiki
/e-protect.php
113 wiki
/local
/farmconfig.php
:
114 cd wiki
/local
/ && ln
-sf ..
/..
/include/wiki
/farmconfig.php
116 wiki
/pub
/skins
/empty
:
117 cd wiki
/pub
/skins
/ && ln
-sf ..
/..
/..
/include/wiki
/empty
121 @if
! test -d wiki
; then \
122 wget http
://www.pmwiki.org
/pub
/pmwiki
/pmwiki-latest.tgz
; \
123 tar -xzvf pmwiki-latest.tgz
; \
124 rm pmwiki-latest.tgz
; \
132 openid
: get-openid spool
/openid
/store
134 # There is no obvious way to automatically use the latest version
135 OPENID_VERSION
= 2.1.3
137 @if
! test -d
include/Auth
; then \
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
); \
152 banana
: htdocs
/images
/banana htdocs
/css
/banana.css
153 htdocs
/images
/banana
: banana-sub
154 cd
$(@D
) && ln
-snf ..
/..
/banana
/img
$(@F
)
156 htdocs
/css
/banana.css
: banana-sub
157 cd
$(@D
) && ln
-snf ..
/..
/banana
/css
/style.css
$(@F
)
165 MEDAL_PICTURES
=$(wildcard htdocs
/images
/medals
/*.jpg
)
166 MEDAL_THUMBNAILS
=$(subst /medals
/,/medals
/thumb
/,$(MEDAL_PICTURES
))
168 medals
: $(MEDAL_THUMBNAILS
)
170 $(MEDAL_THUMBNAILS
): $(subst /medals
/thumb
/,/medals
/,$(@F
))
171 convert
-resize x50
$(subst /medals
/thumb
/,/medals
/,$@
) $@
177 JQUERY_PLUGINS
=color form
178 JQUERY_PLUGINS_PATHES
=$(addprefix htdocs
/javascript
/jquery.
,$(addsuffix .js
,$(JQUERY_PLUGINS
)))
180 JQUERY_UI_VERSION
=1.6
182 JQUERY_UI_PATHES
=$(addprefix htdocs
/javascript
/jquery.ui.
,$(addsuffix .js
,$(JQUERY_UI
)))
184 JSTREE_VERSION
=1.0rc2
185 JSTREE_PATH
=htdocs
/javascript
/jquery.jstree.js
187 # TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue
188 # is that the version we use is not available anymore on the Internet, and the latest version
189 # we could use is not backward compatible with our current code.
190 jquery
: htdocs
/javascript
/jquery.js
$(JQUERY_PLUGINS_PATHES
) $(JQUERY_UI_PATHES
) $(JSTREE_PATH
)
192 htdocs
/javascript
/jquery-
$(JQUERY_VERSION
).min.js
: DOWNLOAD_SRC
= http
://jquery.com
/src
/$(@F
)
193 htdocs
/javascript
/jquery-
$(JQUERY_VERSION
).min.js
:
194 @
-rm htdocs
/javascript
/jquery-
*.min.js
197 htdocs
/javascript
/jquery.js
: htdocs
/javascript
/jquery-
$(JQUERY_VERSION
).min.js
200 $(JQUERY_PLUGINS_PATHES
): DOWNLOAD_SRC
= http
://plugins.jquery.com
/files
/$(@F
)_0.txt
201 $(JQUERY_PLUGINS_PATHES
):
202 @
-rm htdocs
/javascript
/jquery.ui
*.
$*.js
205 htdocs
/javascript
/jquery.ui-
$(JQUERY_UI_VERSION
).
%.js
: DOWNLOAD_SRC
= http
://jquery-ui.googlecode.com
/svn
/tags/$(JQUERY_UI_VERSION
)/ui
/ui.
$*.js
206 htdocs
/javascript
/jquery.ui-
$(JQUERY_UI_VERSION
).
%.js
:
209 $(JQUERY_UI_PATHES
): htdocs
/javascript
/jquery.ui.
%.js
: htdocs
/javascript
/jquery.ui-
$(JQUERY_UI_VERSION
).
%.js
213 rm -f htdocs
/javascript
/jquery.jstree-
*.js
214 mkdir spool
/tmp
/jstree
215 wget http
://jstree.googlecode.com
/files
/jsTree.v.
$(JSTREE_VERSION
).zip
-O spool
/tmp
/jstree
/jquery.jstree-
$(JSTREE_VERSION
).zip
216 unzip spool
/tmp
/jstree
/jquery.jstree-
$(JSTREE_VERSION
).zip
-d spool
/tmp
/jstree
/
217 mv
-f spool
/tmp
/jstree
/themes
/default
/style.css htdocs
/css
/jstree.css
218 mv
-f spool
/tmp
/jstree
/themes
/default
/d.png htdocs
/images
/jstree.png
219 mv
-f spool
/tmp
/jstree
/jquery.jstree.js htdocs
/javascript
/jquery.jstree-
$(JSTREE_VERSION
).js
220 sed
-i
-e
's/"d\.png"/"..\/images\/jstree.png"/' htdocs
/css
/jstree.css
221 sed
-i
-e
's/"throbber\.gif"/"..\/images\/wait.gif"/' htdocs
/css
/jstree.css
222 sed
-i
-e
's/#ffffee/inherit/' htdocs
/css
/jstree.css
223 ln
-snf jquery.jstree-
$(JSTREE_VERSION
).js htdocs
/javascript
/jquery.jstree.js
224 rm -Rf spool
/tmp
/jstree
230 start-listrpc
: spool
/run
231 sudo
-u list
/sbin
/start-stop-daemon
--pidfile spool
/run
/listrpc.pid
-m
-b
-x
$$PWD/bin
/lists.rpc.py
--start
233 @sudo
-u list kill
-0 $$(cat spool
/run
/listrpc.pid
)
235 start-listrpc-fg
: spool
/run
236 sudo
-u list .
/bin
/lists.rpc.py
239 -sudo
-u list
/sbin
/start-stop-daemon
--pidfile spool
/run
/listrpc.pid
--stop
240 @
-rm -f spool
/run
/listrpc.pid
242 restart-listrpc
: stop-listrpc start-listrpc
244 ################################################################################
246 .PHONY
: build
dist clean core http
* check test
247 .PHONY
: wiki build-wiki
248 .PHONY
: banana banana-sub htdocs
/images
/banana htdocs
/css
/banana.css
249 .PHONY
: start-listrpc start-listrpc-fg stop-listrpc restart-listrpc