1# This is the PyAudio distribution makefile.
2
3.PHONY: docs clean build
4
5VERSION := 0.2.11
6PYTHON ?= python
7BUILD_ARGS ?=
8SPHINX ?= sphinx-build
9DOCS_OUTPUT=docs/
10PYTHON_BUILD_DIR:=$(shell $(PYTHON) -c "import distutils.util; import sys; print(distutils.util.get_platform() + '-' + sys.version[0:3])")
11BUILD_DIR:=lib.$(PYTHON_BUILD_DIR)
12BUILD_STAMP:=$(BUILD_DIR)/build
13SRCFILES := src/*.c src/*.h src/*.py
14EXAMPLES := examples/*.py
15TESTS := tests/*.py
16
17what:
18	@echo "make targets:"
19	@echo
20	@echo " tarball    : build source tarball"
21	@echo " docs       : generate documentation (requires sphinx)"
22	@echo " clean      : remove build files"
23	@echo
24	@echo "To build pyaudio, run:"
25	@echo
26	@echo "   python setup.py install"
27
28clean:
29	@rm -rf build dist MANIFEST $(DOCS_OUTPUT) src/*.pyc
30
31######################################################################
32# Documentation
33######################################################################
34
35build: build/$(BUILD_STAMP)
36
37build/$(BUILD_STAMP): $(SRCFILES)
38	$(PYTHON) setup.py build $(BUILD_ARGS)
39
40docs: build
41	PYTHONPATH=build/$(BUILD_DIR) $(SPHINX) -b html sphinx/ $(DOCS_OUTPUT)
42
43######################################################################
44# Source Tarball
45######################################################################
46tarball: $(SRCFILES) $(EXAMPLES) $(TESTS) MANIFEST.in
47	@$(PYTHON) setup.py sdist
48