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