diff --git a/Makefile b/Makefile
index d4f9fb98..73164f4a 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ all:
 	scons -j 8
 
 release:
-	scons mode=release
+	${MINGW_PREFIX}/bin/scons mode=release werror=no
 
 profile:
 	scons mode=profile
diff --git a/SConstruct b/SConstruct
index f190dfc3..3b6e5143 100644
--- a/SConstruct
+++ b/SConstruct
@@ -29,9 +29,9 @@ vars.AddVariables(
     PathVariable('config_file', 'Config file to use', 'src/config.h'),
 )
 
-target_os = str(Platform())
+target_os = 'msys'
 
-env = Environment(variables = vars, ENV = os.environ)
+env = Environment(tools = ['mingw'], variables = vars, ENV = os.environ)
 conf = env.Configure()
 
 if env['mode'] == 'analyze':
@@ -45,10 +45,6 @@ if env['mode'] == 'analyze':
 if os.environ.get('CC') == 'clang':
     env.Replace(CC='clang', CXX='clang++')
 
-# Hack for gcc <= 5, since pragma diagnostic push doesn't seem to work.
-if env['CCVERSION'] and int(env['CCVERSION'].split('.')[0]) <= 5:
-    env.Append(CCFLAGS=['-Wno-unused-function'])
-
 # Asan & Ubsan (need to come first).
 if env['mode'] == 'debug' and target_os == 'posix':
     env.Append(CCFLAGS=['-fsanitize=address', '-fsanitize=undefined'],
@@ -104,8 +100,7 @@ if target_os == 'msys':
     env.Append(CXXFLAGS=['-Wno-attributes', '-Wno-unused-variable',
                          '-Wno-unused-function'])
     env.Append(LIBS=['glfw3', 'opengl32', 'Imm32', 'gdi32', 'Comdlg32',
-                     'z', 'tre', 'intl', 'iconv'],
-               LINKFLAGS='--static')
+                     'z', 'tre', 'intl', 'iconv'])
     sources += glob.glob('ext_src/glew/glew.c')
     env.Append(CPPPATH=['ext_src/glew'])
     env.Append(CPPDEFINES=['GLEW_STATIC', 'FREE_WINDOWS'])
