From d8fd6afdf19437c2875ddb83fd72d40b6a42fd1e Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Mon, 23 Aug 2010 10:24:13 -0300 Subject: [PATCH] more robust build for embedded tests --- Demos/embed/Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Demos/embed/Makefile b/Demos/embed/Makefile index 0cdb7b44..59e053f4 100644 --- a/Demos/embed/Makefile +++ b/Demos/embed/Makefile @@ -1,15 +1,22 @@ # Makefile for creating our standalone Cython program PYTHON=python PYVERSION=$(shell $(PYTHON) -c "import sys; print(sys.version[:3])") -PYPREFIX=$(shell $(PYTHON) -c "import sys; print(sys.prefix)") + +INCDIR=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_python_inc())") +LIBDIR1=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBDIR'))") +LIBDIR2=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBPL'))") + +CC=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('CC'))") +LINKCC=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LINKCC'))") LINKFORSHARED=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LINKFORSHARED'))") -INCLUDES=-I$(PYPREFIX)/include/python$(PYVERSION) +LIBS=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'))") +SYSLIBS= $(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('SYSLIBS'))") embedded: embedded.o - gcc -o $@ $^ $(LINKFORSHARED) -lpython$(PYVERSION) -lm -lpthread -ldl -lutil -L$(PYPREFIX)/lib + $(LINKCC) -o $@ $^ $(LINKFORSHARED) -L$(LIBDIR1) -L$(LIBDIR2) -lpython$(PYVERSION) $(LIBS) $(SYSLIBS) embedded.o: embedded.c - gcc -c $^ $(INCLUDES) + $(CC) -c $^ -I$(INCDIR) embedded.c: embedded.pyx @$(PYTHON) ../../cython.py --embed embedded.pyx -- 2.26.2