py.mk 2.38 KB
Newer Older
1
# where py object files go (they have a name prefix to prevent filename clashes)
2
PY_BUILD = $(BUILD)/py
3

4
5
6
7
# file containing qstr defs for the core Python bit

PY_QSTR_DEFS = $(PY_SRC)/qstrdefs.h

8
9
10
11
12
13
# py object files
PY_O_BASENAME = \
	nlrx86.o \
	nlrx64.o \
	nlrthumb.o \
	malloc.o \
14
	gc.o \
15
16
17
18
	qstr.o \
	vstr.o \
	unicode.o \
	lexer.o \
19
	lexerstr.o \
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
	lexerunix.o \
	parse.o \
	scope.o \
	compile.o \
	emitcommon.o \
	emitpass1.o \
	emitcpy.o \
	emitbc.o \
	asmx64.o \
	emitnx64.o \
	asmthumb.o \
	emitnthumb.o \
	emitinlinethumb.o \
	runtime.o \
	map.o \
xyb's avatar
xyb committed
35
	strtonum.o \
36
	obj.o \
37
	objarray.o \
38
39
40
41
42
43
	objbool.o \
	objboundmeth.o \
	objcell.o \
	objclosure.o \
	objcomplex.o \
	objdict.o \
John R. Lenton's avatar
John R. Lenton committed
44
	objenumerate.o \
45
	objexcept.o \
John R. Lenton's avatar
John R. Lenton committed
46
	objfilter.o \
47
48
49
50
	objfloat.o \
	objfun.o \
	objgenerator.o \
	objint.o \
51
	objint_longlong.o \
52
	objlist.o \
John R. Lenton's avatar
John R. Lenton committed
53
	objmap.o \
54
55
56
57
58
59
60
61
	objmodule.o \
	objnone.o \
	objrange.o \
	objset.o \
	objslice.o \
	objstr.o \
	objtuple.o \
	objtype.o \
62
	objzip.o \
63
	sequence.o \
64
	stream.o \
65
66
	builtin.o \
	builtinimport.o \
Damien George's avatar
Damien George committed
67
	builtineval.o \
68
	builtinmp.o \
69
70
71
72
73
	vm.o \
	showbc.o \
	repl.o \

# prepend the build destination prefix to the py object files
74
PY_O = $(addprefix $(PY_BUILD)/, $(PY_O_BASENAME))
75

76
77
# qstr data

78
79
80
81
# Adding an order only dependency on $(PY_BUILD) causes $(PY_BUILD) to get
# created before we run the script to generate the .h
$(PY_BUILD)/qstrdefs.generated.h: | $(PY_BUILD)
$(PY_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqstrdata.py
82
83
84
	$(ECHO) "makeqstrdata $(PY_QSTR_DEFS) $(QSTR_DEFS)"
	$(Q)python $(PY_SRC)/makeqstrdata.py $(PY_QSTR_DEFS) $(QSTR_DEFS) > $@

85
86
87
88
89
90
# We don't know which source files actually need the generated.h (since
# it is #included from str.h). The compiler generated dependencies will cause
# the right .o's to get recompiled if the generated.h file changes. Adding
# an order-only dependendency to all of the .o's will cause the generated .h
# to get built before we try to compile any of them.
$(PY_O): | $(PY_BUILD)/qstrdefs.generated.h
91

92
# emitters
93

94
95
96
$(PY_BUILD)/emitnx64.o: CFLAGS += -DN_X64
$(PY_BUILD)/emitnx64.o: py/emitnative.c
	$(call compile_c)
97

98
99
100
$(PY_BUILD)/emitnthumb.o: CFLAGS += -DN_THUMB
$(PY_BUILD)/emitnthumb.o: py/emitnative.c
	$(call compile_c)
101

102
# optimising gc for speed; 5ms down to 4ms on pybv2
103
$(PY_BUILD)gc.o: CFLAGS += -O3
104

105
# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
106
$(PY_BUILD)vm.o: CFLAGS += -O3
107