1 # This can be overridden on cmdline to generate pages elsewhere.
2 WEBDIR=/home/rusty/www/html/ccan
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)
12 upload: fastcheck modcheck
13 git push origin HEAD:master
14 git push github HEAD:master
16 # Check MODS list in Makefile-ccan matches modules we find.
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
21 ! git status --porcelain | grep .
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
25 junkpages: $(WEBDIR)/list.html $(WEBDIR)/junkcode $(JUNKPAGES) $(JUNKBALLS)
26 $(WEB_SUBDIRS): $(WEBDIR)
29 $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
30 git ls-files -z $< | xargs -0 -x tar cvfj $@
32 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
33 cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
34 php5 web/staticjunkcode.php junkcode/$* $* > $@
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
40 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
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) > $@
45 $(WEBDIR)/upload.html: web/staticupload.php
46 php5 web/staticupload.php > $@
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 . > $@
52 $(WEBDIR)/index.html: web/staticindex.php
53 php5 web/staticindex.php > $@
55 $(WEBDIR)/example-config.h: config.h
58 $(WEBDIR)/Makefile-ccan: Makefile-ccan
61 $(WEBDIR)/ccan.jpg: web/ccan.jpg
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/$* $* > $@
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)
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)
76 distclean: distclean-web