]> git.ozlabs.org Git - ccan/blob - Makefile-web
tools/ccanlint: slight neatening of license logic.
[ccan] / Makefile-web
1 # This can be overridden on cmdline to generate pages elsewhere.
2 WEBDIR=/home/rusty/www/html/ccan
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 $(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
25
26 junkpages: $(WEBDIR)/list.html $(WEBDIR)/junkcode $(JUNKPAGES) $(JUNKBALLS)
27 $(WEB_SUBDIRS): $(WEBDIR)
28         mkdir -p $@
29
30 $(PRETTIFY):
31         svn checkout http://google-code-prettify.googlecode.com/svn/trunk/ $(WEBDIR)/prettify
32
33 $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
34         git ls-files -z $< | xargs -0 -x tar cvfj $@ 
35
36 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
37         cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
38         URLPREFIX=../ php5 web/staticjunkcode.php junkcode/$* $* > $@
39
40 # We want tarball to contain ccan/; we put junkcode in, but don't depend on it.
41 $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell git ls-files ccan tools licenses)
42         DIR=`pwd` && cd /tmp && ln -sf "$$DIR" ccan && tar cvfj $@ `for f in $^; do echo ccan/$$f; done` ccan/junkcode && rm ccan
43
44 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
45
46 $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
47         php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) $(MODS) > $@
48
49 $(WEBDIR)/upload.html: web/staticupload.php
50         php5 web/staticupload.php > $@
51
52 # cpp inserts gratuitous linebreaks at start of file, makes for php problems.
53 $(WEBDIR)/uploader.php: web/uploader.php.cpp
54         cpp -w -C -P $< | grep . > $@
55
56 $(WEBDIR)/index.html: web/staticindex.php
57         php5 web/staticindex.php > $@
58
59 $(WEBDIR)/example-config.h: config.h
60         cp $< $@
61
62 $(WEBDIR)/Makefile-ccan: Makefile-ccan
63         cp $< $@
64
65 $(WEBDIR)/ccan.png: web/ccan.png
66         cp $< $@
67
68 $(WEBDIR)/ccan-bg.png: web/ccan-bg.png
69         cp $< $@
70
71 $(WEBDIR)/ccan.css: web/ccan.css
72         cp $< $@
73
74 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
75         @mkdir -p `dirname $@`
76         URLPREFIX=../`echo $* | tr -dc '/' | sed s',/,../,g'` php5 web/staticmoduleinfo.php `pwd`/ccan/$* $* > $@
77
78 $(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info clean-tree
79         @mkdir -p `dirname $@`
80         FILES=$$(tools/list_files.sh ccan/$*) && tar -c -j -f $@ $$FILES $$(echo $$FILES | xargs -n1 -r readlink | sed 's,^\(../\)*,,' | sort -u)
81
82 $(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info tools/ccan_depends clean-tree
83         @mkdir -p `dirname $@`
84         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)
85
86 distclean: distclean-web
87
88 distclean-web:
89         rm -rf $(WEBDIR)