2016-02-11 22:37:26 +00:00
|
|
|
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
|
2017-08-11 02:22:19 +00:00
|
|
|
include $(TOP)/py/py.mk
|
2016-02-11 22:37:26 +00:00
|
|
|
|
2018-07-10 04:11:28 +00:00
|
|
|
INC += -I.
|
2016-02-11 22:37:26 +00:00
|
|
|
INC += -I$(BUILD)
|
2018-07-10 04:11:28 +00:00
|
|
|
INC += -I$(TOP)
|
2016-02-11 22:37:26 +00:00
|
|
|
|
|
|
|
# compiler settings
|
|
|
|
CWARN = -Wall -Werror
|
2020-10-03 09:29:16 +00:00
|
|
|
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith
|
2017-03-05 12:28:27 +00:00
|
|
|
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
2016-02-11 22:37:26 +00:00
|
|
|
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.
|
2017-06-30 07:22:17 +00:00
|
|
|
# The unix port of MicroPython on OSX must be compiled with clang,
|
2017-07-19 03:12:10 +00:00
|
|
|
# while cross-compile ports require gcc, so we test here for OSX and
|
2016-02-11 22:37:26 +00:00
|
|
|
# if necessary override the value of 'CC' set in py/mkenv.mk
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
CC = clang
|
|
|
|
# Use clang syntax for map file
|
2016-07-08 23:02:02 +00:00
|
|
|
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
|
2016-02-11 22:37:26 +00:00
|
|
|
else
|
|
|
|
# Use gcc syntax for map file
|
2016-07-08 23:02:02 +00:00
|
|
|
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
2016-02-11 22:37:26 +00:00
|
|
|
endif
|
|
|
|
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
|
|
|
|
|
|
|
# source files
|
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
|
|
|
gccollect.c \
|
2021-07-09 04:19:15 +00:00
|
|
|
shared/runtime/gchelper_generic.c \
|
2016-02-11 22:37:26 +00:00
|
|
|
|
2016-08-10 08:19:16 +00:00
|
|
|
# Add fmode when compiling with mingw gcc
|
|
|
|
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
|
|
|
|
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
|
2017-09-06 04:09:13 +00:00
|
|
|
SRC_C += ports/windows/fmode.c
|
2016-07-22 09:54:26 +00:00
|
|
|
endif
|
|
|
|
|
2018-07-10 04:11:28 +00:00
|
|
|
OBJ = $(PY_CORE_O)
|
2016-02-11 22:37:26 +00:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
2017-08-11 02:22:19 +00:00
|
|
|
include $(TOP)/py/mkrules.mk
|