From c0fdaeb534fb7ff55110630250dfeeef476e5564 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 2 Oct 2015 12:57:09 +0200 Subject: update makefile for python 3.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 70adaff..66c1156 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ PKGNAME ?= solar-python # The major version number of the current Python installation PY_MAJOR = 3 # The minor version number of the current Python installation -PY_MINOR = 4 +PY_MINOR = 5 # The version number of the current Python installation without a dot PY_VER = $(PY_MAJOR)$(PY_MINOR) # The version number of the current Python installation with a dot @@ -36,6 +36,13 @@ PY_VERSION = $(PY_MAJOR).$(PY_MINOR) # The modules this library is comprised of SRC = solar_python +# Filename extension for -OO optimised python files +ifeq ($(shell test $(PY_VER) -ge 35 ; echo $$?),0) +PY_OPT2_EXT = opt-2.pyc +else +PY_OPT2_EXT = pyo +endif + .PHONY: all @@ -45,13 +52,13 @@ all: compiled optimised compiled: $(foreach M,$(SRC),src/__pycache__/$(M).cpython-$(PY_VER).pyc) .PHONY: optimised -optimised: $(foreach M,$(SRC),src/__pycache__/$(M).cpython-$(PY_VER).pyo) +optimised: $(foreach M,$(SRC),src/__pycache__/$(M).cpython-$(PY_VER).$(PY_OPT2_EXT)) src/__pycache__/%.cpython-$(PY_VER).pyc: src/%.py python -m compileall $< -src/__pycache__/solar_python.cpython-$(PY_VER).pyo: src/solar_python.py +src/__pycache__/solar_python.cpython-$(PY_VER).$(PY_OPT2_EXT): src/solar_python.py python -OO -m compileall $< @@ -80,7 +87,7 @@ install-compiled: $(foreach M,$(SRC),src/__pycache__/$(M).cpython-$(PY_VER).pyc) install -m644 $^ -- "$(DESTDIR)$(LIBDIR)/python$(PY_VERSION)/__pycache__" .PHONY: install-optimised -install-optimised: $(foreach M,$(SRC),src/__pycache__/$(M).cpython-$(PY_VER).pyo) +install-optimised: $(foreach M,$(SRC),src/__pycache__/$(M).cpython-$(PY_VER).$(PY_OPT2_EXT)) install -dm755 -- "$(DESTDIR)$(LIBDIR)/python$(PY_VERSION)/__pycache__" install -m644 $^ -- "$(DESTDIR)$(LIBDIR)/python$(PY_VERSION)/__pycache__" @@ -105,7 +112,7 @@ uninstall: -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - -rm -- $(foreach M,$(SRC),"$(DESTDIR)$(LIBDIR)/python$(PY_VERSION)/__pycache__/$(M).cpython-$(PY_VER).pyo") + -rm -- $(foreach M,$(SRC),"$(DESTDIR)$(LIBDIR)/python$(PY_VERSION)/__pycache__/$(M).cpython-$(PY_VER).$(PY_OPT2_EXT)") -rm -- $(foreach M,$(SRC),"$(DESTDIR)$(LIBDIR)/python$(PY_VERSION)/__pycache__/$(M).cpython-$(PY_VER).pyc") -rm -- $(foreach M,$(SRC),"$(DESTDIR)$(LIBDIR)/python$(PY_VERSION)/$(M).py") -- cgit v1.2.3-70-g09d2