diff --git a/build/Cyg/Makefile b/build/Cyg/Makefile
index f104a3f..c09750c 100755
--- a/build/Cyg/Makefile
+++ b/build/Cyg/Makefile
@@ -71,7 +71,7 @@ docdir = $(datarootdir)/doc/epanet
# Compiler and flags
CC = /bin/gcc
dlltool = /bin/dlltool
-CFLAGS = -g -O
+CFLAGS = -g -O3
CPPFLAGS = -I $(srcdir) -I $(epanetincludedir)
LDFLAGS = -L . -W1,-rpath,$(libdir) -lm
diff --git a/build/Linux/Makefile b/build/Linux/Makefile
index 3c63748..f6e33bc 100755
--- a/build/Linux/Makefile
+++ b/build/Linux/Makefile
@@ -57,7 +57,7 @@ docdir = $(datarootdir)/doc/epanet
# Compiler and flags
CC = gcc
-CFLAGS = -g -O -fPIC
+CFLAGS = -g -O3 -fPIC
CPPFLAGS = -I $(epanetincludedir)
LDFLAGS = -L . -W1,-rpath,$(libdir) -lm
diff --git a/build/MSVC/epanet-dll/epanet-dll.vcproj b/build/MSVC/epanet-dll/epanet-dll.vcproj
index 4f9f668..f0c3180 100755
--- a/build/MSVC/epanet-dll/epanet-dll.vcproj
+++ b/build/MSVC/epanet-dll/epanet-dll.vcproj
@@ -165,6 +165,8 @@
/>
diff --git a/build/MSVC/epanet-exe/epanet-exe.vcproj b/build/MSVC/epanet-exe/epanet-exe.vcproj
index 4751d7f..b14bf8c 100755
--- a/build/MSVC/epanet-exe/epanet-exe.vcproj
+++ b/build/MSVC/epanet-exe/epanet-exe.vcproj
@@ -167,6 +167,8 @@
/>
diff --git a/build/MingW/Makefile b/build/MingW/Makefile
index 989c1cc..49f1c8d 100755
--- a/build/MingW/Makefile
+++ b/build/MingW/Makefile
@@ -93,7 +93,7 @@ docdir = $(datarootdir)/doc/epanet
# MinGW gcc
CC = $(MinGWdir)/bin/gcc
dlltool = $(MinGWdir)/bin/dlltool
-CFLAGS = -g -O
+CFLAGS = -g -O3
CPPFLAGS = -I $(srcdir) -I $(epanetincludedir)
LDFLAGS = -L . -W1,-rpath,$(libdir) -lm