]> git.ozlabs.org Git - ccan/blob - Makefile-web
d8790626db53b7232def7a39219ee1ed413d8134
[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 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)
13
14 $(WEB_SUBDIRS):
15         mkdir -p $@
16
17 $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
18         tar cvfj $@ `bzr ls --versioned --kind=file $<`
19
20 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
21         cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
22         php5 web/staticjunkcode.php junkcode/$* $* > $@
23
24 $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell bzr ls --versioned --kind=file ccan) $(shell bzr ls --versioned --kind=file tools)
25         tar cvfj $@ $^
26
27 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
28
29 $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
30         php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) > $@
31
32 $(WEBDIR)/upload.html: web/staticupload.php
33         php5 web/staticupload.php > $@
34
35 # cpp inserts gratuitous linebreaks at start of file, makes for php problems.
36 $(WEBDIR)/uploader.php: web/uploader.php.cpp
37         cpp -w -C -P $< | grep . > $@
38
39 $(WEBDIR)/index.html: web/staticindex.php
40         php5 web/staticindex.php > $@
41
42 $(WEBDIR)/example-config.h: config.h
43         cp $< $@
44
45 $(WEBDIR)/Makefile-ccan: Makefile-ccan
46         cp $< $@
47
48 $(WEBDIR)/ccan.jpg: web/ccan.jpg
49         cp $< $@
50
51 $(WEBDIR)/info/%.html: ccan/% ccan/%/test $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
52         URLPREFIX=../ php5 web/staticmoduleinfo.php ccan/$* > $@
53
54 $(WEBDIR)/tarballs/%.tar.bz2: ccan/% ccan/%/test
55         tar -c -v -j -f $@ `bzr ls --versioned --kind=file ccan/$*`
56
57 $(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/% ccan/%/test tools/ccan_depends
58         tar cvfj $@ $$(echo ccan/$* $$(tools/ccan_depends ccan/$*) | xargs -n 1 bzr ls --versioned --kind=file)
59
60 distclean: distclean-web
61
62 distclean-web:
63         rm -rf $(WEBDIR)