]> git.ozlabs.org Git - ccan/blob - Makefile-web
breakpoint: new module.
[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
12 upload: fastcheck modcheck
13         git push origin HEAD:master
14         git push github HEAD:master
15
16 # Check MODS list in Makefile-ccan matches modules we find.
17 modcheck:
18         @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
19
20 clean-tree:
21         ! git status --porcelain | grep .
22
23 webpages: modcheck clean-tree $(WEB_SUBDIRS) $(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
24
25 junkpages: $(WEBDIR)/list.html $(WEBDIR)/junkcode $(JUNKPAGES) $(JUNKBALLS)
26 $(WEB_SUBDIRS): $(WEBDIR)
27         mkdir -p $@
28
29 $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
30         git ls-files -z $< | xargs -0 -x tar cvfj $@ 
31
32 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
33         cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
34         php5 web/staticjunkcode.php junkcode/$* $* > $@
35
36 # We want tarball to contain ccan/; we put junkcode in, but don't depend on it.
37 $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell git ls-files ccan tools licenses)
38         DIR=`pwd` && cd /tmp && ln -sf "$$DIR" ccan && tar cvfj $@ `for f in $^; do echo ccan/$$f; done` ccan/junkcode && rm ccan
39
40 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
41
42 $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
43         php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) $(MODS) > $@
44
45 $(WEBDIR)/upload.html: web/staticupload.php
46         php5 web/staticupload.php > $@
47
48 # cpp inserts gratuitous linebreaks at start of file, makes for php problems.
49 $(WEBDIR)/uploader.php: web/uploader.php.cpp
50         cpp -w -C -P $< | grep . > $@
51
52 $(WEBDIR)/index.html: web/staticindex.php
53         php5 web/staticindex.php > $@
54
55 $(WEBDIR)/example-config.h: config.h
56         cp $< $@
57
58 $(WEBDIR)/Makefile-ccan: Makefile-ccan
59         cp $< $@
60
61 $(WEBDIR)/ccan.jpg: web/ccan.jpg
62         cp $< $@
63
64 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
65         @mkdir -p `dirname $@`
66         URLPREFIX=../`echo $* | tr -dc '/' | sed s',/,../,g'` php5 web/staticmoduleinfo.php `pwd`/ccan/$* $* > $@
67
68 $(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info clean-tree
69         @mkdir -p `dirname $@`
70         FILES=$$(tools/list_files.sh ccan/$*) && tar -c -j -f $@ $$FILES $$(echo $$FILES | xargs -n1 -r readlink | sed 's,^\(../\)*,,' | sort -u)
71
72 $(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info tools/ccan_depends clean-tree
73         @mkdir -p `dirname $@`
74         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)
75
76 distclean: distclean-web
77
78 distclean-web:
79         rm -rf $(WEBDIR)