|
75 | 75 | # The targets `objects' and `library' are defined at the end of this |
76 | 76 | # Makefile after all other rules have been included. |
77 | 77 | # |
78 | | -.PHONY: single multi objects library refdoc |
| 78 | +.PHONY: single multi objects library refdoc refdoc-venv |
79 | 79 |
|
80 | 80 | # default target -- build single objects and library |
81 | 81 | # |
@@ -289,18 +289,52 @@ objects: $(OBJECTS_LIST) |
289 | 289 |
|
290 | 290 | library: $(PROJECT_LIBRARY) |
291 | 291 |
|
292 | | - |
| 292 | +# Run `docwriter' in the current Python environment. |
293 | 293 | # Option `-B' disables generation of .pyc files (available since python 2.6) |
294 | 294 | # |
295 | | -refdoc: |
296 | | - python -B $(SRC_DIR)/tools/docmaker/docmaker.py \ |
297 | | - --prefix=ft2 \ |
298 | | - --title=FreeType-$(version) \ |
299 | | - --output=$(DOC_DIR) \ |
300 | | - $(PUBLIC_DIR)/*.h \ |
301 | | - $(PUBLIC_DIR)/config/*.h \ |
302 | | - $(PUBLIC_DIR)/cache/*.h |
303 | 295 |
|
| 296 | +PYTHON ?= python |
| 297 | +PIP ?= pip |
| 298 | + |
| 299 | +refdoc: |
| 300 | + @echo Running docwriter... |
| 301 | + $(PYTHON) -m docwriter \ |
| 302 | + --prefix=ft2 \ |
| 303 | + --title=FreeType-$(version) \ |
| 304 | + --output=$(DOC_DIR) \ |
| 305 | + $(PUBLIC_DIR)/*.h \ |
| 306 | + $(PUBLIC_DIR)/config/*.h \ |
| 307 | + $(PUBLIC_DIR)/cache/*.h |
| 308 | + @echo Building static site... |
| 309 | + cd $(DOC_DIR) && mkdocs build |
| 310 | + @echo Done. |
| 311 | + |
| 312 | +# Variables for running refdoc with Python's `virtualenv'. The env is |
| 313 | +# created in `DOC_DIR/env' and is gitignored. |
| 314 | +# We still need to cd into `DOC_DIR' to build mkdocs because paths in |
| 315 | +# mkdocs.yml are relative to cwd. |
| 316 | +# |
| 317 | +VENV_NAME := env |
| 318 | +VENV_DIR := $(DOC_DIR)$(SEP)$(VENV_NAME) |
| 319 | +ENV_PYTHON := $(VENV_DIR)$(SEP)$(BIN)$(SEP)$(PYTHON) |
| 320 | +ENV_PIP := $(VENV_DIR)$(SEP)$(BIN)$(SEP)$(PIP) |
| 321 | + |
| 322 | +refdoc-venv: |
| 323 | + @echo Setting up virtualenv for Python... |
| 324 | + virtualenv $(VENV_DIR) |
| 325 | + @echo Installing docwriter... |
| 326 | + $(ENV_PIP) install docwriter |
| 327 | + @echo Running docwriter... |
| 328 | + $(ENV_PYTHON) -m docwriter \ |
| 329 | + --prefix=ft2 \ |
| 330 | + --title=FreeType-$(version) \ |
| 331 | + --output=$(DOC_DIR) \ |
| 332 | + $(PUBLIC_DIR)/*.h \ |
| 333 | + $(PUBLIC_DIR)/config/*.h \ |
| 334 | + $(PUBLIC_DIR)/cache/*.h |
| 335 | + @echo Building static site... |
| 336 | + cd $(DOC_DIR) && $(VENV_NAME)$(SEP)$(BIN)$(SEP)python -m mkdocs build |
| 337 | + @echo Done. |
304 | 338 |
|
305 | 339 | .PHONY: clean_project_std distclean_project_std |
306 | 340 |
|
|
0 commit comments