aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-02 17:05:53 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-02 17:05:53 +0200
commitb2b67d3220e1412467f611ec48738dc433a1976f (patch)
tree328d9b7a22c7efaacf5ab952151f7028a5cff8ff /Makefile
parentstate req:d version of libgamma (diff)
downloadpylibgamma-b2b67d3220e1412467f611ec48738dc433a1976f.tar.gz
pylibgamma-b2b67d3220e1412467f611ec48738dc433a1976f.tar.bz2
pylibgamma-b2b67d3220e1412467f611ec48738dc433a1976f.tar.xz
compile python files
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 31 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4af3f3d..15c2b98 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,18 @@ LICENSEDIR ?= $(DATADIR)/licenses
# The target and host platform
PLATFORM = posix
+# The major version number of the current Python installation
+PY_MAJOR = 3
+# The minor version number of the current Python installation
+PY_MINOR = 4
+# 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
+PY_VERSION = $(PY_MAJOR).$(PY_MINOR)
+
+# The name of the package as it should be installed
+PKGNAME = pylibgamma
+
# The installed pkg-config command
PKGCONFIG ?= pkg-config
@@ -50,8 +62,18 @@ LD_FLAGS = $$($(PKGCONFIG) --libs $(LIBS)) -lgamma -std=$(STD) \
$(OPTIMISE) -shared $(LDFLAGS)
-.PHONY: all
-all: $(foreach M,error facade method,bin/libgamma_native_$(M).so)
+# The suffixless basename of the .py-files
+PYTHON_SRC = libgamma_error libgamma_facade libgamma_method libgamma
+
+# The suffixless basename of the .py-files
+CYTHON_SRC = libgamma_native_error libgamma_native_facade libgamma_native_method
+
+
+.PHONY: all pyx-files py-files
+all: pyc-files pyo-files so-files
+pyc-files: $(foreach M,$(PYTHON_SRC),src/__pycache__/$(M).cpython-$(PY_VER).pyc)
+pyo-files: $(foreach M,$(PYTHON_SRC),src/__pycache__/$(M).cpython-$(PY_VER).pyo)
+so-files: $(foreach M,$(CYTHON_SRC),bin/$(M).so)
bin/%.so: obj/%.o
@mkdir -p bin
@@ -81,8 +103,14 @@ obj/libgamma_native_error.pyx: src/libgamma_native_error.pyx
cp $< $@
endif
+src/__pycache__/%.cpython-$(PY_VER).pyc: src/%.py
+ python -m compileall $<
+
+src/__pycache__/%.cpython-$(PY_VER).pyo: src/%.py
+ python -OO -m compileall $<
+
.PHONY: clean
clean:
- -rm -r obj bin
+ -rm -r obj bin src/__pycache__