2014-01-24 09:05:30 +00:00
|
|
|
include ../py/mkenv.mk
|
2014-02-01 18:06:55 +00:00
|
|
|
-include mpconfigport.mk
|
2014-01-24 09:05:30 +00:00
|
|
|
|
2014-01-07 14:54:15 +00:00
|
|
|
# define main target
|
2014-01-20 00:02:39 +00:00
|
|
|
PROG = micropython
|
2014-01-07 14:54:15 +00:00
|
|
|
|
2014-01-21 21:40:13 +00:00
|
|
|
# qstr definitions (must come before including py.mk)
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
2014-01-07 14:54:15 +00:00
|
|
|
# include py core make definitions
|
|
|
|
include ../py/py.mk
|
2013-10-12 14:30:21 +01:00
|
|
|
|
2014-04-16 22:10:33 +01:00
|
|
|
INC = -I.
|
|
|
|
INC += -I$(PY_SRC)
|
2014-04-17 18:03:27 +01:00
|
|
|
INC += -I$(BUILD)
|
2014-04-16 22:10:33 +01:00
|
|
|
|
2014-01-07 14:54:15 +00:00
|
|
|
# compiler settings
|
2014-04-16 22:10:33 +01:00
|
|
|
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT)
|
2014-02-14 22:37:37 +00:00
|
|
|
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
LDFLAGS = $(LDFLAGS_MOD) -lm -Wl,-map,$@.map
|
|
|
|
else
|
|
|
|
LDFLAGS = $(LDFLAGS_MOD) -lm -Wl,-Map=$@.map,--cref
|
|
|
|
endif
|
2014-02-01 18:06:55 +00:00
|
|
|
|
2014-04-16 01:46:01 +01:00
|
|
|
ifeq ($(MICROPY_FORCE_32BIT),1)
|
|
|
|
CFLAGS += -m32
|
|
|
|
LDFLAGS += -m32
|
|
|
|
ifeq ($(MICROPY_MOD_FFI),1)
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
CFLAGS_MOD += -I/usr/include/i686-linux-gnu
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-02-27 16:10:40 +00:00
|
|
|
ifeq ($(MICROPY_USE_READLINE),1)
|
|
|
|
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
|
|
|
|
LDFLAGS_MOD += -lreadline
|
|
|
|
# the following is needed for BSD
|
|
|
|
#LDFLAGS_MOD += -ltermcap
|
|
|
|
endif
|
2014-02-01 22:57:06 +00:00
|
|
|
ifeq ($(MICROPY_MOD_TIME),1)
|
|
|
|
CFLAGS_MOD += -DMICROPY_MOD_TIME=1
|
2014-04-04 18:32:26 +01:00
|
|
|
SRC_MOD += modtime.c
|
2014-02-01 22:57:06 +00:00
|
|
|
endif
|
2014-02-01 18:06:55 +00:00
|
|
|
ifeq ($(MICROPY_MOD_FFI),1)
|
2014-04-20 09:30:46 +01:00
|
|
|
LIBFFI_LDFLAGS_MOD := $(shell pkg-config --libs libffi)
|
|
|
|
LIBFFI_CFLAGS_MOD := $(shell pkg-config --cflags libffi)
|
|
|
|
CFLAGS_MOD += $(LIBFFI_CFLAGS_MOD) -DMICROPY_MOD_FFI=1
|
|
|
|
LDFLAGS_MOD += -ldl $(LIBFFI_LDFLAGS_MOD)
|
2014-04-04 18:32:26 +01:00
|
|
|
SRC_MOD += modffi.c
|
2014-02-01 18:06:55 +00:00
|
|
|
endif
|
|
|
|
|
2013-10-12 14:30:21 +01:00
|
|
|
|
2014-01-26 17:52:23 +00:00
|
|
|
# Debugging/Optimization
|
2014-01-13 13:25:10 +00:00
|
|
|
ifdef DEBUG
|
2014-02-12 18:20:39 +00:00
|
|
|
CFLAGS += -g
|
|
|
|
COPT = -O0
|
2014-01-13 13:25:10 +00:00
|
|
|
else
|
2014-02-12 18:20:39 +00:00
|
|
|
COPT = -Os #-DNDEBUG
|
2014-01-13 13:25:10 +00:00
|
|
|
endif
|
|
|
|
|
2014-01-07 14:54:15 +00:00
|
|
|
# source files
|
2013-10-12 14:30:21 +01:00
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
2014-02-10 22:44:37 +00:00
|
|
|
gccollect.c \
|
2014-01-08 00:52:20 +00:00
|
|
|
file.c \
|
2014-04-04 18:32:26 +01:00
|
|
|
modsocket.c \
|
2014-02-01 18:06:55 +00:00
|
|
|
$(SRC_MOD)
|
2013-10-12 14:30:21 +01:00
|
|
|
|
2014-01-21 21:40:13 +00:00
|
|
|
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
2013-10-12 14:30:21 +01:00
|
|
|
|
2014-01-24 09:05:30 +00:00
|
|
|
include ../py/mkrules.mk
|
2013-12-29 18:01:01 +00:00
|
|
|
|
2014-04-16 20:38:16 +01:00
|
|
|
.PHONY: test
|
|
|
|
|
|
|
|
test: $(PROG) ../tests/run-tests
|
|
|
|
$(eval DIRNAME=$(notdir $(CURDIR)))
|
2014-04-17 01:26:25 +01:00
|
|
|
cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
|