Makefile (3749B)
1 -include ../config.mk 2 include ../default.mk 3 4 docs: info html html-dir pdf 5 6 info: $(PKG).info dir 7 html: $(PKG).html 8 pdf: $(PKG).pdf 9 10 ORG_ARGS = --batch -Q $(ORG_LOAD_PATH) 11 ORG_EVAL += --eval "(setq indent-tabs-mode nil)" 12 ORG_EVAL += --eval "(setq org-src-preserve-indentation nil)" 13 ORG_EVAL += --funcall org-texinfo-export-to-texinfo 14 15 .PHONY: texi 16 texi: 17 @printf "Generating $(PKG).texi\n" 18 @$(EMACS) $(ORG_ARGS) $(PKG).org $(ORG_EVAL) 19 @printf "\n" >> $(PKG).texi 20 @rm -f $(PKG).texi~ 21 22 %.info: %.texi 23 @printf "Generating $@\n" 24 @$(MAKEINFO) --no-split $< -o $@ 25 26 dir: $(PKG).info 27 @printf "Generating $@\n" 28 @printf "%s" $^ | xargs -n 1 $(INSTALL_INFO) --dir=$@ 29 30 HTML_FIXUP_CSS = '/<link rel="stylesheet" type="text\/css" href="\/assets\/page.css">/a\ 31 <link rel="icon" href="/assets/magit_alt1.ico">\ 32 \n<link class="s-css-s--style" rel="stylesheet" title="Default" href="/assets/themes/default.css">\ 33 \n<link class="s-css-s--style" rel="stylesheet alternate" title="Default high contrast" href="/assets/themes/default-high-contrast.css">\ 34 \n<link class="s-css-s--style" rel="stylesheet alternate" title="Solarized dark xterm" href="/assets/themes/solarized-dark-xterm.css">\ 35 \n<link class="s-css-s--style" rel="stylesheet alternate" title="Black on white" href="/assets/themes/black-on-white.css">\ 36 \n<script src="/assets/js/simple-css-switch.js"></script>' 37 HTML_FIXUP_ONLOAD = 's/<body lang="en">/<body lang="en" onload="simpleCssSwitch()">/' 38 HTML_FIXUP_MENU = '/<\/body>/i<div id="s-css-s--menu"><\/div>' 39 40 %.html: %.texi 41 @printf "Generating $@\n" 42 @$(MAKEINFO) --html --no-split $(MANUAL_HTML_ARGS) $< 43 @sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $@ 44 45 html-dir: $(PKG).texi 46 @printf "Generating $(PKG)/*.html\n" 47 @$(MAKEINFO) --html -o $(PKG)/ $(MANUAL_HTML_ARGS) $< 48 @for f in $$(find $(PKG) -name '*.html') ; do \ 49 sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $$f ; \ 50 done 51 52 %.pdf: %.texi 53 @printf "Generating $@\n" 54 @texi2pdf --clean $< > /dev/null 55 56 PUBLISH_PATH ?= /manual/ 57 RELEASE_PATH ?= /manual/$(VERSION)/ 58 S3_BUCKET ?= s3://$(DOMAIN) 59 PUBLISH_TARGET = $(S3_BUCKET)$(PUBLISH_PATH) 60 RELEASE_TARGET = $(S3_BUCKET)$(RELEASE_PATH) 61 CFRONT_PATHS = $(PKG).html $(PKG).pdf $(PKG)/* 62 63 comma := , 64 empty := 65 space := $(empty) $(empty) 66 67 publish: html html-dir pdf 68 @aws s3 cp $(PKG).html $(PUBLISH_TARGET) 69 @aws s3 cp $(PKG).pdf $(PUBLISH_TARGET) 70 @aws s3 sync $(PKG) $(PUBLISH_TARGET)$(PKG)/ 71 @printf "Generating CDN invalidation\n" 72 @aws cloudfront create-invalidation --distribution-id $(CFRONT_DIST) --paths \ 73 "$(subst $(space),$(comma),$(addprefix $(PUBLISH_PATH),$(CFRONT_PATHS)))" > /dev/null 74 75 release: html html-dir pdf 76 @aws s3 cp $(PKG).html $(RELEASE_TARGET) 77 @aws s3 cp $(PKG).pdf $(RELEASE_TARGET) 78 @aws s3 sync $(PKG) $(RELEASE_TARGET)$(PKG)/ 79 @aws s3 cp $(PUBLISH_TARGET)dir.html $(RELEASE_TARGET)dir.html 80 @aws s3 cp $(PUBLISH_TARGET)dir/index.html $(RELEASE_TARGET)dir/index.html 81 @printf "Generating CDN invalidation\n" 82 @aws cloudfront create-invalidation --distribution-id $(CFRONT_DIST) --paths \ 83 "$(subst $(space),$(comma),$(addprefix $(RELEASE_PATH),$(CFRONT_PATHS)))" > /dev/null 84 85 .PHONY: stats 86 stats: 87 @printf "Generating statistics\n" 88 @$(GITSTATS) $(GITSTATS_ARGS) $(TOP) $(GITSTATS_DIR) 89 90 stats-upload: 91 @printf "Uploading statistics...\n" 92 @aws s3 sync $(GITSTATS_DIR) $(S3_BUCKET)/stats/$(PKG) 93 @printf "Uploaded to $(S3_BUCKET)/stats/$(PKG)\n" 94 @printf "Generating CDN invalidation\n" 95 @aws cloudfront create-invalidation \ 96 --distribution-id $(CFRONT_DIST) --paths "/stats/*" > /dev/null 97 98 CLEAN = $(PKG).info dir $(PKG) $(PKG).html $(PKG).pdf 99 100 clean: 101 @printf " Cleaning docs/*...\n" 102 @rm -rf $(CLEAN)