Description: --as-needed to avoid linking with what we don't use,
    no static libgcc or libstdc++, use CFLAGS and friends
    from the environment.
Last-Update: 2018-03-12

--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 WXCONFIG ?= wx-config
 HOST=
-WXCXXFLAGS= `$(WXCONFIG) --cxxflags` -MMD -fopenmp -Wall -O2
-WXLDFLAGS = `$(WXCONFIG) --libs` `$(WXCONFIG) --libs aui` `$(WXCONFIG) --libs core`
+WXCXXFLAGS= `$(WXCONFIG) --cxxflags` -MMD -fopenmp -Wall -O2 -DNDEBUG
+WXLDFLAGS = -Wl,--as-needed `$(WXCONFIG) --libs` `$(WXCONFIG) --libs std,aui` `$(WXCONFIG) --libs core`
 WXCXXFLAGS += -fopenmp
 LDFLAGS += -lgomp
 #add this ldflags for WinConsole  "-Wl,--subsystem,console -mconsole" for win-debug
