Makefile-web 3.8 KB

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