Skip to content

Commit 7f7c7aa

Browse files
committed
windows: Unbreak mingw32 build (cross-compiling under Linux).
1 parent a196d08 commit 7f7c7aa

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

windows/Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include ../py/mkenv.mk
2+
-include mpconfigport.mk
23

34
# define main target
45
PROG = micropython.exe
@@ -14,14 +15,15 @@ INC += -I$(PY_SRC)
1415
INC += -I$(BUILD)
1516

1617
# compiler settings
17-
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX
18-
LDFLAGS = -lm
18+
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT)
19+
LDFLAGS = $(LDFLAGS_MOD) -lm
1920

2021
# Debugging/Optimization
2122
ifdef DEBUG
22-
CFLAGS += -O0 -g
23+
CFLAGS += -g
24+
COPT = -O0
2325
else
24-
CFLAGS += -Os #-DNDEBUG
26+
COPT = -Os #-DNDEBUG
2527
endif
2628

2729
# source files
@@ -30,11 +32,16 @@ SRC_C = \
3032
unix/file.c \
3133

3234
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
33-
LIB = -lreadline
34-
LIB += -lws2_32
35-
LIB += -lmman
35+
36+
ifeq ($(MICROPY_USE_READLINE),1)
37+
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
38+
LDFLAGS_MOD += -lreadline
3639
# the following is needed for BSD
37-
#LIB += -ltermcap
40+
#LDFLAGS_MOD += -ltermcap
41+
endif
42+
43+
LIB += -lws2_32
44+
#LIB += -lmman
3845

3946
include ../py/mkrules.mk
4047

windows/mpconfigport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
// Linking with GNU readline causes binary to be licensed under GPL
44
#ifndef MICROPY_USE_READLINE
5-
#define MICROPY_USE_READLINE (1)
5+
#define MICROPY_USE_READLINE (0)
66
#endif
77

8-
#define MICROPY_EMIT_X64 (1)
8+
#define MICROPY_EMIT_X64 (0)
99
#define MICROPY_EMIT_THUMB (0)
1010
#define MICROPY_EMIT_INLINE_THUMB (0)
1111
#define MICROPY_MEM_STATS (1)

windows/mpconfigport.mk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Enable/disable modules and 3rd-party libs to be included in interpreter
2+
3+
# Build 32-bit binaries on a 64-bit host
4+
MICROPY_FORCE_32BIT = 0
5+
6+
# Linking with GNU readline causes binary to be licensed under GPL
7+
MICROPY_USE_READLINE = 0
8+
9+
# Subset of CPython time module
10+
MICROPY_MOD_TIME = 1
11+
12+
# ffi module requires libffi (libffi-dev Debian package)
13+
MICROPY_MOD_FFI = 0

0 commit comments

Comments
 (0)