xref: /php-src/docs/Makefile (revision 1668a160)
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
6SPHINXBUILD ?= sphinx-build
7
8SOURCEDIR = source
9BUILDDIR = build
10RSTFMT = rstfmt
11RSTFMTFLAGS = -w 100
12
13rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
14FILES = $(call rwildcard,$(SOURCEDIR),*.rst)
15
16all : html
17
18.PHONY : check-formatting clean html preflight
19.SUFFIXES : # Disable legacy behavior
20
21check-formatting :
22	$(RSTFMT) $(RSTFMTFLAGS) --check $(SOURCEDIR)
23
24clean :
25	rm -rf -- $(wildcard $(SOURCEDIR)/.~ $(BUILDDIR))
26
27html : 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
32preflight : $(SOURCEDIR)/.~
33
34$(SOURCEDIR)/.~ : $(FILES)
35	$(RSTFMT) $(RSTFMTFLAGS) $?
36	touch $@
37