@@ -11,84 +11,4 @@ override undefine BUILD
1111override undefine PROG
1212endif
1313
14- include ../py/mkenv.mk
15-
16- # define main target
17-
18- ifeq ($(OS ) ,Windows_NT)
19- # Detect a MINGW32 build, and change the name of the final executable.
20- PROG = mpy-cross.exe
21- else
22- PROG = mpy-cross
23- endif
24-
25- # qstr definitions (must come before including py.mk)
26- QSTR_DEFS = qstrdefsport.h
27-
28- # OS name, for simple autoconfig
29- UNAME_S := $(shell uname -s)
30-
31- # include py core make definitions
32- include $(TOP ) /py/py.mk
33-
34- INC += -I.
35- INC += -I$(TOP )
36- INC += -I$(BUILD )
37-
38- # compiler settings
39- CWARN = -Wall -Werror
40- CWARN += -Wpointer-arith -Wuninitialized
41- CFLAGS = $(INC ) $(CWARN ) -std=gnu99 $(CFLAGS_MOD ) $(COPT ) $(CFLAGS_EXTRA )
42- CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
43-
44- # Build a static executable.
45- # Useful for Windows builds, etc., that must run on multiple operating system versions.
46- ifdef STATIC_BUILD
47- CFLAGS += -static -static-libgcc -static-libstdc++
48- endif
49-
50-
51- # Debugging/Optimization
52- ifdef DEBUG
53- CFLAGS += -g
54- COPT = -O0
55- else
56- COPT = -Os # -DNDEBUG
57- endif
58-
59- # On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
60- # The unix port of MicroPython on OSX must be compiled with clang,
61- # while cross-compile ports require gcc, so we test here for OSX and
62- # if necessary override the value of 'CC' set in py/mkenv.mk
63- ifeq ($(UNAME_S ) ,Darwin)
64- CC = clang
65- # Use clang syntax for map file
66- LDFLAGS_ARCH = -Wl,-map,$@ .map -Wl,-dead_strip
67- else
68- # Use gcc syntax for map file
69- LDFLAGS_ARCH = -Wl,-Map=$@ .map,--cref -Wl,--gc-sections
70- endif
71- LDFLAGS = $(LDFLAGS_MOD ) $(LDFLAGS_ARCH ) -lm $(LDFLAGS_EXTRA )
72-
73- ifdef STATIC_BUILD
74- LDFLAGS += -static -static-libgcc -static-libstdc++
75- endif
76-
77- # source files
78- SRC_C = \
79- main.c \
80- gccollect.c \
81- supervisor/stub/safe_mode.c \
82- supervisor/stub/stack.c \
83- supervisor/shared/translate.c
84-
85- # Add fmode when compiling with mingw gcc
86- COMPILER_TARGET := $(shell $(CC ) -dumpmachine)
87- ifneq (,$(findstring mingw,$(COMPILER_TARGET ) ) )
88- SRC_C += ports/windows/fmode.c
89- endif
90-
91- OBJ = $(PY_O )
92- OBJ += $(addprefix $(BUILD ) /, $(SRC_C:.c=.o ) )
93-
94- include $(TOP ) /py/mkrules.mk
14+ include mpy-cross.mk
0 commit comments