blob: 34ef9e9482b0e91d72091605e5e6372f66787a4a [file] [log] [blame]
Dave Hylands46468012014-01-08 10:15:39 -08001##########
2# The following should eventually go into a more central location
3# when a reorg is done.
4#
5# Turn on increased build verbosity by defining BUILD_VERBOSE in your main
6# Makefile or in your environment. You can also use V=1 on the make command
7# line.
8ifeq ("$(origin V)", "command line")
9BUILD_VERBOSE=$(V)
10endif
11ifndef BUILD_VERBOSE
12BUILD_VERBOSE = 0
13endif
14ifeq ($(BUILD_VERBOSE),0)
15Q = @
16else
17Q =
18endif
19# Since this is a new feature, advertise it
20ifeq ($(BUILD_VERBOSE),0)
21$(info Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.)
22endif
23#
24#########
25
Damien George136f6752014-01-07 14:54:15 +000026# default settings; can be overriden in main Makefile
27
28ifndef PY_SRC
29PY_SRC = ../py
30endif
31
32ifndef BUILD
33BUILD = build
34endif
35
36# to create the build directory
37
38$(BUILD):
Dave Hylands46468012014-01-08 10:15:39 -080039 $(Q)mkdir -p $@
Damien George136f6752014-01-07 14:54:15 +000040
41# where py object files go (they have a name prefix to prevent filename clashes)
42
43PY_BUILD = $(BUILD)/py.
44
45# py object files
46
47PY_O_BASENAME = \
48 nlrx86.o \
49 nlrx64.o \
50 nlrthumb.o \
51 malloc.o \
Damien Georged3ebe482014-01-07 15:20:33 +000052 gc.o \
Damien George136f6752014-01-07 14:54:15 +000053 qstr.o \
54 vstr.o \
55 unicode.o \
56 lexer.o \
Damien George9193f892014-01-08 15:28:26 +000057 lexerstr.o \
Damien George136f6752014-01-07 14:54:15 +000058 lexerunix.o \
59 parse.o \
60 scope.o \
61 compile.o \
62 emitcommon.o \
63 emitpass1.o \
64 emitcpy.o \
65 emitbc.o \
66 asmx64.o \
67 emitnx64.o \
68 asmthumb.o \
69 emitnthumb.o \
70 emitinlinethumb.o \
71 runtime.o \
72 map.o \
xybc178ea42014-01-14 21:39:05 +080073 strtonum.o \
Damien George136f6752014-01-07 14:54:15 +000074 obj.o \
Paul Sokolovsky427905c2014-01-18 19:24:47 +020075 objarray.o \
Damien George136f6752014-01-07 14:54:15 +000076 objbool.o \
77 objboundmeth.o \
78 objcell.o \
Damien George136f6752014-01-07 14:54:15 +000079 objclosure.o \
80 objcomplex.o \
81 objdict.o \
John R. Lenton9daa7892014-01-14 23:55:01 +000082 objenumerate.o \
Damien George136f6752014-01-07 14:54:15 +000083 objexcept.o \
John R. Lentonfca456b2014-01-15 01:37:08 +000084 objfilter.o \
Damien George136f6752014-01-07 14:54:15 +000085 objfloat.o \
86 objfun.o \
87 objgenerator.o \
Damien George136f6752014-01-07 14:54:15 +000088 objint.o \
Paul Sokolovsky966879c2014-01-17 20:01:36 +020089 objint_longlong.o \
Damien George136f6752014-01-07 14:54:15 +000090 objlist.o \
John R. Lenton39b174e2014-01-15 01:10:09 +000091 objmap.o \
Damien George136f6752014-01-07 14:54:15 +000092 objmodule.o \
93 objnone.o \
94 objrange.o \
95 objset.o \
96 objslice.o \
97 objstr.o \
98 objtuple.o \
99 objtype.o \
Paul Sokolovskye98cf402014-01-08 02:43:48 +0200100 stream.o \
Damien George136f6752014-01-07 14:54:15 +0000101 builtin.o \
102 builtinimport.o \
Damien Georged02c6d82014-01-15 22:14:03 +0000103 builtineval.o \
Damien George136f6752014-01-07 14:54:15 +0000104 vm.o \
105 showbc.o \
106 repl.o \
John R. Lenton07205ec2014-01-13 02:31:00 +0000107 objzip.o \
Damien George136f6752014-01-07 14:54:15 +0000108
109# prepend the build destination prefix to the py object files
110
111PY_O = $(addprefix $(PY_BUILD), $(PY_O_BASENAME))
112
113$(PY_BUILD)emitnx64.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
Dave Hylands46468012014-01-08 10:15:39 -0800114 $(ECHO) "CC $<"
115 $(Q)$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000116
117$(PY_BUILD)emitnthumb.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
Dave Hylands46468012014-01-08 10:15:39 -0800118 $(ECHO) "CC $<"
119 $(Q)$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000120
121$(PY_BUILD)%.o: $(PY_SRC)/%.S
Dave Hylands46468012014-01-08 10:15:39 -0800122 $(ECHO) "CC $<"
123 $(Q)$(CC) $(CFLAGS) -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000124
125$(PY_BUILD)%.o: $(PY_SRC)/%.c mpconfigport.h
Dave Hylands46468012014-01-08 10:15:39 -0800126 $(ECHO) "CC $<"
127 $(Q)$(CC) $(CFLAGS) -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000128
Damien Georged3ebe482014-01-07 15:20:33 +0000129# optimising gc for speed; 5ms down to 4ms on pybv2
130$(PY_BUILD)gc.o: $(PY_SRC)/gc.c
Dave Hylands46468012014-01-08 10:15:39 -0800131 $(ECHO) "CC $<"
132 $(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
Damien Georged3ebe482014-01-07 15:20:33 +0000133
Damien George136f6752014-01-07 14:54:15 +0000134# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
135$(PY_BUILD)vm.o: $(PY_SRC)/vm.c
Dave Hylands46468012014-01-08 10:15:39 -0800136 $(ECHO) "CC $<"
137 $(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000138
139# header dependencies
140
141$(PY_BUILD)parse.o: $(PY_SRC)/grammar.h
142$(PY_BUILD)compile.o: $(PY_SRC)/grammar.h
143$(PY_BUILD)/emitcpy.o: $(PY_SRC)/emit.h
144$(PY_BUILD)emitbc.o: $(PY_SRC)/emit.h