]> git.ozlabs.org Git - ccan/blob - Makefile-web
timer: fix timer_check() to iterate all levels.
[ccan] / Makefile-web
1 # This can be overridden on cmdline to generate pages elsewhere.
2 WEBDIR=/srv/www/ccodearchive.net
3
4 ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(MODS))
5 DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(MODS))
6 DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(MODS))
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 PRETTIFY=$(WEBDIR)/prettify/src/run_prettify.js $(WEBDIR)/prettify/src/prettify.css
12
13 upload: fastcheck modcheck
14         git push origin HEAD:master
15         git push github HEAD:master
16
17 # Check MODS list in Makefile-ccan matches modules we find.
18 modcheck:
19         @FOUND=$$(echo $$(find ccan -name _info | sed 's,ccan/\(.*\)/_info,\1,' | sort) ); LISTED=$$(echo $$(echo $(MODS) | tr ' ' '\012' | sort) ); if [ "$$FOUND" = "$$LISTED" ]; then exit 0; fi; while true; do a="$${FOUND%% *}"; b="$${LISTED%% *}"; if [ "$$a" != "$$b" ]; then echo "$$a found but $$b in MOD" >&2; exit 1; fi; FOUND="$${FOUND#* }"; LISTED="$${LISTED#* }"; done
20
21 clean-tree:
22         [ "$(WEBDEV)" ] || ! git status --porcelain | grep .
23
24 webpages: modcheck clean-tree webpages-unchecked
25
26 webpages-unchecked: $(WEB_SUBDIRS) $(PRETTIFY) $(WEBDIR)/index.html $(WEBDIR)/upload.html $(WEBDIR)/uploader.php $(WEBDIR)/example-config.h $(WEBDIR)/ccan.png $(WEBDIR)/ccan-bg.png $(WEBDIR)/ccan.css $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(WEBDIR)/Makefile-ccan $(ALL_PAGES) junkpages
27
28 junkpages: $(WEBDIR)/list.html $(WEBDIR)/junkcode $(JUNKPAGES) $(JUNKBALLS)
29 $(WEB_SUBDIRS): $(WEBDIR)
30         mkdir -p $@
31
32 $(PRETTIFY):
33         svn checkout http://google-code-prettify.googlecode.com/svn/trunk/ $(WEBDIR)/prettify
34
35 $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
36         git ls-files -z $< | xargs -0 -x tar cvfj $@ 
37
38 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
39         cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
40         URLPREFIX=../ php5 web/staticjunkcode.php junkcode/$* $* > $@
41
42 # We want tarball to contain ccan/; we put junkcode in, but don't depend on it.
43 $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell git ls-files ccan tools licenses)
44         DIR=`pwd` && cd /tmp && ln -sf "$$DIR" ccan && tar cvfj $@ `for f in $^; do echo ccan/$$f; done` ccan/junkcode && rm ccan
45
46 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
47
48 $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
49         php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) $(MODS) > $@
50
51 $(WEBDIR)/upload.html: web/staticupload.php
52         php5 web/staticupload.php > $@
53
54 # cpp inserts gratuitous linebreaks at start of file, makes for php problems.
55 $(WEBDIR)/uploader.php: web/uploader.php.cpp
56         cpp -w -C -P $< | grep . > $@
57
58 $(WEBDIR)/index.html: web/staticindex.php
59         php5 web/staticindex.php > $@
60
61 $(WEBDIR)/example-config.h: config.h
62         cp $< $@
63
64 $(WEBDIR)/Makefile-ccan: Makefile-ccan
65         cp $< $@
66
67 $(WEBDIR)/ccan.png: web/ccan.png
68         cp $< $@
69
70 $(WEBDIR)/ccan-bg.png: web/ccan-bg.png
71         cp $< $@
72
73 $(WEBDIR)/ccan.css: web/ccan.css
74         cp $< $@
75
76 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
77         @mkdir -p `dirname $@`
78         URLPREFIX=../`echo $* | tr -dc '/' | sed s',/,../,g'` php5 web/staticmoduleinfo.php `pwd`/ccan/$* $* > $@
79
80 $(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info clean-tree
81         @mkdir -p `dirname $@`
82         FILES=$$(tools/list_files.sh ccan/$*) && tar -c -j -f $@ $$FILES $$(echo $$FILES | xargs -n1 -r readlink | sed 's,^\(../\)*,,' | sort -u)
83
84 $(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info tools/ccan_depends clean-tree
85         @mkdir -p `dirname $@`
86         FILES=$$(tools/list_files.sh ccan/$* $$(tools/ccan_depends ccan/$*) ) && tar -c -j -f $@ $$FILES $$(echo $$FILES | xargs -n1 -r readlink | sed 's,^\(../\)*,,' | sort -u)
87
88 distclean: distclean-web
89
90 distclean-web:
91         rm -rf $(WEBDIR)