Add STATIC_BUILD make flag for mpy-cross to build a static executable
This commit is contained in:
parent
e875f4e52e
commit
85d5d321e2
@ -35,6 +35,13 @@ CWARN += -Wpointer-arith -Wuninitialized
|
|||||||
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||||
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
|
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
|
# Debugging/Optimization
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
@ -57,6 +64,10 @@ LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
|||||||
endif
|
endif
|
||||||
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
||||||
|
|
||||||
|
ifdef STATIC_BUILD
|
||||||
|
LDFLAGS += -static -static-libgcc -static-libstdc++
|
||||||
|
endif
|
||||||
|
|
||||||
# source files
|
# source files
|
||||||
SRC_C = \
|
SRC_C = \
|
||||||
main.c \
|
main.c \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user