]> git.ozlabs.org Git - ccan/blob - Makefile-web
alloc: use page numbers in lists to reduce overhead.
[ccan] / Makefile-web
1 # This can be overridden on cmdline to generate pages elsewhere.
2 WEBDIR=/home/rusty/www/html/ccan
3
4 # Ignore EXCLUDE when making webpages.
5 REALLY_ALL=$(patsubst ccan/%/_info, %, $(shell bzr ls -R ccan | grep '/_info$$'))
6 ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(REALLY_ALL))
7 DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(REALLY_ALL))
8 DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(REALLY_ALL))
9 WEB_SUBDIRS=$(WEBDIR)/tarballs $(WEBDIR)/junkcode $(WEBDIR)/tarballs/with-deps $(WEBDIR)/info
10 JUNKDIRS=$(wildcard junkcode/*)
11 JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html)
12 JUNKBALLS=$(JUNKDIRS:%=$(WEBDIR)/%.tar.bz2)
13 BZRBROWSE=$(WEBDIR)/bzrbrowse.cgi $(WEBDIR)/file.png $(WEBDIR)/folder.png
14
15 upload: fastcheck webpages
16         bzr push
17         send-web # Rusty's upload script.
18
19 webpages: $(WEB_SUBDIRS) $(WEBDIR)/junkcode $(WEBDIR)/list.html $(WEBDIR)/index.html $(WEBDIR)/upload.html $(WEBDIR)/uploader.php $(WEBDIR)/example-config.h $(WEBDIR)/ccan.jpg $(BZRBROWSE) $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(WEBDIR)/Makefile-ccan $(ALL_PAGES) $(JUNKPAGES) $(JUNKBALLS)
20
21 $(WEB_SUBDIRS):
22         mkdir -p $@
23
24 $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
25         bzr ls --recursive --versioned --kind=file --null $< | xargs -0 -x tar cvfj $@ 
26
27 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
28         cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
29         php5 web/staticjunkcode.php junkcode/$* $* > $@
30
31 # We want tarball to contain ccan/
32 $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell bzr ls --versioned --kind=file --recursive ccan) $(shell bzr ls --versioned --recursive --kind=file tools)
33         DIR=`pwd` && cd /tmp && ln -sf "$$DIR" ccan && tar cvfj $@ `for f in $^; do echo ccan/$$f; done` && rm ccan
34
35 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
36
37 $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
38         php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) > $@
39
40 $(WEBDIR)/upload.html: web/staticupload.php
41         php5 web/staticupload.php > $@
42
43 # cpp inserts gratuitous linebreaks at start of file, makes for php problems.
44 $(WEBDIR)/uploader.php: web/uploader.php.cpp
45         @cpp -w -C -P $< | grep . > $@
46
47 $(WEBDIR)/index.html: web/staticindex.php
48         @php5 web/staticindex.php > $@
49
50 $(WEBDIR)/example-config.h: config.h
51         cp $< $@
52
53 $(WEBDIR)/Makefile-ccan: Makefile-ccan
54         cp $< $@
55
56 $(WEBDIR)/ccan.jpg: web/ccan.jpg
57         cp $< $@
58
59 $(BZRBROWSE): $(WEBDIR)/%: web/bzrbrowse/%
60         cp $< $@
61
62 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
63         @URLPREFIX=../ php5 web/staticmoduleinfo.php `pwd`/ccan/$* > $@
64
65 $(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info
66         tar -c -j -f $@ `bzr ls --recursive --versioned --kind=file ccan/$*`
67
68 $(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info tools/ccan_depends
69         tar cfj $@ $$(echo ccan/$* $$(tools/ccan_depends ccan/$*) | xargs -n 1 bzr ls --recursive --versioned --kind=file)
70
71 distclean: distclean-web
72
73 distclean-web:
74         rm -rf $(WEBDIR)