Skip to content

Commit 670fbb0

Browse files
authored
Merge pull request #10388 from dhalbert/mpy-cross-static-build-fix
2 parents 766b052 + ee7ed33 commit 670fbb0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mpy-cross/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
2525
# CIRCUITPY-CHANGE
2626
CFLAGS += -DCIRCUITPY
2727

28+
# Build a static executable.
29+
# Useful for builds that must run on multiple operating system versions. Used for published mpy-cross versions.
30+
ifdef STATIC_BUILD
31+
CFLAGS += -static -static-libgcc -static-libstdc++
32+
endif
33+
2834
# Debugging/Optimization
2935
ifdef DEBUG
3036
CFLAGS += -g
@@ -47,6 +53,10 @@ LDFLAGS_ARCH = -Wl,[email protected],--cref -Wl,--gc-sections
4753
endif
4854
LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
4955

56+
ifdef STATIC_BUILD
57+
LDFLAGS += -static -static-libgcc -static-libstdc++
58+
endif
59+
5060
# source files
5161
# CIRCUITPY-CHANGE: extra files
5262
SRC_C = \

0 commit comments

Comments
 (0)