makefile (1825B)
1 SCRBL=index.rkt 2 PDF_SCRBL=pdf-index.rkt 3 HTML_SINGLE=all.html 4 # Since we don't know the names of the files, and they are all generated in one go, 5 # we just point to the main index.html file (which is not generated by other targets) 6 HTML_MULTI=index.html 7 PDF_SINGLE=all.pdf 8 9 all: publish 10 11 clean: 12 rm -rf html $(PDF_SCRBL) 13 14 html: html-single html-multi 15 racket add-to-head.rkt 16 17 .PHONY: html-single 18 html-single: html/$(HTML_SINGLE) 19 20 html/$(HTML_SINGLE): $(SCRBL) 21 raco scribble \ 22 --html \ 23 --dest html \ 24 --dest-name $(HTML_SINGLE) \ 25 ++style gh.css \ 26 ++main-xref-in \ 27 --redirect-main http://docs.racket-lang.org/ \ 28 \ 29 $(SCRBL) 30 31 .PHONY: pdf 32 pdf: html/$(PDF_SINGLE) 33 34 $(PDF_SCRBL): index.rkt 35 # LaTeX chokes on this, let's just remove it for now. 36 sed -e 's/トランスフォーマ/@;{トランスフォーマ}/' index.rkt > $(PDF_SCRBL) 37 38 html/$(PDF_SINGLE): $(PDF_SCRBL) 39 raco scribble \ 40 --pdf \ 41 --dest html \ 42 --dest-name $(PDF_SINGLE) \ 43 ++style gh.tex \ 44 ++main-xref-in \ 45 --redirect-main http://docs.racket-lang.org/ \ 46 \ 47 $(PDF_SCRBL) 48 49 .PHONY: html-multi 50 html-multi: html/$(HTML_MULTI) 51 52 html/$(HTML_MULTI): $(SCRBL) 53 raco scribble \ 54 --htmls \ 55 --dest-name html \ 56 ++style gh.css \ 57 ++main-xref-in \ 58 --redirect-main http://docs.racket-lang.org/ \ 59 \ 60 $(SCRBL) 61 62 pages: 63 @(git branch -v | grep -q gh-pages || (echo local gh-pages branch missing; false)) 64 @echo 65 @git branch -av | grep gh-pages 66 @echo 67 @(echo 'Is the branch up to date? Press enter to continue.'; read dummy) 68 git clone -b gh-pages . pages 69 70 .PHONY: publish 71 publish: html/$(HTML_SINGLE) html/$(PDF_SINGLE) html/$(HTML_MULTI) pages 72 rm -rf pages/* 73 cp -r html/. pages/. 74 (cd pages; git add -A) 75 -(cd pages; git commit -m "Update $$(date +%Y%m%d%H%M%S)") 76 (cd pages; git push origin gh-pages) 77 rm -rf pages 78 git push origin gh-pages