summaryrefslogtreecommitdiff
path: root/mpy-cross
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-07-10 10:38:32 -0400
committerDan Halbert <halbert@halwitz.org>2018-07-10 10:38:32 -0400
commit85d5d321e23d51630f9df5b61529de49dfd07cad (patch)
tree7e3df274d37e6edcfb3c82f0777c974ca66d0d89 /mpy-cross
parente875f4e52e4886eca1664457a4c1afebb06f0d17 (diff)
Add STATIC_BUILD make flag for mpy-cross to build a static executable
Diffstat (limited to 'mpy-cross')
-rw-r--r--mpy-cross/Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile
index 53ce50c7f..7764d5bef 100644
--- a/mpy-cross/Makefile
+++ b/mpy-cross/Makefile
@@ -35,6 +35,13 @@ CWARN += -Wpointer-arith -Wuninitialized
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
+# Build a static executable.
+# Useful for Windows builds, etc., that must run on multiple operating system versions.
+ifdef STATIC_BUILD
+CFLAGS += -static -static-libgcc -static-libstdc++
+endif
+
+
# Debugging/Optimization
ifdef DEBUG
CFLAGS += -g
@@ -57,6 +64,10 @@ LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
+ifdef STATIC_BUILD
+LDFLAGS += -static -static-libgcc -static-libstdc++
+endif
+
# source files
SRC_C = \
main.c \