diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-02-01 20:06:55 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-02-01 20:09:45 +0200 |
commit | ed1239fce60f8cfe710637a5e0591f2b2a64b65d (patch) | |
tree | 4fad2f82e1a97c7b6da705ddd46baea42380a237 /unix | |
parent | 382b3d00ed9a2f31dcedbf65ce82cbada9b6dbdf (diff) | |
download | micropython-ed1239fce60f8cfe710637a5e0591f2b2a64b65d.tar.gz micropython-ed1239fce60f8cfe710637a5e0591f2b2a64b65d.zip |
Add mpconfigport.mk file to configure which modules to include into build.
Proof of concept, controls "ffi" module as one which requires external
dependencies.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile | 16 | ||||
-rw-r--r-- | unix/main.c | 2 | ||||
-rw-r--r-- | unix/mpconfigport.mk | 4 |
3 files changed, 18 insertions, 4 deletions
diff --git a/unix/Makefile b/unix/Makefile index db01ccf9af..2d959bf73d 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -1,4 +1,5 @@ include ../py/mkenv.mk +-include mpconfigport.mk # define main target PROG = micropython @@ -10,9 +11,16 @@ QSTR_DEFS = qstrdefsport.h include ../py/py.mk # compiler settings -CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX -CFLAGS += -I/usr/lib/libffi-3.0.13/include -LDFLAGS = -lm -ldl -lffi +CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) +LDFLAGS = $(LDFLAGS_MOD) -lm + +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 ifdef DEBUG @@ -26,7 +34,7 @@ SRC_C = \ main.c \ file.c \ socket.c \ - ffi.c \ + $(SRC_MOD) OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) LIB = -lreadline diff --git a/unix/main.c b/unix/main.c index cd45e3be86..5ca8115368 100644 --- a/unix/main.c +++ b/unix/main.c @@ -242,7 +242,9 @@ int main(int argc, char **argv) { file_init(); rawsocket_init(); +#if MICROPY_MOD_FFI ffi_init(); +#endif // Here is some example code to create a class and instance of that class. // First is the Python, then the C code. diff --git a/unix/mpconfigport.mk b/unix/mpconfigport.mk new file mode 100644 index 0000000000..d220339397 --- /dev/null +++ b/unix/mpconfigport.mk @@ -0,0 +1,4 @@ +# Enable/disable modules to be included in interpreter + +# ffi module requires libffi (libffi-dev Debian package) +MICROPY_MOD_FFI = 0 |