Clean up logical flow for setting LDFLAGS to build for Linux and OSX

Add more specific comments describing what is going on.
This commit is contained in:
blmorris 2014-09-23 09:42:18 -04:00
parent 8afb9b3863
commit fa6567a39f

View File

@ -29,17 +29,19 @@ else
COPT = -Os #-DNDEBUG COPT = -Os #-DNDEBUG
endif endif
LDFLAGS = $(LDFLAGS_MOD) -lm -Wl$(LDFLAGS_MAP_EXTRA) $(LDFLAGS_EXTRA) # 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) ifeq ($(UNAME_S),Darwin)
# Force OSX to use clang even if gcc is present, value set in mkenv.mk
# must be ovewritten here to avoid breaking stmhal build on OSX
CC = clang CC = clang
# Use clang syntax for LDFLAGS # Use clang syntax for map file and set osx specific flags
LDFLAGS_MAP_EXTRA = ,-map,$@.map LDFLAGS_ARCH = -Wl,-order_file,$(BUILD)/order.def -Wl,-map,$@.map
else else
# Use gcc syntax # Use gcc syntax for map file
LDFLAGS_MAP_EXTRA = ,-Map=$@.map,--cref LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref
endif endif
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
ifeq ($(MICROPY_FORCE_32BIT),1) ifeq ($(MICROPY_FORCE_32BIT),1)
CFLAGS += -m32 CFLAGS += -m32
@ -89,9 +91,6 @@ SRC_C = \
$(SRC_MOD) $(SRC_MOD)
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
LDFLAGS += -Wl,-order_file,$(BUILD)/order.def
# Must be the last file in list of sources # Must be the last file in list of sources
SRC_C += seg_helpers.c SRC_C += seg_helpers.c