@@ -5,7 +5,6 @@ MAKE := make
5
5
6
6
CFLAGS += -Wall -Wextra -fpic -O2 -fno-strict-aliasing -Wno-unused-parameter
7
7
8
-
9
8
SYS := $(shell gcc -dumpmachine)
10
9
11
10
ifeq ($(SYS ) , x86_64-w64-mingw32)
@@ -16,33 +15,35 @@ endif
16
15
17
16
ifneq (, $(findstring linux, $(SYS ) ) )
18
17
SUFFIX := so
19
- LDFLAGS := -shared
20
- LIBS += -ldl
18
+
19
+ ifndef PYTHONVER
20
+ $(error Couldn't find PYTHONVER)
21
+ endif
22
+
23
+ INCLUDES += $(shell python${PYTHONVER}-config --includes)
24
+ LDFLAGS := -shared $(shell python${PYTHONVER}-config --ldflags)
25
+ LIBS += $(shell python${PYTHONVER}-config --libs)
21
26
else ifneq (, $(findstring mingw, $(SYS)))
22
27
SUFFIX := dll
23
- LDFLAGS := -shared
28
+
29
+ ifndef PYTHONHOME
30
+ $(error Couldn't find PYTHONHOME)
31
+ endif
32
+
33
+ PYTHONVER := $(shell ${PYTHONHOME}python -c "import sys; print(str(sys.version_info[0])+str(sys.version_info[1]))")
34
+
35
+ INCLUDES += -I${PYTHONHOME}/include
36
+ LDFLAGS += -L${PYTHONHOME}/Libs
37
+ LIBS = -lpython${PYTHONVER}
24
38
else
25
39
$(error Unsupported build platform)
26
40
endif
27
41
28
-
29
-
30
-
31
42
ifndef GLOBALS_HOME
32
- $(error Couldn't find GLOBALS_HOME)
43
+ $(error Couldn't find GLOBALS_HOME)
33
44
endif
34
45
35
- ifndef PYTHONHOME
36
- $(error Couldn't find PYTHONHOME)
37
- endif
38
-
39
- PYTHONVER := $(shell ${PYTHONHOME}python -c "import sys; print(sys.version_info[0],sys.version_info[1],sep='') ")
40
- LIBS = -lpython${PYTHONVER}
41
-
42
- LDFLAGS += -L${PYTHONHOME}/Libs
43
-
44
46
INCLUDES += -I${GLOBALS_HOME}/dev/cpp/include
45
- INCLUDES += -I${PYTHONHOME}/include
46
47
CFLAGS += $(INCLUDES )
47
48
48
49
.PHONY : all clean
0 commit comments