37b143ce9e
When compiling with msys2's gcc there's no need to apply the binary fmode so adjust the Makefile to reflect that. When compiling with mingw we need to include malloc.h since there is no alloca.h, and the 64bit detection in mpconfigport.h needs some adjustment.
62 lines
1.4 KiB
Makefile
62 lines
1.4 KiB
Makefile
include ../py/mkenv.mk
|
|
|
|
# define main target
|
|
PROG = mpy-cross
|
|
|
|
# qstr definitions (must come before including py.mk)
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
# OS name, for simple autoconfig
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
# include py core make definitions
|
|
include ../py/py.mk
|
|
|
|
INC += -I.
|
|
INC += -I..
|
|
INC += -I$(BUILD)
|
|
|
|
# compiler settings
|
|
CWARN = -Wall -Werror
|
|
CWARN += -Wpointer-arith -Wuninitialized
|
|
CFLAGS = $(INC) $(CWARN) -ansi -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
|
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
|
|
|
|
# Debugging/Optimization
|
|
ifdef DEBUG
|
|
CFLAGS += -g
|
|
COPT = -O0
|
|
else
|
|
COPT = -Os #-DNDEBUG
|
|
endif
|
|
|
|
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
|
|
# The unix port of micropython on OSX must be compiled with clang,
|
|
# while cross-compile ports require gcc, so we test here for OSX and
|
|
# if necessary override the value of 'CC' set in py/mkenv.mk
|
|
ifeq ($(UNAME_S),Darwin)
|
|
CC = clang
|
|
# Use clang syntax for map file
|
|
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
|
|
else
|
|
# Use gcc syntax for map file
|
|
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
|
endif
|
|
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
|
|
|
# source files
|
|
SRC_C = \
|
|
main.c \
|
|
gccollect.c \
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
ifeq (,$(findstring MSYS,$(UNAME_S)))
|
|
SRC_C += windows/fmode.c
|
|
endif
|
|
endif
|
|
|
|
OBJ = $(PY_O)
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
include ../py/mkrules.mk
|