Skip to content

Commit cc6901d

Browse files
thefourtheyeaddaleax
authored andcommitted
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: #9436 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent 9a0bcfc commit cc6901d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Makefile

+5-6
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,14 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
296296
endif
297297

298298
apidoc_sources = $(wildcard doc/api/*.md)
299-
apidocs = $(addprefix out/,$(apidoc_sources:.md=.html)) \
300-
$(addprefix out/,$(apidoc_sources:.md=.json))
299+
apidocs_html = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.html))
300+
apidocs_json = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.json))
301301

302302
apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets
303303

304304
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
305305

306-
doc-only: $(apidoc_dirs) $(apiassets) $(apidocs) tools/doc/
307-
306+
doc-only: $(apidocs_html) $(apidocs_json)
308307
doc: $(NODE_EXE) doc-only
309308

310309
$(apidoc_dirs):
@@ -340,8 +339,8 @@ out/doc/api/%.html: doc/api/%.md
340339
fi
341340
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
342341

343-
docopen: out/doc/api/all.html
344-
-google-chrome out/doc/api/all.html
342+
docopen: $(apidocs_html)
343+
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
345344

346345
docclean:
347346
-rm -rf out/doc

0 commit comments

Comments
 (0)