Skip to content

Commit 232026d

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 d283704 commit 232026d

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
@@ -293,15 +293,14 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
293293
endif
294294

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

299299
apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets
300300

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

303-
doc-only: $(apidoc_dirs) $(apiassets) $(apidocs) tools/doc/
304-
303+
doc-only: $(apidocs_html) $(apidocs_json)
305304
doc: $(NODE_EXE) doc-only
306305

307306
$(apidoc_dirs):
@@ -337,8 +336,8 @@ out/doc/api/%.html: doc/api/%.md
337336
fi
338337
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
339338

340-
docopen: out/doc/api/all.html
341-
-google-chrome out/doc/api/all.html
339+
docopen: $(apidocs_html)
340+
@$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html
342341

343342
docclean:
344343
-rm -rf out/doc

0 commit comments

Comments
 (0)