fear-of-macros/makefile
2017-01-07 04:58:47 +01:00

79 lines
1.8 KiB
Makefile

SCRBL=index.rkt
PDF_SCRBL=pdf-index.rkt
HTML_SINGLE=all.html
# Since we don't know the names of the files, and they are all generated in one go,
# we just point to the main index.html file (which is not generated by other targets)
HTML_MULTI=index.html
PDF_SINGLE=all.pdf
all: publish
clean:
rm -rf html $(PDF_SCRBL)
html: html-single html-multi
racket add-to-head.rkt
.PHONY: html-single
html-single: html/$(HTML_SINGLE)
html/$(HTML_SINGLE): $(SCRBL)
raco scribble \
--html \
--dest html \
--dest-name $(HTML_SINGLE) \
++style gh.css \
++main-xref-in \
--redirect-main http://docs.racket-lang.org/ \
\
$(SCRBL)
.PHONY: pdf
pdf: html/$(PDF_SINGLE)
$(PDF_SCRBL): index.rkt
# LaTeX chokes on this, let's just remove it for now.
sed -e 's/トランスフォーマ/@;{トランスフォーマ}/' index.rkt > $(PDF_SCRBL)
html/$(PDF_SINGLE): $(PDF_SCRBL)
raco scribble \
--pdf \
--dest html \
--dest-name $(PDF_SINGLE) \
++style gh.tex \
++main-xref-in \
--redirect-main http://docs.racket-lang.org/ \
\
$(PDF_SCRBL)
.PHONY: html-multi
html-multi: html/$(HTML_MULTI)
html/$(HTML_MULTI): $(SCRBL)
raco scribble \
--htmls \
--dest-name html \
++style gh.css \
++main-xref-in \
--redirect-main http://docs.racket-lang.org/ \
\
$(SCRBL)
pages:
@(git branch -v | grep -q gh-pages || (echo local gh-pages branch missing; false))
@echo
@git branch -av | grep gh-pages
@echo
@(echo 'Is the branch up to date? Press enter to continue.'; read dummy)
git clone -b gh-pages . pages
.PHONY: publish
publish: html/$(HTML_SINGLE) html/$(PDF_SINGLE) html/$(HTML_MULTI) pages
rm -rf pages/*
cp -r html/. pages/.
(cd pages; git add -A)
-(cd pages; git commit -m "Update $$(date +%Y%m%d%H%M%S)")
(cd pages; git push origin gh-pages)
rm -rf pages
git push origin gh-pages