Merge pull request #254 from pfalcon/config-modules

Add mpconfigport.mk file to configure which modules to include into build
This commit is contained in:
Damien George 2014-02-01 10:44:17 -08:00
commit 6fcaea6ca8
3 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,5 @@
include ../py/mkenv.mk include ../py/mkenv.mk
-include mpconfigport.mk
# define main target # define main target
PROG = micropython PROG = micropython
@ -10,9 +11,16 @@ QSTR_DEFS = qstrdefsport.h
include ../py/py.mk include ../py/py.mk
# compiler settings # compiler settings
CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD)
CFLAGS += -I/usr/lib/libffi-3.0.13/include LDFLAGS = $(LDFLAGS_MOD) -lm
LDFLAGS = -lm -ldl -lffi
ifeq ($(MICROPY_MOD_FFI),1)
# Note - include path below is specific to @dpgeorge
CFLAGS_MOD += -I/usr/lib/libffi-3.0.13/include -DMICROPY_MOD_FFI=1
LDFLAGS_MOD += -ldl -lffi
SRC_MOD += ffi.c
endif
# Debugging/Optimization # Debugging/Optimization
ifdef DEBUG ifdef DEBUG
@ -26,7 +34,7 @@ SRC_C = \
main.c \ main.c \
file.c \ file.c \
socket.c \ socket.c \
ffi.c \ $(SRC_MOD)
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
LIB = -lreadline LIB = -lreadline

View File

@ -242,7 +242,9 @@ int main(int argc, char **argv) {
file_init(); file_init();
rawsocket_init(); rawsocket_init();
#if MICROPY_MOD_FFI
ffi_init(); ffi_init();
#endif
// Here is some example code to create a class and instance of that class. // Here is some example code to create a class and instance of that class.
// First is the Python, then the C code. // First is the Python, then the C code.

4
unix/mpconfigport.mk Normal file
View File

@ -0,0 +1,4 @@
# Enable/disable modules to be included in interpreter
# ffi module requires libffi (libffi-dev Debian package)
MICROPY_MOD_FFI = 0