Skip to content

Commit 9b36469

Browse files
thefourtheyeMylesBorins
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 198463a commit 9b36469

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,14 @@ test-v8-all: test-v8 test-v8-intl test-v8-benchmarks
261261
# runs all v8 tests
262262

263263
apidoc_sources = $(wildcard doc/api/*.md)
264-
apidocs = $(addprefix out/,$(apidoc_sources:.md=.html)) \
265-
$(addprefix out/,$(apidoc_sources:.md=.json))
264+
apidocs_html = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.html))
265+
apidocs_json = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.json))
266266

267267
apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets
268268

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

271-
doc-only: $(apidoc_dirs) $(apiassets) $(apidocs) tools/doc/
272-
271+
doc-only: $(apidocs_html) $(apidocs_json)
273272
doc: $(NODE_EXE) doc-only
274273

275274
$(apidoc_dirs):
@@ -305,8 +304,8 @@ out/doc/api/%.html: doc/api/%.md
305304
fi
306305
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
307306

308-
docopen: out/doc/api/all.html
309-
-google-chrome out/doc/api/all.html
307+
docopen: $(apidocs_html)
308+
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
310309

311310
docclean:
312311
-rm -rf out/doc

0 commit comments

Comments
 (0)