Auto-redirects HTML pages to HTTPS
[platal.git] / Makefile
1
2 # $Id: Makefile,v 1.5 2004/11/25 20:18:39 x99laine Exp $
3 ################################################################################
4 # definitions
5
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')
8 VERSION = $(VERSNUM)$(VERSTAG)
9
10 PKG_NAME = platal
11 PKG_DIST = $(PKG_NAME)-$(VERSION)
12 PKG_FILES = AUTHORS ChangeLog COPYING README Makefile
13 PKG_DIRS = configs htdocs include install.d plugins po scripts templates upgrade
14
15 VCS_FILTER = ! -name .arch-ids ! -name CVS
16
17 ################################################################################
18 # global targets
19
20 all: build
21
22 build: core banana wiki jquery
23
24 q:
25 @echo -e "Code statistics\n"
26 @sloccount $(filter-out wiki/ spool/, $(wildcard */)) 2> /dev/null | egrep '^[a-z]*:'
27
28 %: %.in Makefile ChangeLog
29 sed -e 's,@VERSION@,$(VERSION),g' $< > $@
30
31 ################################################################################
32 # targets
33
34 ##
35 ## core
36 ##
37
38 core: spool/templates_c spool/mails_c include/globals.inc.php configs/platal.cron htdocs/.htaccess
39
40 spool/templates_c spool/mails_c spool/uploads:
41 mkdir -p $@
42 chmod o+w $@
43
44 htdocs/.htaccess: htdocs/.htaccess.in Makefile
45 @REWRITE_BASE="/~$$(id -un)"; \
46 test "$$REWRITE_BASE" = "/~web" && REWRITE_BASE="/"; \
47 sed -e "s,@REWRITE_BASE@,$$REWRITE_BASE,g" $< > $@
48
49 ##
50 ## wiki
51 ##
52
53 WIKI_NEEDS = \
54 wiki/local/farmconfig.php \
55 wiki/pub/skins/empty \
56 wiki/cookbook/e-protect.php \
57 spool/wiki.d \
58 htdocs/uploads \
59 htdocs/wiki \
60
61 wiki: get-wiki build-wiki
62
63 build-wiki: $(WIKI_NEEDS) | get-wiki
64
65 htdocs/uploads: spool/uploads
66 cd htdocs && ln -sf ../spool/uploads
67
68 htdocs/wiki:
69 cd htdocs && ln -sf ../wiki/pub wiki
70
71
72 spool/wiki.d:
73 mkdir -p $@
74 chmod o+w $@
75 cd $@ && ln -sf ../../include/wiki/wiki.d/* .
76
77
78 wiki/cookbook/e-protect.php:
79 cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php
80
81 wiki/local/farmconfig.php:
82 cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php
83
84 wiki/pub/skins/empty:
85 cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty
86
87
88 get-wiki:
89 @if ! test -d wiki; then \
90 wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \
91 tar -xzvf pmwiki-latest.tgz; \
92 rm pmwiki-latest.tgz; \
93 mv pmwiki-* wiki; \
94 fi
95
96 ##
97 ## banana
98 ##
99
100 banana: htdocs/images/banana htdocs/css/banana.css
101 htdocs/images/banana:
102 cd $(@D) && ln -sf /usr/share/banana/img $(@F)
103
104 htdocs/css/banana.css:
105 cd $(@D) && ln -sf /usr/share/banana/css/style.css $(@F)
106
107 ##
108 ## jquery
109 ##
110
111 jquery: htdocs/javascript/jquery.js htdocs/javascript/jquery.autocomplete.js
112 htdocs/javascript/jquery.js:
113 wget http://jquery.com/src/jquery-latest.pack.js -O $@ -q || ($(RM) $@; exit 1)
114
115 ################################################################################
116
117 .PHONY: build dist clean wiki build-wiki banana
118