kivy/Makefile

145 lines
4.5 KiB
Makefile
Raw Normal View History

PYTHON = python
2020-01-03 22:17:09 +00:00
CHECKSCRIPT = -m flake8 --count --ignore=E125,E126,E127,E128,E402,E741,E731,W503,F401,W504,F841,E722 --show-source --statistics --max-line-length=80 --exclude=__pycache__,.tox,.git/,doc/,build/,.eggs/
KIVY_DIR = kivy/
2019-02-22 00:08:39 +00:00
PYTEST = $(PYTHON) -m pytest
KIVY_USE_DEFAULTCONFIG = 1
HOSTPYTHON = $(KIVYIOSROOT)/tmp/Python-$(PYTHON_VERSION)/hostpython
GIT_COMMAND := $(shell which git)
2011-05-14 18:46:46 +00:00
IOSPATH := $(PATH):/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
2015-01-25 12:09:36 +00:00
BUILD_OPTS = build_ext --inplace
BUILD_OPTS_FORCE = $(BUILD_OPTS) -f
BUILD_OPTS_DEBUG = $(BUILD_OPTS_FORCE) -g --cython-gdb
2015-01-25 12:09:36 +00:00
INSTALL_OPTIONS = install
2015-12-01 10:22:13 +00:00
INSTALL_ROOT =
INSTALL_PREFIX =
INSTALL_LAYOUT =
2015-01-25 12:09:36 +00:00
2015-01-25 15:02:28 +00:00
ifneq ($(INSTALL_ROOT),)
2015-01-25 12:09:36 +00:00
INSTALL_OPTIONS += --root=$(INSTALL_ROOT)
endif
2015-01-25 15:02:28 +00:00
ifneq ($(INSTALL_PREFIX),)
2015-01-25 12:09:36 +00:00
INSTALL_OPTIONS += --prefix=$(INSTALL_PREFIX)
endif
2015-01-25 15:02:28 +00:00
ifneq ($(INSTALL_LAYOUT),)
2015-01-25 12:09:36 +00:00
INSTALL_OPTIONS += --install-layout=$(INSTALL_LAYOUT)
endif
2016-12-17 17:12:14 +00:00
.PHONY: build force mesabuild pdf style hook test batchtest cover clean distclean theming
build:
2015-01-25 12:09:36 +00:00
$(PYTHON) setup.py $(BUILD_OPTS)
force:
2015-01-25 12:09:36 +00:00
$(PYTHON) setup.py $(BUILD_OPTS_FORCE)
debug:
env CFLAGS="-Og" $(PYTHON) setup.py $(BUILD_OPTS_DEBUG)
mesabuild:
2015-01-25 12:09:36 +00:00
env USE_MESAGL=1 $(PYTHON) setup.py $(BUILD_OPTS)
ios:
-ln -s $(KIVYIOSROOT)/Python-2.7.1/python
-ln -s $(KIVYIOSROOT)/Python-2.7.1/python.exe
2011-05-12 09:54:22 +00:00
-rm -rdf iosbuild/
mkdir iosbuild
echo "First build ========================================"
-PATH="$(IOSPATH)" $(HOSTPYTHON) setup.py build_ext -g
echo "cythoning =========================================="
find . -name *.pyx -exec cython {} \;
echo "Second build ======================================="
PATH="$(IOSPATH)" $(HOSTPYTHON) setup.py build_ext -g
PATH="$(IOSPATH)" $(HOSTPYTHON) setup.py install -O2 --root iosbuild
2011-05-12 09:54:22 +00:00
# Strip away the large stuff
2013-01-04 16:41:13 +00:00
find iosbuild/ | grep -E '.*\.(py|pyc|so\.o|so\.a|so\.libs)$$' | xargs rm
-rm -rdf "$(BUILDROOT)/python/lib/python2.7/site-packages/kivy"
2011-05-12 09:54:22 +00:00
# Copy to python for iOS installation
cp -R "iosbuild/usr/local/lib/python2.7/site-packages/kivy" "$(BUILDROOT)/python/lib/python2.7/site-packages"
pdf: build
-cd doc && $(MAKE) pdf
2015-12-01 10:22:13 +00:00
cd doc && $(MAKE) pdf
html: build
cd doc && $(MAKE) html
html-embedded:
env USE_EMBEDSIGNATURE=1 $(MAKE) force
$(MAKE) -C doc html
style:
$(PYTHON) $(CHECKSCRIPT) .
2011-01-13 14:25:07 +00:00
hook:
# Install pre-commit git hook to check your changes for styleguide
# consistency.
2011-01-13 14:25:07 +00:00
cp kivy/tools/pep8checker/pre-commit.githook .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
image-testsuite:
mkdir -p "${KIVY_DIR}tests/image-testsuite"
-${KIVY_DIR}tools/image-testsuite/imagemagick-testsuite.sh "${KIVY_DIR}tests/image-testsuite"
2017-07-26 10:24:54 +00:00
test:
-rm -rf kivy/tests/build
env KIVY_NO_ARGS=1 $(PYTEST) kivy/tests
cover:
coverage html --include='$(KIVY_DIR)*' --omit '$(KIVY_DIR)data/*,$(KIVY_DIR)lib/*,$(KIVY_DIR)tools/*,$(KIVY_DIR)tests/*'
2012-01-02 19:10:03 +00:00
install:
2015-01-25 15:28:55 +00:00
$(PYTHON) setup.py $(INSTALL_OPTIONS)
2015-01-25 12:09:36 +00:00
clean:
$(MAKE) -C doc clean
-rm -rf build
-rm -rf htmlcov
-rm -f .coverage
-rm -f .noseids
-rm -rf kivy/tests/build
-find kivy -iname '*.so' -exec rm {} \;
-find kivy -iname '*.pyd' -exec rm {} \;
-find kivy -iname '*.pyc' -exec rm {} \;
-find kivy -iname '*.pyo' -exec rm {} \;
2019-05-15 19:39:35 +00:00
-find kivy -iname '*.pyx' -exec sh -c 'echo `dirname {}`/`basename {} .pyx`.c' \; | xargs ls -d 2>/dev/null | xargs -r rm
distclean: clean
ifneq ($(GIT_COMMAND),)
2019-05-15 19:39:35 +00:00
ifneq ($(git rev-parse --git-dir 2> /dev/null),)
@echo "Using GIT at $(GIT_COMMAND) to make a distclean..."
-git clean -dxf -e debian
else
@echo "Not in a git directory to make a distclean..."
endif
else
@echo "GIT not found to make a distclean..."
endif
2012-06-23 17:26:55 +00:00
theming:
$(PYTHON) -m kivy.atlas kivy/data/images/defaulttheme 512 kivy/tools/theming/defaulttheme/*.png
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " build for a standard build"
@echo " clean remove generated and compiled files"
@echo " cover create an html coverage report of unittests"
@echo " debug for a debug build (with -g)"
@echo " dist-clean clean then use 'git clean'"
@echo " force for a forced build (with -f)"
@echo " hook add Pep-8 checking as a git precommit hook"
@echo " html to make standalone HTML files"
@echo " install run a setup.py install"
@echo " mesabuild for a build with MesaGL"
@echo " style to check Python code for style issues"
@echo " test run unittests (nosetests)"
@echo " theming create a default theme atlas"
@echo " "
@echo "You can also 'cd doc && make help' to build more documentation types"