From b11f39dec26c1c9737b096e28eeedc578e90f406 Mon Sep 17 00:00:00 2001 From: Mars Saxman Date: Sat, 24 Feb 2018 18:55:26 -0800 Subject: [PATCH] Check availability of cython2 and fall back to plain cython if not present --- gum/fast/Makefile | 11 ++++++++--- gum/fx/Makefile | 11 +++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gum/fast/Makefile b/gum/fast/Makefile index 4f872d0..4b9b4f3 100644 --- a/gum/fast/Makefile +++ b/gum/fast/Makefile @@ -1,12 +1,17 @@ -all: fast.c +# Use 'cython2' if present on this system; otherwise fall back to 'cython'. +CYTHON := $(if $(shell command -v cython2 2>/dev/null), cython2, cython) -fast.c: fast.pyx - cython2 fast.pyx +all: fast.so + +fast.so: fast.c gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing \ -I/usr/include/python2.5 -I/usr/include/python2.6 \ -I/usr/include/python2.7 \ -lcairo -o fast.so fast.c if [ ! -e ../fast.so ]; then ln -s fast/fast.so ../; fi +fast.c: fast.pyx + $(CYTHON) fast.pyx + clean: rm -f fast.so fast.c diff --git a/gum/fx/Makefile b/gum/fx/Makefile index ec974c2..35fdce1 100644 --- a/gum/fx/Makefile +++ b/gum/fx/Makefile @@ -1,9 +1,16 @@ -all: - cython2 _svf.pyx +# Use 'cython2' if present on this system; otherwise fall back to 'cython'. +CYTHON := $(if $(shell command -v cython2 2>/dev/null), cython2, cython) + +all: _svf.so + +_svf.so: _svf.c gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing \ -I/usr/include/python2.5 -I/usr/include/python2.6 \ -I/usr/include/python2.7 \ -o _svf.so _svf.c +_svf.c: _svf.pyx + $(CYTHON) _svf.pyx + clean: rm -f _svf.so _svf.c