2016-02-11 17:37:26 -05:00
|
|
|
include ../py/mkenv.mk
|
|
|
|
|
|
|
|
# define main target
|
2023-10-05 17:00:19 -04:00
|
|
|
PROG ?= mpy-cross
|
2016-02-11 17:37:26 -05:00
|
|
|
|
|
|
|
# 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-10 22:22:19 -04:00
|
|
|
include $(TOP)/py/py.mk
|
2016-02-11 17:37:26 -05:00
|
|
|
|
2018-07-10 00:11:28 -04:00
|
|
|
INC += -I.
|
2016-02-11 17:37:26 -05:00
|
|
|
INC += -I$(BUILD)
|
2018-07-10 00:11:28 -04:00
|
|
|
INC += -I$(TOP)
|
2016-02-11 17:37:26 -05:00
|
|
|
|
|
|
|
# compiler settings
|
|
|
|
CWARN = -Wall -Werror
|
2020-10-03 05:29:16 -04:00
|
|
|
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith
|
extmod: Make extmod.mk self-contained.
This makes it so that all a port needs to do is set the relevant variables
and "include extmod.mk" and doesn't need to worry about adding anything to
OBJ, CFLAGS, SRC_QSTR, etc.
Make all extmod variables (src, flags, etc) private to extmod.mk.
Also move common/shared, extmod-related fragments (e.g. wiznet, cyw43,
bluetooth) into extmod.mk.
Now that SRC_MOD, CFLAGS_MOD, CXXFLAGS_MOD are unused by both extmod.mk
(and user-C-modules in a previous commit), remove all uses of them from
port makefiles.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-08 08:59:08 -04:00
|
|
|
CFLAGS += $(INC) $(CWARN) -std=gnu99 $(COPT) $(CFLAGS_EXTRA)
|
2016-02-11 17:37:26 -05:00
|
|
|
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
|
2023-09-20 12:22:51 -04:00
|
|
|
CFLAGS += -DCIRCUITPY
|
2016-02-11 17:37:26 -05:00
|
|
|
|
|
|
|
# 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 03:22:17 -04:00
|
|
|
# The unix port of MicroPython on OSX must be compiled with clang,
|
2016-02-11 17:37:26 -05:00
|
|
|
# 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
|
2016-07-08 19:02:02 -04:00
|
|
|
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
|
2016-02-11 17:37:26 -05:00
|
|
|
else
|
|
|
|
# Use gcc syntax for map file
|
2016-07-08 19:02:02 -04:00
|
|
|
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
2016-02-11 17:37:26 -05:00
|
|
|
endif
|
2022-07-23 01:38:32 -04:00
|
|
|
LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
2016-02-11 17:37:26 -05:00
|
|
|
|
|
|
|
# source files
|
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
|
|
|
gccollect.c \
|
2021-07-09 00:19:15 -04:00
|
|
|
shared/runtime/gchelper_generic.c \
|
2023-09-20 12:46:03 -04:00
|
|
|
supervisor/stub/safe_mode.c \
|
|
|
|
supervisor/stub/stack.c \
|
|
|
|
supervisor/shared/translate/translate.c
|
2016-02-11 17:37:26 -05:00
|
|
|
|
2016-08-10 04:19:16 -04:00
|
|
|
# Add fmode when compiling with mingw gcc
|
|
|
|
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
|
|
|
|
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
|
2023-10-06 16:41:38 -04:00
|
|
|
SRC_C += windows-fmode.c
|
2016-07-22 05:54:26 -04:00
|
|
|
endif
|
|
|
|
|
2018-07-10 00:11:28 -04:00
|
|
|
OBJ = $(PY_CORE_O)
|
2016-02-11 17:37:26 -05:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
2023-10-20 14:02:12 -04:00
|
|
|
# CIRCUITPY
|
2023-09-20 12:46:03 -04:00
|
|
|
$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compressed_translations.generated.h
|
2023-10-20 14:02:12 -04:00
|
|
|
CIRCUITPY_MESSAGE_COMPRESSION_LEVEL = 1
|
2023-09-20 12:46:03 -04:00
|
|
|
|
2017-08-10 22:22:19 -04:00
|
|
|
include $(TOP)/py/mkrules.mk
|