-
Notifications
You must be signed in to change notification settings - Fork 107
/
Makefile.config
174 lines (164 loc) · 6.55 KB
/
Makefile.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#
# compilation parameters for SNAP Python
#
UNAME := $(shell uname)
SETUP = setup.py
ifeq ($(UNAME), Linux)
# Linux flags
SWIGFLAGS += -D_CMPWARN -D__stdcall -DSW_SNAPPY -D_OPENMP -DNONUMPY -DUSE_OPENMP -DGCC_ATOMIC
CXXFLAGS += -fPIC -D__STDC_LIMIT_MACROS -DSW_SNAPPY -fopenmp
MANIFEST = MANIFEST.nx
MANIFEST_IN = MANIFEST.in.nx
PYTHON = python
PYTHON3 = python3
# SNAP_PY is set externally for the manylinux1 environment
ifeq ($(SNAP_PY), 3.9)
IFLAGS3 = -I/opt/python/cp39-cp39/include/python3.9
LDFLAGS3 += -shared -fopenmp
PYTHON3 = /opt/python/cp39-cp39/bin/python3
else ifeq ($(SNAP_PY), 3.8)
IFLAGS3 = -I/opt/python/cp38-cp38/include/python3.8
LDFLAGS3 += -shared -fopenmp
PYTHON3 = /opt/python/cp38-cp38/bin/python3
else ifeq ($(SNAP_PY), 3.7)
IFLAGS3 = -I/opt/python/cp37-cp37m/include/python3.7m
LDFLAGS3 += -shared -fopenmp
PYTHON3 = /opt/python/cp37-cp37m/bin/python3
else ifeq ($(SNAP_PY), 3.6)
IFLAGS3 = -I/opt/python/cp36-cp36m/include/python3.6m
LDFLAGS3 += -shared -fopenmp
PYTHON3 = /opt/python/cp36-cp36m/bin/python3
else ifeq ($(SNAP_PY), 3.5)
IFLAGS3 = -I/opt/python/cp35-cp35m/include/python3.5m
LDFLAGS3 += -shared -fopenmp
PYTHON3 = /opt/python/cp35-cp35m/bin/python3
else ifeq ($(SNAP_PY), 2.7m)
IFLAGS = -I/opt/python/cp27-cp27m/include/python2.7
LDFLAGS += -shared -fopenmp
PYTHON = /opt/python/cp27-cp27m/bin/python2
else ifeq ($(SNAP_PY), 2.7mu)
IFLAGS = -I/opt/python/cp27-cp27mu/include/python2.7
LDFLAGS += -shared -fopenmp
PYTHON = /opt/python/cp27-cp27mu/bin/python2
else
IFLAGS ?= -I/usr/include/python2.6 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include
IFLAGS3 ?= -I/usr/local/include/python3.7m -I/usr/include/python3.7m
IFLAGS3 += -I/usr/local/include/python3.6m -I/usr/include/python3.6m
IFLAGS3 += -I/usr/local/include/python3.5m -I/usr/include/python3.5m
LDFLAGS += -shared -fopenmp
LDFLAGS3 += -shared -fopenmp
endif
else ifeq ($(UNAME), Darwin)
# OS X flags
CC = g++
SWIGFLAGS += -D_CMPWARN -D__stdcall -DSW_SNAPPY -DNONUMPY
CXXFLAGS = -std=c++98 -fwrapv -Wall -Wno-unknown-pragmas -O3 -DNDEBUG -DNOMP -DSW_SNAPPY
CXXFLAGS += -DSW_SNAPPY
MANIFEST = MANIFEST.mac
MANIFEST_IN = MANIFEST.in.nx
PYTHON = python
PYTHON3 = python3
IFLAGS = -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
IFLAGS3 = $(IFLAGS)
LDFLAGS = -bundle -undefined dynamic_lookup
LDFLAGS += -L/usr/local/opt/readline/lib -L/usr/local/opt/[email protected]/lib
LDFLAGS3 = $(LDFLAGS)
# SNAP_PY is set externally for the python build environment
ifeq ($(SNAP_PY), 2.7)
PYPATH = /Users/rok/.pyenv/versions/2.7.18
CXXFLAGS += -fno-strict-aliasing
IFLAGS += -I$(PYPATH)/include/python2.7
LDFLAGS += -L$(PYPATH)/lib
else ifeq ($(SNAP_PY), 3.5)
PYPATH = /Users/rok/.pyenv/versions/3.5.10
IFLAGS3 += -I$(PYPATH)/include/python3.5m
LDFLAGS3 += -L$(PYPATH)/lib
else ifeq ($(SNAP_PY), 3.6)
PYPATH = /Users/rok/.pyenv/versions/3.6.12
IFLAGS3 += -I$(PYPATH)/include/python3.6m
LDFLAGS3 += -L$(PYPATH)/lib
else ifeq ($(SNAP_PY), 3.7)
PYPATH = /Users/rok/.pyenv/versions/3.7.9
IFLAGS3 += -I$(PYPATH)/include/python3.7m
LDFLAGS3 += -L$(PYPATH)/lib
else ifeq ($(SNAP_PY), 3.8)
PYPATH = /Users/rok/.pyenv/versions/3.8.6
IFLAGS3 += -I$(PYPATH)/include/python3.8
LDFLAGS3 += -L$(PYPATH)/lib
else ifeq ($(SNAP_PY), 3.9)
PYPATH = /Users/rok/.pyenv/versions/3.9.0
IFLAGS3 += -I$(PYPATH)/include/python3.9
LDFLAGS3 += -L$(PYPATH)/lib
else
# the build environment is not specified, try to figure out the parameters
PY_CONDA3 := $(shell which python3 | grep conda3)
PY_BREW := $(shell which python3 | grep local)
IFLAGS := $(shell python-config --includes)
IFLAGS3 := $(shell python3-config --includes)
LDFLAGS := $(shell python-config --ldflags) -dynamiclib -headerpad_max_install_names
LDFLAGS3 := $(shell python3-config --ldflags) -dynamiclib -headerpad_max_install_names
CLANG := $(shell g++ -v 2>&1 | grep clang | cut -d " " -f 2)
ifeq ($(CLANG), LLVM)
CXXFLAGS += -DNOMP
CXXOPENMP =
else ifeq ($(CLANG), clang)
CXXFLAGS += -DNOMP
CXXOPENMP =
else
#SWIGFLAGS += -DGCC_ATOMIC
CXXFLAGS += -fopenmp
LDFLAGS += -fopenmp
#CXXOPENMP += -fopenmp
endif
ifneq ($(PY_CONDA3), )
CC = x86_64-apple-darwin13.4.0-clang
CXXFLAGS = -std=c++98 -Wall -Wno-unknown-pragmas -O3
CXXFLAGS += -fPIC -flto -mmacosx-version-min=10.9
CXXFLAGS += -DNDEBUG -DSW_SNAPPY -DNOMP
CXXFLAGS += -isystem $(CONDA_PREFIX)/include
IFLAGS3 = -I$(CONDA_PREFIX)/include/python3.7m
LDFLAGS3 = -bundle -undefined dynamic_lookup -flto -arch x86_64 -mmacosx-version-min=10.9
LDFLAGS3 += -isystem $(CONDA_PREFIX)/include
LDFLAGS3 += -L$(CONDA_PREFIX)/lib
LIBS =
endif
ifneq ($(PY_BREW), )
CC = clang
CXXFLAGS = -std=c++98 -Wall -Wno-unknown-pragmas -O3
CXXFLAGS += -dynamic
CXXFLAGS += -DNDEBUG -DSW_SNAPPY -DNOMP
CXXFLAGS += -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
IFLAGS3 = -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
IFLAGS3 += -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers
IFLAGS3 += -I/usr/local/include
IFLAGS3 += -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m
LDFLAGS3 = -bundle -undefined dynamic_lookup -flto
LDFLAGS3 += -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
LDFLAGS3 += -L/usr/local/lib
LIBS =
endif
endif
else ifeq ($(shell uname -o), Cygwin)
# Cygwin flags
SWIGFLAGS += -D_CMPWARN -D__stdcall -DSW_SNAPPY -DNONUMPY
CXXFLAGS += -shared -D__STDC_LIMIT_MACROS -DSW_SNAPPY
LIBS += -lpython2.6
MANIFEST = MANIFEST.win
MANIFEST_IN = MANIFEST.in.win
ifeq ($(SNAP_PY), 2.7)
PYTHON = /cygdrive/c/Python27/python
else ifeq ($(SNAP_PY), 3.5)
PYTHON = /cygdrive/c/Program\ Files/Python35/python
else ifeq ($(SNAP_PY), 3.6)
PYTHON = /cygdrive/c/Program\ Files/Python36/python
else ifeq ($(SNAP_PY), 3.7)
PYTHON = /cygdrive/c/Program\ Files/Python37/python
else ifeq ($(SNAP_PY), 3.8)
PYTHON = /cygdrive/c/Program\ Files/Python38/python
else ifeq ($(SNAP_PY), 3.9)
PYTHON = /cygdrive/c/Program\ Files/Python39/python
endif
else
PYTHON = "/cygdrive/c/Program\ Files/Python37/python"
endif
SWIGFLAGS3 += $(SWIGFLAGS)