! ENDIF
LINK_DBG = -debug
!ELSE
-# -O1 yields smaller code, which turns out to be faster than -O2
-#OPTIMIZE = -O2 -MD -DNDEBUG
-OPTIMIZE = -O1 -MD -DNDEBUG
+OPTIMIZE = -MD -DNDEBUG
LINK_DBG = -release
+! IF "$(WIN64)" == "define"
+# enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG)
+OPTIMIZE = $(OPTIMIZE) -Ox -GL
+LINK_DBG = $(LINK_DBG) -ltcg
+! ELSE
+# -O1 yields smaller code, which turns out to be faster than -O2 on x86
+OPTIMIZE = $(OPTIMIZE) -O1
+#OPTIMIZE = $(OPTIMIZE) -O2
+! ENDIF
!ENDIF
!IF "$(WIN64)" == "define"
.ENDIF
LINK_DBG = -debug
.ELSE
-.IF "$(CFG)" == "Optimize"
-# -O1 yields smaller code, which turns out to be faster than -O2
-#OPTIMIZE = -O2 -MD -DNDEBUG
-OPTIMIZE = -O1 -MD -DNDEBUG
+OPTIMIZE = -MD -DNDEBUG
+LINK_DBG = -release
+.IF "$(WIN64)" == "define"
+# enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG)
+OPTIMIZE += -Ox -GL
+LINK_DBG += -ltcg
.ELSE
-OPTIMIZE = -Od -MD -DNDEBUG
+# -O1 yields smaller code, which turns out to be faster than -O2 on x86
+OPTIMIZE += -O1
+#OPTIMIZE += -O2
.ENDIF
-LINK_DBG = -release
.ENDIF
.IF "$(WIN64)" == "define"