Add ProfileNetworking
[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')
8BANANA := $(shell ( [ -d ../banana ] && echo `pwd`"/../banana" ) || echo "/home/web/dev/banana")
9
10VERSION = $(VERSNUM)$(VERSTAG)
11
12PKG_NAME = platal
13PKG_DIST = $(PKG_NAME)-$(VERSION)
14PKG_FILES = AUTHORS ChangeLog COPYING README Makefile
15PKG_DIRS = configs htdocs include install.d plugins po scripts templates upgrade
16
17VCS_FILTER = ! -name .arch-ids ! -name CVS
18
19define download
20@echo "Downloading $@ from $(DOWNLOAD_SRC)"
21wget $(DOWNLOAD_SRC) -O $@ -q || ($(RM) $@; exit 1)
22endef
23
24################################################################################
25# global targets
26
27all: build
28
29build: core conf static banana wiki openid medals jquery
30
31check:
32 @!(find . -name '*.php' -exec php -l {} ";" | grep -v 'No syntax errors detected')
33
34test:
35 make -C core test
36
37q:
38 @echo -e "Code statistics\n"
39 @sloccount $(filter-out wiki/ spool/, $(wildcard */)) 2> /dev/null | egrep '^[a-z]*:'
40
41%: %.in Makefile ChangeLog
42 sed -e 's,@VERSION@,$(VERSION),g' $< > $@
43
44################################################################################
45# targets
46
47##
48## core
49##
50
51core:
52 [ -d core/.git ] || ( git submodule init && git submodule update )
53 make -C core all
54
55##
56## conf
57##
58
59conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp
60
61spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp:
62 mkdir -p $@
63 chmod o+w $@
64
65htdocs/.htaccess: htdocs/.htaccess.in Makefile
66 @REWRITE_BASE="/~$$(id -un)"; \
67 test "$$REWRITE_BASE" = "/~web" && REWRITE_BASE="/"; \
68 sed -e "s,@REWRITE_BASE@,$$REWRITE_BASE,g" $< > $@
69
70##
71## static content
72##
73static: htdocs/javascript@VERSION
74
75%@VERSION: % Makefile ChangeLog
76 cd $< && rm -f $(VERSION) && ln -sf . $(VERSION)
77
78##
79## wiki
80##
81
82WIKI_NEEDS = \
83 wiki/local/farmconfig.php \
84 wiki/pub/skins/empty \
85 wiki/cookbook/e-protect.php \
86 spool/wiki.d \
87 htdocs/uploads \
88 htdocs/wiki \
89
90wiki: get-wiki build-wiki
91
92build-wiki: $(WIKI_NEEDS) | get-wiki
93
94htdocs/uploads:
95 cd htdocs && ln -sf ../spool/uploads
96
97htdocs/wiki:
98 cd htdocs && ln -sf ../wiki/pub wiki
99
100
101spool/wiki.d:
102 mkdir -p $@
103 chmod o+w $@
104 cd $@ && ln -sf ../../include/wiki/wiki.d/* .
105
106
107wiki/cookbook/e-protect.php:
108 cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php
109
110wiki/local/farmconfig.php:
111 cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php
112
113wiki/pub/skins/empty:
114 cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty
115
116
117get-wiki:
118 @if ! test -d wiki; then \
119 wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \
120 tar -xzvf pmwiki-latest.tgz; \
121 rm pmwiki-latest.tgz; \
122 mv pmwiki-* wiki; \
123 fi
124
125##
126## openid
127##
128
129openid: get-openid spool/openid/store
130
131# There is no obvious way to automatically use the latest version
132OPENID_VERSION = 2.1.3
133get-openid:
134 @if ! test -d include/Auth; then \
135 wget http://openidenabled.com/files/php-openid/packages/php-openid-$(OPENID_VERSION).tar.bz2; \
136 tar -xjf php-openid-$(OPENID_VERSION).tar.bz2; \
137 mv php-openid-$(OPENID_VERSION)/Auth include/; \
138 rm php-openid-$(OPENID_VERSION).tar.bz2; \
139 rm -r php-openid-$(OPENID_VERSION); \
140 fi
141
142spool/openid/store:
143 mkdir -p $@
144 chmod o+w $@
145
146##
147## banana
148##
149
150banana: htdocs/images/banana htdocs/css/banana.css include/banana/banana.inc.php
151htdocs/images/banana:
152 cd $(@D) && ln -snf $(BANANA)/img $(@F)
153
154htdocs/css/banana.css:
155 cd $(@D) && ln -snf $(BANANA)/css/style.css $(@F)
156
157include/banana/banana.inc.php:
158 cd $(@D) && find $(BANANA)/banana/ -name '*.php' -exec ln -snf {} . ";"
159
160##
161## Medal thumbnails
162##
163MEDAL_PICTURES=$(wildcard htdocs/images/medals/*.jpg)
164MEDAL_THUMBNAILS=$(subst /medals/,/medals/thumb/,$(MEDAL_PICTURES))
165
166medals: $(MEDAL_THUMBNAILS)
167
168$(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F))
169 convert -resize x50 $(subst /medals/thumb/,/medals/,$@) $@
170
171##
172## jquery
173##
174JQUERY_VERSION=1.4.2
175JQUERY_PLUGINS=color
176JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS)))
177
178JQUERY_UI_VERSION=1.6
179JQUERY_UI=core tabs
180JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI)))
181
182# TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue
183# is that the version we use is not available anymore on the Internet, and the latest version
184# we could use is not backward compatible with our current code.
185jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES)
186
187htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: DOWNLOAD_SRC = http://jquery.com/src/$(@F)
188htdocs/javascript/jquery-$(JQUERY_VERSION).min.js:
189 @-rm htdocs/javascript/jquery-*.min.js
190 @$(download)
191
192htdocs/javascript/jquery.js: htdocs/javascript/jquery-$(JQUERY_VERSION).min.js
193 ln -snf $(<F) $@
194
195$(JQUERY_PLUGINS_PATHES): DOWNLOAD_SRC = http://plugins.jquery.com/files/$(@F).txt
196$(JQUERY_PLUGINS_PATHES):
197 @-rm htdocs/javascript/jquery.ui*.$*.js
198 @$(download)
199
200htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js: DOWNLOAD_SRC = http://jquery-ui.googlecode.com/svn/tags/$(JQUERY_UI_VERSION)/ui/ui.$*.js
201htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js:
202 @$(download)
203
204$(JQUERY_UI_PATHES): htdocs/javascript/jquery.ui.%.js: htdocs/javascript/jquery.ui-$(JQUERY_UI_VERSION).%.js
205 ln -snf $(<F) $@
206
207################################################################################
208
209.PHONY: build dist clean core wiki build-wiki banana htdocs/images/banana htdocs/css/banana.css include/banana/banana.inc.php http* check test
210