From a8cede88dc170cf39f430e44fd9d659d3173032b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 16 Aug 2016 11:53:49 +0200 Subject: ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Makefile') 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 $@ $^ + -- cgit v1.2.3-70-g09d2