Skip to content

Simplify doc/Makefile with sphinx-build make-mode - #3761

Merged
seisman merged 2 commits into
mainfrom
maintenance/sphinx-make
Jan 11, 2025
Merged

seisman merged 2 commits into
mainfrom
maintenance/sphinx-make

Conversation

@seisman

@seisman seisman commented Jan 9, 2025 •

Copy link
Copy Markdown
Member

sphinx-build started to provide the so-called make-mode since v1.2.0, which has been the default mode since v1.5.0.

Here is a simple comparison for the make-mode and the "normal" mode:

Old normal mode:

$(SPHINXBUILD) -b html $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html

make mode:

$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)

These two modes are very similar, but in make-mode, we use $(BUILDDIR) not $(BUILDDIR)/html.

A good advantage is that we can use the same command for different Sphinx builders.

This PR updates doc/Makefile with the make-mode and also adds the latex target to generate LaTeX source files.

Address #1606.

@seisman seisman added the maintenance Boring but important stuff for the core devs label Jan 9, 2025
Comment thread doc/Makefile
@echo
# Set PYGMT_USE_EXTERNAL_DISPLAY to "false" to disable external display
PYGMT_USE_EXTERNAL_DISPLAY="false" $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
PYGMT_USE_EXTERNAL_DISPLAY="false" $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$@ is the target, i.e., html when running make html.

@seisman
seisman force-pushed the maintenance/sphinx-make branch from 5b132d1 to 410b8e7 Compare January 9, 2025 14:15
Comment thread doc/Makefile
$(SPHINXAUTOGEN) -i -t _templates -o api/generated api/*.rst

html: api
html latex: api

@seisman seisman Jan 9, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latex is added here to support PDF documentation (xref #1606).

@seisman seisman added this to the 0.15.0 milestone Jan 10, 2025
@seisman seisman added skip-changelog Skip adding Pull Request to changelog needs review This PR has higher priority and needs review. labels Jan 10, 2025
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Jan 10, 2025
@seisman
seisman merged commit 2bd524e into main Jan 11, 2025
@seisman
seisman deleted the maintenance/sphinx-make branch January 11, 2025 05:58
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants