Site: posters are now hosted as sourceforge downloads
[adesklets.git] / site / GNUmakefile
blob368063ea981ad06acbad5e296af83fc87c45da04
1 # Written by S.Fourmanoit <syfou@users.sourceforge.net>, 2005.
3 # adesklets site preparation directory, based
4 # roughly on xsltproc and htmltidy. Makefile main targets are:
6 # all - all is rebuilt (default)
7 # prepare - site is packaged under ./adesklets-site
8 # publish - whole site is rsync'ed on sourceforge
10 # Important documents for day to day edition are:
12 # Source xml documents in src/*.xml src/*.xml.in
13 # News feed in news/*.txt
15 # Please also note that doc should be a symlink on up-to-date
16 # autogenerated html documentation directory from a packaged adesklets
17 # source distribution (By default, for using this from bitkeeper,
18 # it is automatically set to ../doc/html by this makefile if it does not exist
19 # when invoking 'all' target.
21 #-------------------------------------------------------------------------------
22 # Useful variables
24 HTML=$(subst .xml,.html,$(notdir $(wildcard src/*.xml))) \
25 $(subst .xml.in,.html,$(notdir $(wildcard src/*.xml.in))) \
26 news.html
27 XML=$(subst .html,.xml,$(HTML))
28 PWD=$(shell pwd)
29 VERSION=$(shell sed -n \
30 -e '/<title>/{s/.*<title>adesklets \([0-9\.]\+\).*/\1/p}' \
31 doc/en/index.html)
32 LAST_MODIFIED=$(shell date -u)
34 #-------------------------------------------------------------------------------
35 # Generic rules for assembling xml, performing variables substitution,
36 # and generating clean html from it
38 %.xml: src/%.xml include/menu.xml
39 @echo '<page>' > $@
40 cat include/menu.xml >> $@
41 cat $< >> $@
42 @echo '</page>' >> $@
44 %.xml : %.xml.in
45 sed -e 's/@VERSION@/$(VERSION)/g' \
46 -e 's/@LAST_MODIFIED@/$(LAST_MODIFIED)/g' $< > $@
48 %.html: %.xml include/adesklets.xsl
49 xsltproc include/adesklets.xsl $< | \
50 tidy --tidy-mark false -utf8 -q -i -asxhtml > $@ 2> /dev/null || \
51 [ "$$?" -eq "1" ] && true
53 #-------------------------------------------------------------------------------
54 # Main target
56 all: linkdoc $(HTML) desklets.atom
57 @echo "All OK."
59 #-------------------------------------------------------------------------------
60 # Special dependencies and rules
62 news.xml: $(wildcard news/*.txt) include/menu.xml
63 scripts/news.sh > $@
65 index.xml: ./desklets.xml
67 desklets.atom: ./desklets.xml include/atom.xsl
68 xsltproc include/atom.xsl $< | xmllint --format - | \
69 sed '/^$$/d' > desklets.tmp && \
70 mv desklets.tmp $@
72 #-------------------------------------------------------------------------------
73 # Phony targets for cleaning, making bzip'ed tarballs, publishing the site
75 .PHONY: all clean veryclean dist-bzip2 prepare touchit linkdoc publish
77 linkdoc:
78 @test -e doc || ( ln -f -s ../doc/html doc && \
79 echo "Doc symlink set. Restart make." 1>&2 && false )
81 touchit:
82 touch src/index.xml.in
84 clean:
85 -rm $(XML) html.tar.bz2 adesklets-site.tar.bz2 2> /dev/null
86 find . -name '*~' -exec rm \{\} ';'
88 veryclean: clean touchit
89 -rm $(HTML) 2> /dev/null
91 dist-bzip2: veryclean
92 tar -C .. -cvjf ../$(notdir $(PWD)).tar.bz2 $(notdir $(PWD))
93 mv ../$(notdir $(PWD)).tar.bz2 .
95 prepare: touchit all clean
96 -rm -rf ./adesklets-site
97 -mkdir --parents /tmp/adesklets-site/htdocs
98 -chmod 2775 /tmp/adesklets-site/{,htdocs}
99 -cp -Lrv . /tmp/adesklets-site/htdocs
100 -rm -rf /tmp/adesklets-site/htdocs/{src,news,scripts,include,GNUmakefile,forum}
101 -find /tmp/adesklets-site -type d -name 'SCCS' -exec rm -rf \{\} ';'
102 mv /tmp/adesklets-site/htdocs/{cgi-bin,..}
103 -chmod 2775 /tmp/adesklets-site/cgi-bin
104 mv /tmp/adesklets-site/htdocs/{,.}htaccess
105 chmod +x /tmp/adesklets-site/htdocs/index.html
106 mv {/tmp,.}/adesklets-site
107 -rm -rf /tmp/adesklets-site
109 publish: prepare
110 -rsync -rlptDvz ./adesklets-site/ sf:/home/groups/a/ad/adesklets