STATIC_STDCPLUS=no
endif
-
# Link against the shared version of libwinpthread by default. Set
# STATIC_WINPTHREAD to "yes" to link against static version instead.
ifndef STATIC_WINPTHREAD
# This is used when STATIC_STDCPLUS=yes.
HAS_GCC_EH=yes
+# Reduce the size of the executables by using the --gc-sections linker
+# option. Set USE_GC_SECTIONS to "no" if you see any issues with this.
+ifndef USE_GC_SECTIONS
+USE_GC_SECTIONS=yes
+endif
+
# If the user doesn't want gettext, undefine it.
ifeq (no, $(GETTEXT))
GETTEXT=
LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
endif
+# To reduce the file size
+ifeq (yes, $(USE_GC_SECTIONS))
+CFLAGS += -ffunction-sections -fno-asynchronous-unwind-tables
+CXXFLAGS += -fasynchronous-unwind-tables
+LFLAGS += -Wl,--gc-sections
+ ifeq (yes, $(VIMDLL))
+EXELFLAGS += -Wl,--gc-sections
+ endif
+endif
+
ifeq (yes, $(MAP))
LFLAGS += -Wl,-Map=$(TARGET).map
endif