py.mk 2.4 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
	objfloat.o \
	objfun.o \
	objgenerator.o \
50
	objgetitemiter.o \
51
	objint.o \
52
	objint_longlong.o \
53
	objlist.o \
John R. Lenton's avatar
John R. Lenton committed
54
	objmap.o \
55
56
57
58
59
60
61
62
	objmodule.o \
	objnone.o \
	objrange.o \
	objset.o \
	objslice.o \
	objstr.o \
	objtuple.o \
	objtype.o \
63
	objzip.o \
64
	sequence.o \
65
	stream.o \
66
67
	builtin.o \
	builtinimport.o \
Damien George's avatar
Damien George committed
68
	builtineval.o \
69
	builtinmp.o \
70
71
72
73
74
	vm.o \
	showbc.o \
	repl.o \

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

77
78
# qstr data

79
80
81
82
# 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
83
84
85
	$(ECHO) "makeqstrdata $(PY_QSTR_DEFS) $(QSTR_DEFS)"
	$(Q)python $(PY_SRC)/makeqstrdata.py $(PY_QSTR_DEFS) $(QSTR_DEFS) > $@

86
87
88
89
90
91
# 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
92

93
# emitters
94

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

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

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

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