2014-01-08 13:15:39 -05:00
|
|
|
##########
|
|
|
|
# The following should eventually go into a more central location
|
|
|
|
# when a reorg is done.
|
|
|
|
#
|
|
|
|
# Turn on increased build verbosity by defining BUILD_VERBOSE in your main
|
|
|
|
# Makefile or in your environment. You can also use V=1 on the make command
|
|
|
|
# line.
|
|
|
|
ifeq ("$(origin V)", "command line")
|
|
|
|
BUILD_VERBOSE=$(V)
|
|
|
|
endif
|
|
|
|
ifndef BUILD_VERBOSE
|
|
|
|
BUILD_VERBOSE = 0
|
|
|
|
endif
|
|
|
|
ifeq ($(BUILD_VERBOSE),0)
|
|
|
|
Q = @
|
|
|
|
else
|
|
|
|
Q =
|
|
|
|
endif
|
|
|
|
# Since this is a new feature, advertise it
|
|
|
|
ifeq ($(BUILD_VERBOSE),0)
|
|
|
|
$(info Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.)
|
|
|
|
endif
|
|
|
|
#
|
|
|
|
#########
|
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
# default settings; can be overriden in main Makefile
|
|
|
|
|
2014-01-21 16:40:13 -05:00
|
|
|
PY_SRC ?= ../py
|
|
|
|
BUILD ?= build
|
2014-01-07 09:54:15 -05:00
|
|
|
|
|
|
|
# to create the build directory
|
|
|
|
|
|
|
|
$(BUILD):
|
2014-01-08 13:15:39 -05:00
|
|
|
$(Q)mkdir -p $@
|
2014-01-07 09:54:15 -05:00
|
|
|
|
|
|
|
# where py object files go (they have a name prefix to prevent filename clashes)
|
|
|
|
|
|
|
|
PY_BUILD = $(BUILD)/py.
|
|
|
|
|
2014-01-21 16:40:13 -05:00
|
|
|
# file containing qstr defs for the core Python bit
|
|
|
|
|
|
|
|
PY_QSTR_DEFS = $(PY_SRC)/qstrdefs.h
|
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
# py object files
|
|
|
|
|
|
|
|
PY_O_BASENAME = \
|
|
|
|
nlrx86.o \
|
|
|
|
nlrx64.o \
|
|
|
|
nlrthumb.o \
|
|
|
|
malloc.o \
|
2014-01-07 10:20:33 -05:00
|
|
|
gc.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
qstr.o \
|
|
|
|
vstr.o \
|
|
|
|
unicode.o \
|
|
|
|
lexer.o \
|
2014-01-08 10:28:26 -05:00
|
|
|
lexerstr.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
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 \
|
2014-01-14 08:39:05 -05:00
|
|
|
strtonum.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
obj.o \
|
2014-01-18 12:24:47 -05:00
|
|
|
objarray.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
objbool.o \
|
|
|
|
objboundmeth.o \
|
|
|
|
objcell.o \
|
|
|
|
objclosure.o \
|
|
|
|
objcomplex.o \
|
|
|
|
objdict.o \
|
2014-01-14 18:55:01 -05:00
|
|
|
objenumerate.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
objexcept.o \
|
2014-01-14 20:37:08 -05:00
|
|
|
objfilter.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
objfloat.o \
|
|
|
|
objfun.o \
|
|
|
|
objgenerator.o \
|
|
|
|
objint.o \
|
2014-01-17 13:01:36 -05:00
|
|
|
objint_longlong.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
objlist.o \
|
2014-01-14 20:10:09 -05:00
|
|
|
objmap.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
objmodule.o \
|
|
|
|
objnone.o \
|
|
|
|
objrange.o \
|
|
|
|
objset.o \
|
|
|
|
objslice.o \
|
|
|
|
objstr.o \
|
|
|
|
objtuple.o \
|
|
|
|
objtype.o \
|
2014-01-21 16:40:13 -05:00
|
|
|
objzip.o \
|
2014-01-20 17:19:19 -05:00
|
|
|
sequence.o \
|
2014-01-07 19:43:48 -05:00
|
|
|
stream.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
builtin.o \
|
|
|
|
builtinimport.o \
|
2014-01-15 17:14:03 -05:00
|
|
|
builtineval.o \
|
2014-01-19 18:53:15 -05:00
|
|
|
builtinmp.o \
|
2014-01-07 09:54:15 -05:00
|
|
|
vm.o \
|
|
|
|
showbc.o \
|
|
|
|
repl.o \
|
|
|
|
|
|
|
|
# prepend the build destination prefix to the py object files
|
|
|
|
|
|
|
|
PY_O = $(addprefix $(PY_BUILD), $(PY_O_BASENAME))
|
|
|
|
|
2014-01-21 16:40:13 -05:00
|
|
|
# qstr data
|
|
|
|
|
|
|
|
$(PY_BUILD)qstr.o: $(PY_BUILD)qstrdefs.generated.h
|
|
|
|
|
|
|
|
$(PY_BUILD)qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqstrdata.py
|
|
|
|
$(ECHO) "makeqstrdata $(PY_QSTR_DEFS) $(QSTR_DEFS)"
|
|
|
|
$(Q)python $(PY_SRC)/makeqstrdata.py $(PY_QSTR_DEFS) $(QSTR_DEFS) > $@
|
|
|
|
|
|
|
|
# emitters
|
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
$(PY_BUILD)emitnx64.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
|
2014-01-08 13:15:39 -05:00
|
|
|
$(ECHO) "CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
|
2014-01-07 09:54:15 -05:00
|
|
|
|
|
|
|
$(PY_BUILD)emitnthumb.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
|
2014-01-08 13:15:39 -05:00
|
|
|
$(ECHO) "CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
|
2014-01-07 09:54:15 -05:00
|
|
|
|
2014-01-21 16:40:13 -05:00
|
|
|
# general source files
|
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
$(PY_BUILD)%.o: $(PY_SRC)/%.S
|
2014-01-08 13:15:39 -05:00
|
|
|
$(ECHO) "CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
2014-01-07 09:54:15 -05:00
|
|
|
|
2014-01-21 16:40:13 -05:00
|
|
|
$(PY_BUILD)%.o: $(PY_SRC)/%.c mpconfigport.h $(PY_SRC)/qstr.h $(PY_QSTR_DEFS) $(QSTR_DEFS)
|
2014-01-08 13:15:39 -05:00
|
|
|
$(ECHO) "CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
2014-01-07 09:54:15 -05:00
|
|
|
|
2014-01-07 10:20:33 -05:00
|
|
|
# optimising gc for speed; 5ms down to 4ms on pybv2
|
|
|
|
$(PY_BUILD)gc.o: $(PY_SRC)/gc.c
|
2014-01-08 13:15:39 -05:00
|
|
|
$(ECHO) "CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
|
2014-01-07 10:20:33 -05:00
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
|
|
|
|
$(PY_BUILD)vm.o: $(PY_SRC)/vm.c
|
2014-01-08 13:15:39 -05:00
|
|
|
$(ECHO) "CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
|
2014-01-07 09:54:15 -05:00
|
|
|
|
|
|
|
# header dependencies
|
|
|
|
|
|
|
|
$(PY_BUILD)parse.o: $(PY_SRC)/grammar.h
|
|
|
|
$(PY_BUILD)compile.o: $(PY_SRC)/grammar.h
|
2014-01-21 16:40:13 -05:00
|
|
|
$(PY_BUILD)emitcpy.o: $(PY_SRC)/emit.h
|
2014-01-07 09:54:15 -05:00
|
|
|
$(PY_BUILD)emitbc.o: $(PY_SRC)/emit.h
|