-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathMakefile
208 lines (195 loc) · 4.49 KB
/
Makefile
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
SFLAGS += -Ipython/src
SFLAGS += -Ipython/port
SFLAGS += -I$(BUILD_DIR)/python/port
# How to maintain this Makefile
# - Copy PY_CORE_O_BASENAME from py.mk into py_src
# - Copy select PY_EXTMOD_O_BASENAME from py.mk into extmod_src
# - Edit special-case workarounds below as needed
py_src = $(addprefix python/src/py/,\
mpstate.c \
nlr.c \
nlrx86.c \
nlrx64.c \
nlrthumb.c \
nlraarch64.c \
nlrpowerpc.c \
nlrxtensa.c \
nlrsetjmp.c \
malloc.c \
gc.c \
pystack.c \
qstr.c \
vstr.c \
mpprint.c \
unicode.c \
mpz.c \
reader.c \
lexer.c \
parse.c \
scope.c \
compile.c \
emitcommon.c \
emitbc.c \
asmbase.c \
asmx64.c \
emitnx64.c \
asmx86.c \
emitnx86.c \
asmthumb.c \
emitnthumb.c \
emitinlinethumb.c \
asmarm.c \
emitnarm.c \
asmxtensa.c \
emitnxtensa.c \
emitinlinextensa.c \
emitnxtensawin.c \
formatfloat.c \
parsenumbase.c \
parsenum.c \
emitglue.c \
persistentcode.c \
runtime.c \
runtime_utils.c \
scheduler.c \
nativeglue.c \
pairheap.c \
ringbuf.c \
stackctrl.c \
argcheck.c \
warning.c \
profile.c \
map.c \
obj.c \
objarray.c \
objattrtuple.c \
objbool.c \
objboundmeth.c \
objcell.c \
objclosure.c \
objcomplex.c \
objdeque.c \
objdict.c \
objenumerate.c \
objexcept.c \
objfilter.c \
objfloat.c \
objfun.c \
objgenerator.c \
objgetitemiter.c \
objint.c \
objint_longlong.c \
objint_mpz.c \
objlist.c \
objmap.c \
objmodule.c \
objobject.c \
objpolyiter.c \
objproperty.c \
objnone.c \
objnamedtuple.c \
objrange.c \
objreversed.c \
objset.c \
objsingleton.c \
objslice.c \
objstr.c \
objstrunicode.c \
objstringio.c \
objtuple.c \
objtype.c \
objzip.c \
opmethods.c \
sequence.c \
stream.c \
binary.c \
builtinimport.c \
builtinevex.c \
builtinhelp.c \
modarray.c \
modbuiltins.c \
modcollections.c \
modgc.c \
modio.c \
modmath.c \
modcmath.c \
modmicropython.c \
modstruct.c \
modsys.c \
moduerrno.c \
modthread.c \
vm.c \
bc.c \
showbc.c \
repl.c \
smallint.c \
frozenmod.c \
)
extmod_src += $(addprefix python/src/extmod/,\
modurandom.c \
)
port_src += $(addprefix python/port/,\
port.c \
builtins.c \
helpers.c \
mod/ion/modion.cpp \
mod/ion/modion_table.cpp \
mod/kandinsky/modkandinsky.cpp \
mod/kandinsky/modkandinsky_table.c \
mod/matplotlib/modmatplotlib.cpp \
mod/matplotlib/modmatplotlib_table.c \
mod/matplotlib/pyplot/modpyplot.cpp \
mod/matplotlib/pyplot/modpyplot_table.c \
mod/matplotlib/pyplot/plot_controller.cpp \
mod/matplotlib/pyplot/plot_store.cpp \
mod/matplotlib/pyplot/pyplot_view.cpp \
mod/time/modtime.c \
mod/time/modtime_table.c \
mod/turtle/modturtle.cpp \
mod/turtle/modturtle_table.c \
mod/turtle/turtle.cpp \
mphalport.c \
)
# Workarounds
# Rename urandom to random
# In order to change the name of the micropython module 'urandom' to 'random'
# (without altering micropython files), we redefined the macro MP_QSTR_urandom
# by DMP_QSTR_random.
$(call object_for,python/src/py/objmodule.c): SFLAGS += -DMP_QSTR_urandom="MP_QSTR_random"
$(call object_for,python/src/extmod/modurandom.c): SFLAGS += -DMP_QSTR_urandom="MP_QSTR_random"
# Handle upward-growing stack
# Some platforms such as emscripten have a stack that grows up. We've rewritten
# the stack control file to handle this case.
py_src := $(filter-out python/src/py/stackctrl.c, $(py_src))
port_src += python/port/stackctrl.c
# Fix the GC on emscripten
# With optimizations, register and stack variables might be held in a JavaScript
# local variables, which breaks garbage collection. Indeed, these JavaScript
# variables cannot be marked as root during garbage collection, which means that
# the heap objects they depend on will likely be destroyed. When the Python
# computing resumes, if necessary heap objects have been destroyed, the Python
# program crashes.
ifeq ($(PLATFORM),emscripten)
$(call object_for,$(py_src)): SFLAGS := $(subst -Os,-O0,$(SFLAGS))
endif
python_src = $(py_src) $(extmod_src) $(port_src)
# QSTR generation
$(eval $(call rule_for, \
QSTRDAT, \
python/port/genhdr/qstrdefs.generated.h, \
python/port/genhdr/qstrdefs.in.h, \
$$(PYTHON) python/src/py/makeqstrdata.py $$< > $$@, \
global \
))
$(call object_for,$(python_src)): $(BUILD_DIR)/python/port/genhdr/qstrdefs.generated.h
tests_src += $(addprefix python/test/,\
basics.cpp \
execution_environment.cpp \
ion.cpp \
kandinsky.cpp \
math.cpp \
random.cpp \
time.cpp \
turtle.cpp \
matplotlib.cpp \
)