2018-01-19 02:35:42 -05:00
|
|
|
include ../../py/mkenv.mk
|
|
|
|
|
|
|
|
CROSS = 0
|
|
|
|
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
|
|
|
include $(TOP)/py/py.mk
|
|
|
|
|
|
|
|
CC = emcc -g4
|
|
|
|
LD = emcc -g4
|
|
|
|
|
|
|
|
INC += -I.
|
|
|
|
INC += -I$(TOP)
|
|
|
|
INC += -I$(BUILD)
|
|
|
|
|
|
|
|
CPP = clang -E
|
2019-02-10 10:29:25 -05:00
|
|
|
|
|
|
|
ifdef EMSCRIPTEN
|
|
|
|
CPP += -isystem $(EMSCRIPTEN)/system/include/libc -cxx-isystem $(EMSCRIPTEN)/system/include/libcxx
|
|
|
|
endif
|
|
|
|
|
2020-04-09 07:59:11 -04:00
|
|
|
CFLAGS = -m32 -Wall -Werror -Wdouble-promotion -Wfloat-conversion $(INC) -std=c99 $(COPT)
|
2018-01-19 02:35:42 -05:00
|
|
|
LDFLAGS = -m32 -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
|
|
|
|
|
|
|
CFLAGS += -O0 -DNDEBUG
|
|
|
|
CFLAGS += -fdata-sections -ffunction-sections
|
|
|
|
|
2019-07-08 03:45:02 -04:00
|
|
|
ifneq ($(FROZEN_MPY_DIR),)
|
|
|
|
# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and
|
|
|
|
# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch).
|
|
|
|
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
|
|
|
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
|
|
|
endif
|
|
|
|
|
2018-01-19 02:35:42 -05:00
|
|
|
SRC_LIB = $(addprefix lib/,\
|
|
|
|
utils/interrupt_char.c \
|
|
|
|
utils/stdout_helpers.c \
|
|
|
|
utils/pyexec.c \
|
|
|
|
mp-readline/readline.c \
|
|
|
|
)
|
|
|
|
|
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
|
|
|
mphalport.c \
|
|
|
|
modutime.c \
|
|
|
|
|
|
|
|
SRC_QSTR += $(SRC_C)
|
|
|
|
|
|
|
|
OBJ =
|
|
|
|
OBJ = $(PY_O)
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
2019-04-28 08:17:42 -04:00
|
|
|
JSFLAGS = -O0 -s EXPORTED_FUNCTIONS="['_mp_js_init', '_mp_js_init_repl', '_mp_js_do_str', '_mp_js_process_char', '_mp_hal_get_interrupt_char', '_mp_keyboard_interrupt']" -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']" -s "BINARYEN_TRAP_MODE='clamp'" --memory-init-file 0 --js-library library.js
|
2018-01-19 02:35:42 -05:00
|
|
|
|
|
|
|
all: $(BUILD)/micropython.js
|
|
|
|
|
|
|
|
$(BUILD)/micropython.js: $(OBJ) library.js wrapper.js
|
|
|
|
$(ECHO) "LINK $(BUILD)/firmware.js"
|
|
|
|
$(Q)emcc $(LDFLAGS) -o $(BUILD)/firmware.js $(OBJ) $(JSFLAGS)
|
2019-02-10 10:29:25 -05:00
|
|
|
cat wrapper.js $(BUILD)/firmware.js > $@
|
2018-01-19 02:35:42 -05:00
|
|
|
|
|
|
|
min: $(BUILD)/micropython.js
|
|
|
|
uglifyjs $< -c -o $(BUILD)/micropython.min.js
|
|
|
|
|
2021-03-11 00:09:27 -05:00
|
|
|
test: $(BUILD)/micropython.js $(TOP)/tests/run-tests.py
|
2018-01-19 02:35:42 -05:00
|
|
|
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
|
2021-03-11 00:09:27 -05:00
|
|
|
cd $(TOP)/tests && MICROPY_MICROPYTHON=../ports/javascript/node_run.sh ./run-tests.py
|
2018-01-19 02:35:42 -05:00
|
|
|
|
|
|
|
include $(TOP)/py/mkrules.mk
|