Fix struct line spacing (opening bracked on same line is Linux standard)
[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         bzr push
14         send-web # Rusty's upload script.
15
16 webpages: $(WEB_SUBDIRS) $(WEBDIR)/junkcode $(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 $(ALL_PAGES) $(JUNKPAGES) $(JUNKBALLS)
17
18 $(WEB_SUBDIRS):
19         mkdir -p $@
20
21 $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
22         bzr ls --versioned --kind=file --null $< | xargs -0 -x tar cvfj $@ 
23
24 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
25         cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
26         php5 web/staticjunkcode.php junkcode/$* $* > $@
27
28 # We want tarball to contain ccan/
29 $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell bzr ls --versioned --kind=file ccan) $(shell bzr ls --versioned --kind=file tools)
30         DIR=`pwd` && cd /tmp && ln -sf "$$DIR" ccan && tar cvfj $@ `for f in $^; do echo ccan/$$f; done` && rm ccan
31
32 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
33
34 $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
35         php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) > $@
36
37 $(WEBDIR)/upload.html: web/staticupload.php
38         php5 web/staticupload.php > $@
39
40 # cpp inserts gratuitous linebreaks at start of file, makes for php problems.
41 $(WEBDIR)/uploader.php: web/uploader.php.cpp
42         @cpp -w -C -P $< | grep . > $@
43
44 $(WEBDIR)/index.html: web/staticindex.php
45         @php5 web/staticindex.php > $@
46
47 $(WEBDIR)/example-config.h: config.h
48         cp $< $@
49
50 $(WEBDIR)/Makefile-ccan: Makefile-ccan
51         cp $< $@
52
53 $(WEBDIR)/ccan.jpg: web/ccan.jpg
54         cp $< $@
55
56 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
57         @URLPREFIX=../ php5 web/staticmoduleinfo.php ccan/$* > $@
58
59 $(WEBDIR)/tarballs/%.tar.bz2: ccan/%/test
60         tar -c -j -f $@ `bzr ls --versioned --kind=file ccan/$*`
61
62 $(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/test tools/ccan_depends
63         tar cfj $@ $$(echo ccan/$* $$(tools/ccan_depends ccan/$*) | xargs -n 1 bzr ls --versioned --kind=file)
64
65 distclean: distclean-web
66
67 distclean-web:
68         rm -rf $(WEBDIR)