aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-16 11:53:49 +0200
committerMattias Andrée <maandree@kth.se>2016-08-16 11:53:49 +0200
commita8cede88dc170cf39f430e44fd9d659d3173032b (patch)
treed3e905e8b2c8a6cdfca8769f0262c0e1af812830 /Makefile
parentCorrections to libcoopgamma_native.pyx.gpp (diff)
downloadpylibcoopgamma-a8cede88dc170cf39f430e44fd9d659d3173032b.tar.gz
pylibcoopgamma-a8cede88dc170cf39f430e44fd9d659d3173032b.tar.bz2
pylibcoopgamma-a8cede88dc170cf39f430e44fd9d659d3173032b.tar.xz
...
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile19
1 files changed, 18 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 6d39412..e3dd8b8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,17 @@
GPP = gpp
CYTHON = cython
+PKGCONFIG = pkg-config
-all: obj/libcoopgamma_native.c
+PY_MAJOR = 3
+
+OPTIMISE = -O2
+LIBS = python$(PY_MAJOR)
+
+CC_FLAGS = $$($(PKGCONFIG) --cflags $(LIBS)) -std=c99 $(OPTIMISE) -fPIC $(CFLAGS) $(CPPFLAGS)
+LD_FLAGS = $$($(PKGCONFIG) --libs $(LIBS)) -lcoopgamma -std=c99 $(OPTIMISE) -shared $(LDFLAGS)
+
+
+all: bin/libcoopgamma_native.so
obj/libcoopgamma_native.pyx: src/libcoopgamma_native.pyx.gpp
@mkdir -p obj
@@ -10,3 +20,10 @@ obj/libcoopgamma_native.pyx: src/libcoopgamma_native.pyx.gpp
obj/%.c: obj/%.pyx
if ! $(CYTHON) -3 -v $< ; then rm $@ ; false ; fi
+obj/%.o: obj/%.c src/*.h
+ $(CC) $(CC_FLAGS) -iquote"src" -c -o $@ $<
+
+bin/%.so: obj/%.o
+ @mkdir -p bin
+ $(CC) $(LD_FLAGS) -o $@ $^
+