blob: daf2f5934d2bf3fa7fa867c8be403445a701f716 [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 \
73 obj.o \
74 objbool.o \
75 objboundmeth.o \
76 objcell.o \
Damien George136f6752014-01-07 14:54:15 +000077 objclosure.o \
78 objcomplex.o \
79 objdict.o \
John R. Lenton9daa7892014-01-14 23:55:01 +000080 objenumerate.o \
Damien George136f6752014-01-07 14:54:15 +000081 objexcept.o \
John R. Lentonfca456b2014-01-15 01:37:08 +000082 objfilter.o \
Damien George136f6752014-01-07 14:54:15 +000083 objfloat.o \
84 objfun.o \
85 objgenerator.o \
Damien George136f6752014-01-07 14:54:15 +000086 objint.o \
87 objlist.o \
John R. Lenton39b174e2014-01-15 01:10:09 +000088 objmap.o \
Damien George136f6752014-01-07 14:54:15 +000089 objmodule.o \
90 objnone.o \
91 objrange.o \
92 objset.o \
93 objslice.o \
94 objstr.o \
95 objtuple.o \
96 objtype.o \
Paul Sokolovskye98cf402014-01-08 02:43:48 +020097 stream.o \
Damien George136f6752014-01-07 14:54:15 +000098 builtin.o \
99 builtinimport.o \
100 vm.o \
101 showbc.o \
102 repl.o \
John R. Lenton07205ec2014-01-13 02:31:00 +0000103 objzip.o \
Damien George136f6752014-01-07 14:54:15 +0000104
105# prepend the build destination prefix to the py object files
106
107PY_O = $(addprefix $(PY_BUILD), $(PY_O_BASENAME))
108
109$(PY_BUILD)emitnx64.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
Dave Hylands46468012014-01-08 10:15:39 -0800110 $(ECHO) "CC $<"
111 $(Q)$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000112
113$(PY_BUILD)emitnthumb.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_THUMB -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000116
117$(PY_BUILD)%.o: $(PY_SRC)/%.S
Dave Hylands46468012014-01-08 10:15:39 -0800118 $(ECHO) "CC $<"
119 $(Q)$(CC) $(CFLAGS) -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000120
121$(PY_BUILD)%.o: $(PY_SRC)/%.c mpconfigport.h
Dave Hylands46468012014-01-08 10:15:39 -0800122 $(ECHO) "CC $<"
123 $(Q)$(CC) $(CFLAGS) -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000124
Damien Georged3ebe482014-01-07 15:20:33 +0000125# optimising gc for speed; 5ms down to 4ms on pybv2
126$(PY_BUILD)gc.o: $(PY_SRC)/gc.c
Dave Hylands46468012014-01-08 10:15:39 -0800127 $(ECHO) "CC $<"
128 $(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
Damien Georged3ebe482014-01-07 15:20:33 +0000129
Damien George136f6752014-01-07 14:54:15 +0000130# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
131$(PY_BUILD)vm.o: $(PY_SRC)/vm.c
Dave Hylands46468012014-01-08 10:15:39 -0800132 $(ECHO) "CC $<"
133 $(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
Damien George136f6752014-01-07 14:54:15 +0000134
135# header dependencies
136
137$(PY_BUILD)parse.o: $(PY_SRC)/grammar.h
138$(PY_BUILD)compile.o: $(PY_SRC)/grammar.h
139$(PY_BUILD)/emitcpy.o: $(PY_SRC)/emit.h
140$(PY_BUILD)emitbc.o: $(PY_SRC)/emit.h