[doc] add `doc-publish` target for publishing man pages and odoc

Summary:
See the results online!

http://fbinfer.com/docs/man-pages.html
http://fbinfer.com/docs/internal-API.html

These html pages are written by hand, but their target is auto-generated.

I cheated a bit by generating the docs for the current version of infer and not
0.15.0 but they are hopefully very similar.

Depends on D8314572

Reviewed By: jeremydubreil

Differential Revision: D8318132

fbshipit-source-id: ffca43c
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent 710dae8ee4
commit cf131081e3

@ -706,17 +706,49 @@ devsetup: Makefile.autoconf
echo '$(TERM_INFO) eval $$(opam config env)$(TERM_RESET)' >&2; \
fi
GHPAGES ?= no
.PHONY: doc
doc: src_build_common
$(QUIET)$(call silent_on_success,Generating infer documentation,\
$(MAKE_SOURCE) doc)
# do not call the browser if we are publishing the docs
ifeq ($(filter doc-publish,${MAKECMDGOALS}),)
$(QUIET)$(call silent_on_success,Opening in browser,\
browse $(SRC_DIR)/_build/$(BUILD_MODE)/_doc/_html/index.html)
$(QUIET)echo "Tip: you can generate the doc for all the opam dependencies of infer like this:"
$(QUIET)echo
$(QUIET)echo " odig odoc # takes a while, run it only when the dependencies change"
$(QUIET)echo " odig doc"
endif
.PHONY: doc-publish
doc-publish: doc $(INFER_MANUALS)
ifeq ($(GHPAGES),no)
$(QUIET)echo "$(TERM_ERROR)Please set GHPAGES to a checkout of the gh-pages branch of the GitHub repo of infer$(TERM_RESET)" >&2
$(QUIET)exit 1
endif
# sanity check to avoid cryptic error messages and potentially annoying side-effects
$(QUIET)if ! [ -d "$(GHPAGES)"/static/man ]; then \
echo "$(TERM_ERROR)ERROR: GHPAGES doesn't seem to point to a checkout of the gh-pages branch of the GitHub repo of infer:$(TERM_RESET)" >&2; \
echo "$(TERM_ERROR)ERROR: '$(GHPAGES)/static/man' not found or not a directory.$(TERM_RESET)" >&2; \
echo "$(TERM_ERROR)ERROR: Please fix this and try again.$(TERM_RESET)" >&2; \
exit 1; \
fi
$(QUIET)$(call silent_on_success,Copying man pages,\
$(REMOVE_DIR) "$(GHPAGES)"/static/man/*; \
for man in $(INFER_MANUALS); do \
groff -Thtml "$$man" > "$(GHPAGES)"/static/man/$$(basename "$$man").html; \
done)
ifeq ($(IS_FACEBOOK_TREE),no)
$(QUIET)$(call silent_on_success,Copying OCaml modules documentation,\
version=$$($(INFER_BIN) --version | head -1 | cut -d ' ' -f 3 | cut -c 2-); \
rsync -a --delete $(SRC_DIR)/_build/$(BUILD_MODE)/_doc/_html/ "$(GHPAGES)"/static/odoc/"$$version"; \
$(REMOVE) "$(GHPAGES)"/static/odoc/latest; \
$(LN_S) "$$version" "$(GHPAGES)"/static/odoc/latest)
else
$(QUIET)echo "Not an open-source tree, skipping the API docs generation"
endif
# print list of targets
.PHONY: show-targets

Loading…
Cancel
Save