From 7f7c7aa76a34adbdb36a82c5a5c8b93805faee0b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 20 Apr 2014 22:20:48 +0300 Subject: [PATCH] windows: Unbreak mingw32 build (cross-compiling under Linux). --- windows/Makefile | 23 +++++++++++++++-------- windows/mpconfigport.h | 4 ++-- windows/mpconfigport.mk | 13 +++++++++++++ 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 windows/mpconfigport.mk diff --git a/windows/Makefile b/windows/Makefile index 651de7c7f1..2f5418886f 100644 --- a/windows/Makefile +++ b/windows/Makefile @@ -1,4 +1,5 @@ include ../py/mkenv.mk +-include mpconfigport.mk # define main target PROG = micropython.exe @@ -14,14 +15,15 @@ INC += -I$(PY_SRC) INC += -I$(BUILD) # compiler settings -CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX -LDFLAGS = -lm +CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) +LDFLAGS = $(LDFLAGS_MOD) -lm # Debugging/Optimization ifdef DEBUG -CFLAGS += -O0 -g +CFLAGS += -g +COPT = -O0 else -CFLAGS += -Os #-DNDEBUG +COPT = -Os #-DNDEBUG endif # source files @@ -30,11 +32,16 @@ SRC_C = \ unix/file.c \ OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -LIB = -lreadline -LIB += -lws2_32 -LIB += -lmman + +ifeq ($(MICROPY_USE_READLINE),1) +CFLAGS_MOD += -DMICROPY_USE_READLINE=1 +LDFLAGS_MOD += -lreadline # the following is needed for BSD -#LIB += -ltermcap +#LDFLAGS_MOD += -ltermcap +endif + +LIB += -lws2_32 +#LIB += -lmman include ../py/mkrules.mk diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h index 74fe749e1e..993fef9d59 100644 --- a/windows/mpconfigport.h +++ b/windows/mpconfigport.h @@ -2,10 +2,10 @@ // Linking with GNU readline causes binary to be licensed under GPL #ifndef MICROPY_USE_READLINE -#define MICROPY_USE_READLINE (1) +#define MICROPY_USE_READLINE (0) #endif -#define MICROPY_EMIT_X64 (1) +#define MICROPY_EMIT_X64 (0) #define MICROPY_EMIT_THUMB (0) #define MICROPY_EMIT_INLINE_THUMB (0) #define MICROPY_MEM_STATS (1) diff --git a/windows/mpconfigport.mk b/windows/mpconfigport.mk new file mode 100644 index 0000000000..458f23dd1e --- /dev/null +++ b/windows/mpconfigport.mk @@ -0,0 +1,13 @@ +# Enable/disable modules and 3rd-party libs to be included in interpreter + +# Build 32-bit binaries on a 64-bit host +MICROPY_FORCE_32BIT = 0 + +# Linking with GNU readline causes binary to be licensed under GPL +MICROPY_USE_READLINE = 0 + +# Subset of CPython time module +MICROPY_MOD_TIME = 1 + +# ffi module requires libffi (libffi-dev Debian package) +MICROPY_MOD_FFI = 0