py-sdl2 / Makefile

PYTHON ?= python
top_srcdir := `pwd`
PYTHONPATH ?= $(top_srcdir)
SUBDIRS = \
	$(top_srcdir)/sdl2 \
	$(top_srcdir)/sdl2/ext \
	$(top_srcdir)/sdl2/test \
	$(top_srcdir)/sdl2/test/resources \
	$(top_srcdir)/sdl2/test/util \
	$(top_srcdir)/doc \
	$(top_srcdir)/doc/tutorial \
	$(top_srcdir)/doc/modules \
	$(top_srcdir)/examples

INTERPRETERS = python2.7 python3.2 python3.3 pypy

all: clean build

dist: clean docs
	@echo "Creating dist..."
	@$(PYTHON) setup.py sdist --format gztar
	@$(PYTHON) setup.py sdist --format zip

bdist: clean docs
	@echo "Creating bdist..."
	@$(PYTHON) setup.py bdist

build:
	@echo "Running build"
	@$(PYTHON) setup.py build
	@echo "Build finished, invoke 'make install' to install."


install:
	@echo "Installing..."
	@$(PYTHON) setup.py install

clean:
	@echo "Cleaning up in $(top_srcdir)/ ..."
	@rm -f *.cache *.core *~ MANIFEST *.pyc *.orig *.rej
	@rm -rf __pycache__
	@rm -rf build dist doc/html

	@for dir in $(SUBDIRS); do \
		echo "Cleaning up in $$dir ..."; \
		if test -f $$dir/Makefile; then \
			make -C $$dir clean; \
		fi; \
		cd $$dir && rm -f *.cache *.core *~ MANIFEST *.pyc *.orig *.rej; \
	done

docs:
	@echo "Creating docs package"
	@rm -rf doc/html
	@cd doc && PYTHONPATH=$(PYTHONPATH) make html
	@mv doc/_build/html doc/html
	@rm -rf doc/_build
	@cd doc && make clean

release: dist

runtest:
	@PYTHONPATH=$(PYTHONPATH) $(PYTHON) -B -m sdl2.test.util.runtests

testall:
	@for interp in $(INTERPRETERS); do \
		PYTHONPATH=$(PYTHONPATH) $$interp -B -m sdl2.test.util.runtests || true; \
	done

# Do not run these in production environments! They are for testing
# purposes only!

buildall: clean
	@for interp in $(INTERPRETERS); do \
		$$interp setup.py build; \
	done

installall:
	@for interp in $(INTERPRETERS); do \
		$$interp setup.py install; \
	done

testpackage:
	@for interp in $(INTERPRETERS); do \
		$$interp -c "import sdl2.test; sdl2.test.run()" || true \
	done

purge_installs:
	@for interp in $(INTERPRETERS); do \
		rm -rf /usr/local/lib/$$interp/site-packages/sdl2*; \
	done
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.