2018-01-19 02:35:42 -05:00
|
|
|
include ../../py/mkenv.mk
|
|
|
|
|
|
|
|
CROSS = 0
|
|
|
|
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
|
|
|
include $(TOP)/py/py.mk
|
2022-06-17 12:11:30 -04:00
|
|
|
include $(TOP)/extmod/extmod.mk
|
2018-01-19 02:35:42 -05:00
|
|
|
|
2021-06-23 20:04:15 -04:00
|
|
|
CC = emcc
|
|
|
|
LD = emcc
|
2018-01-19 02:35:42 -05:00
|
|
|
|
|
|
|
INC += -I.
|
|
|
|
INC += -I$(TOP)
|
|
|
|
INC += -I$(BUILD)
|
|
|
|
|
2021-06-23 20:04:15 -04:00
|
|
|
CFLAGS += -std=c99 -Wall -Werror -Wdouble-promotion -Wfloat-conversion
|
2022-11-06 23:11:14 -05:00
|
|
|
CFLAGS += -Os -DNDEBUG
|
2021-06-23 20:04:15 -04:00
|
|
|
CFLAGS += $(INC)
|
2018-01-19 02:35:42 -05:00
|
|
|
|
2021-07-09 00:19:15 -04:00
|
|
|
SRC_SHARED = $(addprefix shared/,\
|
|
|
|
runtime/interrupt_char.c \
|
|
|
|
runtime/stdout_helpers.c \
|
|
|
|
runtime/pyexec.c \
|
|
|
|
readline/readline.c \
|
2018-01-19 02:35:42 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
|
|
|
mphalport.c \
|
|
|
|
|
2022-07-01 15:06:10 -04:00
|
|
|
SRC_QSTR += $(SRC_C) $(SRC_SHARED)
|
2018-01-19 02:35:42 -05:00
|
|
|
|
2021-06-23 20:04:15 -04:00
|
|
|
OBJ += $(PY_O)
|
2021-07-09 00:19:15 -04:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED:.c=.o))
|
2018-01-19 02:35:42 -05:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
2021-06-23 20:04:15 -04:00
|
|
|
JSFLAGS += -s ASYNCIFY
|
2022-10-27 21:58:05 -04:00
|
|
|
JSFLAGS += -s EXPORTED_FUNCTIONS="['_mp_js_init', '_mp_js_init_repl', '_mp_js_do_str', '_mp_js_process_char', '_mp_hal_get_interrupt_char', '_mp_sched_keyboard_interrupt']"
|
|
|
|
JSFLAGS += -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap', 'FS']"
|
|
|
|
JSFLAGS += -s --memory-init-file 0
|
|
|
|
JSFLAGS += --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)))
|
2022-08-19 09:58:58 -04:00
|
|
|
cd $(TOP)/tests && MICROPY_MICROPYTHON=../ports/webassembly/node_run.sh ./run-tests.py -j1
|
2018-01-19 02:35:42 -05:00
|
|
|
|
|
|
|
include $(TOP)/py/mkrules.mk
|