Skip to content

Commit efca4cc

Browse files
committed
Makefile for php-src docs build
In 19d2b84 ("Create book for docs", 2024-01-30) the php-src documentation (php-src docs) build has been introduced, yet the build instructions, namely `make html`, did not yield the expected results within the parenting setup of the php-src project on *nix systems. The reason is that the `make html` build instruction does not execute the make.bat file which contains the recipe to build the static HTML pages. It is an unused leftover file from initializing the project with sphinx-quickstart. [1] Removing it in and adding a Makefile suffices to recover the build of php-src ./docs on a *nix system. Formatting constraints checked in the docs workflow in CI update use the make file to make sure the commands stay consistent and the build is managed by the build manager. [1]: https://www.sphinx-doc.org/en/master/man/sphinx-quickstart.html "sphinx-quickstart is an interactive tool that asks some questions about your project and then generates a complete documentation directory and sample Makefile to be used with sphinx-build(1)."
1 parent 863ddc8 commit efca4cc

File tree

3 files changed

+37
-36
lines changed

3 files changed

+37
-36
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: pip install sphinx-design sphinxawesome-theme rstfmt
2323
- name: Check formatting
24-
run: rstfmt --check -w 100 docs/source
24+
run: make -C docs check-formatting
2525
- name: Publish
2626
if: github.event_name == 'push'
2727
uses: sphinx-notes/pages@v3

docs/Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Makefile for php-src/docs
2+
# Copyright (c) The PHP Group
3+
4+
# If people set these on the make command line, use 'em
5+
6+
SPHINXBUILD ?= sphinx-build
7+
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
RSTFMT = rstfmt
11+
RSTFMTFLAGS = -w 100
12+
13+
rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
14+
FILES = $(call rwildcard,$(SOURCEDIR),*.rst)
15+
16+
all : html
17+
18+
.PHONY : check-formatting clean html preflight
19+
.SUFFIXES : # Disable legacy behavior
20+
21+
check-formatting :
22+
$(RSTFMT) $(RSTFMTFLAGS) --check $(SOURCEDIR)
23+
24+
clean :
25+
rm -rf -- $(wildcard $(SOURCEDIR)/.~ $(BUILDDIR))
26+
27+
html : preflight
28+
$(SPHINXBUILD) -M $@ $(SOURCEDIR) $(BUILDDIR)
29+
@printf 'Browse the \e]8;;%s\e\\%s\e]8;;\e\\.\n' \
30+
"file://$(abspath $(BUILDDIR))/$@/index.$@" "php-src html docs locally"
31+
32+
preflight : $(SOURCEDIR)/.~
33+
34+
$(SOURCEDIR)/.~ : $(FILES)
35+
$(RSTFMT) $(RSTFMTFLAGS) $?
36+
touch $@

docs/make.bat

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)