29
29
COPT = -Os # -DNDEBUG
30
30
endif
31
31
32
- LDFLAGS = $(LDFLAGS_MOD ) -lm -Wl,-Map=$@ .map,--cref $(LDFLAGS_EXTRA )
32
+ # On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
33
+ # The unix port of micropython on OSX must be compiled with clang,
34
+ # while cross-compile ports require gcc, so we test here for OSX and
35
+ # if necessary override the value of 'CC' set in py/mkenv.mk
36
+ ifeq ($(UNAME_S ) ,Darwin)
37
+ CC = clang
38
+ # Use clang syntax for map file and set osx specific flags
39
+ LDFLAGS_ARCH = -Wl,-order_file,$(BUILD ) /order.def -Wl,-map,$@ .map
40
+ else
41
+ # Use gcc syntax for map file
42
+ LDFLAGS_ARCH = -Wl,-Map=$@ .map,--cref
43
+ endif
44
+ LDFLAGS = $(LDFLAGS_MOD ) $(LDFLAGS_ARCH ) -lm $(LDFLAGS_EXTRA )
33
45
34
46
ifeq ($(MICROPY_FORCE_32BIT ) ,1)
35
47
CFLAGS += -m32
@@ -79,9 +91,6 @@ SRC_C = \
79
91
$(SRC_MOD )
80
92
81
93
ifeq ($(UNAME_S ) ,Darwin)
82
-
83
- LDFLAGS+ = -Wl,-order_file,$(BUILD ) /order.def
84
-
85
94
# Must be the last file in list of sources
86
95
SRC_C += seg_helpers.c
87
96
@@ -92,7 +101,7 @@ seg_helpers.c: $(BUILD)/order.def
92
101
$(BUILD ) /order.def :
93
102
$(Q ) echo " seg_helpers.o: ___bss_start" > $@
94
103
endif
95
-
104
+
96
105
OBJ = $(PY_O ) $(addprefix $(BUILD ) /, $(SRC_C:.c=.o ) )
97
106
98
107
include ../py/mkrules.mk
0 commit comments