Default Makefile for Sphinx

Viewed 3403

I'm trying to understand the Makefile that is automatically produced by sphinx-quickstart. Here it is:

SPHINXOPTS    =
SPHINXBUILD   = sphinx-build
SPHINXPROJ    = myproj
SOURCEDIR     = source
BUILDDIR      = build

.PHONY: help Makefile

%: Makefile
    @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

The lines that confuse me are:

.PHONY: help Makefile
%: Makefile

I think I understand:

  1. The % target means capture anything (wildcard). E.g., if I typed make html, % would capture html.
  2. .PHONY Makefile means that make shouldn't look for a file called Makefile in its directory, thus, shouldn't check the file's modified time to determine whether or not to run a rule.

I don't understand:

Why Makefile is listed as a prerequisite for the target %. The way I interpret this is:

The target rule captured by % should run when the Makefile is changed.

But that doesn't make any sense in the context. What I would expect is:

The target rule captured by % should run when the source files for the project documentation or the API source files have changed.

Directory structure

.
├── build
├── Makefile
├── source
└── utils
1 Answers
Related