2013-12-29 13:01:01 -05:00
|
|
|
PYSRC=../py
|
|
|
|
BUILD=build
|
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
CFLAGS = -I. -I$(PYSRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG
|
|
|
|
LDFLAGS = -lm
|
|
|
|
|
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
|
|
|
|
|
|
|
PY_O = \
|
2013-12-30 07:52:32 -05:00
|
|
|
nlrx86.o \
|
2013-12-29 13:01:01 -05:00
|
|
|
nlrx64.o \
|
|
|
|
malloc.o \
|
|
|
|
qstr.o \
|
|
|
|
vstr.o \
|
2013-12-30 13:23:50 -05:00
|
|
|
unicode.o \
|
2013-12-29 13:01:01 -05:00
|
|
|
lexer.o \
|
|
|
|
lexerunix.o \
|
|
|
|
parse.o \
|
|
|
|
scope.o \
|
|
|
|
compile.o \
|
|
|
|
emitcommon.o \
|
|
|
|
emitpass1.o \
|
|
|
|
emitcpy.o \
|
|
|
|
runtime.o \
|
|
|
|
map.o \
|
|
|
|
obj.o \
|
|
|
|
objbool.o \
|
|
|
|
objboundmeth.o \
|
|
|
|
objcell.o \
|
|
|
|
objclass.o \
|
|
|
|
objclosure.o \
|
|
|
|
objcomplex.o \
|
|
|
|
objdict.o \
|
|
|
|
objexcept.o \
|
|
|
|
objfloat.o \
|
|
|
|
objfun.o \
|
|
|
|
objgenerator.o \
|
|
|
|
objinstance.o \
|
2014-01-04 15:21:15 -05:00
|
|
|
objint.o \
|
2013-12-29 13:01:01 -05:00
|
|
|
objlist.o \
|
2014-01-02 16:30:26 -05:00
|
|
|
objmodule.o \
|
2013-12-29 13:01:01 -05:00
|
|
|
objnone.o \
|
|
|
|
objrange.o \
|
|
|
|
objset.o \
|
2014-01-02 19:41:17 -05:00
|
|
|
objslice.o \
|
2013-12-29 13:01:01 -05:00
|
|
|
objstr.o \
|
|
|
|
objtuple.o \
|
|
|
|
objtype.o \
|
|
|
|
builtin.o \
|
2014-01-03 09:03:48 -05:00
|
|
|
builtinimport.o \
|
2013-12-29 13:01:01 -05:00
|
|
|
vm.o \
|
|
|
|
showbc.o \
|
|
|
|
repl.o \
|
|
|
|
|
|
|
|
OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(PY_O))
|
|
|
|
LIB =
|
|
|
|
PROG = cpy
|
|
|
|
|
|
|
|
$(PROG): $(BUILD) $(OBJ)
|
|
|
|
$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
|
|
|
|
|
|
|
|
$(BUILD):
|
2013-12-30 07:52:32 -05:00
|
|
|
mkdir -p $@
|
2013-12-29 13:01:01 -05:00
|
|
|
|
|
|
|
$(BUILD)/%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
2013-12-30 07:52:32 -05:00
|
|
|
$(BUILD)/%.o: $(PYSRC)/%.S
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2013-12-29 13:01:01 -05:00
|
|
|
|
2014-01-03 13:48:53 -05:00
|
|
|
$(BUILD)/%.o: $(PYSRC)/%.c mpconfigport.h
|
2013-12-29 13:01:01 -05:00
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
$(BUILD)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h
|
|
|
|
$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
|
|
|
|
|
|
|
|
$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h
|
|
|
|
$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
|
|
|
|
|
|
|
|
# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
|
|
|
|
$(BUILD)/vm.o: $(PYSRC)/vm.c
|
|
|
|
$(CC) $(CFLAGS) -O3 -c -o $@ $<
|
|
|
|
|
2014-01-03 13:48:53 -05:00
|
|
|
$(BUILD)/main.o: mpconfigport.h
|
2013-12-29 13:01:01 -05:00
|
|
|
$(BUILD)/parse.o: $(PYSRC)/grammar.h
|
|
|
|
$(BUILD)/compile.o: $(PYSRC)/grammar.h
|
|
|
|
$(BUILD)/emitcpy.o: $(PYSRC)/emit.h
|
|
|
|
$(BUILD)/emitbc.o: $(PYSRC)/emit.h
|
|
|
|
|
|
|
|
clean:
|
2013-12-30 14:02:10 -05:00
|
|
|
/bin/rm -rf $(BUILD)
|
2013-12-29 13:01:01 -05:00
|
|
|
|
|
|
|
.PHONY: clean
|