Browse Source

tools: improve docopen target in Makefile

1. As it is, it just tries to build only the `all.html` file. If none of
   the other files are built already, generated page will not be good.
   To fix this, we process the assets and generate HTML files first.

2. After the HTML is generated, `google-chrome` is used to open the
   generated file in browser. This is not very portable as it might not
   be installed or installations might have used a different name. So,
   we use Python's webbrowser module to open the file.

PR-URL: https://github.com/nodejs/node/pull/9436

Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
v6
Sakthipriyan Vairamani (thefourtheye) 8 years ago
parent
commit
c5678d3c32
  1. 11
      Makefile

11
Makefile

@ -296,15 +296,14 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
endif endif
apidoc_sources = $(wildcard doc/api/*.md) apidoc_sources = $(wildcard doc/api/*.md)
apidocs = $(addprefix out/,$(apidoc_sources:.md=.html)) \ apidocs_html = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.html))
$(addprefix out/,$(apidoc_sources:.md=.json)) apidocs_json = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.json))
apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*))) apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
doc-only: $(apidoc_dirs) $(apiassets) $(apidocs) tools/doc/ doc-only: $(apidocs_html) $(apidocs_json)
doc: $(NODE_EXE) doc-only doc: $(NODE_EXE) doc-only
$(apidoc_dirs): $(apidoc_dirs):
@ -340,8 +339,8 @@ out/doc/api/%.html: doc/api/%.md
fi fi
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html) [ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
docopen: out/doc/api/all.html docopen: $(apidocs_html)
-google-chrome out/doc/api/all.html @$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
docclean: docclean:
-rm -rf out/doc -rm -rf out/doc

Loading…
Cancel
Save