diff --git a/.gitignore b/.gitignore
index fdd65143bed6f796564b029b58ab1c57193f2f51..572f2d6099c11eafab5a0fc9d3442130ca48d519 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ TAGS
 docs/milestone2.dot.pdf
 *.dot.pdf
 Session.vim
+*.gcov
diff --git a/.travis.yml b/.travis.yml
index 8fedfa4321964c41181485bb6eb4fe4d6e64c491..90542d17b3cbc5fd97fe80721a2b0494911905ed 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,11 @@ language: c
 compiler:
   - gcc
   - clang
-script: scons
+before_install:
+  - sudo pip install cpp-coveralls --use-mirrors
+script: 
+  - scons --coverage
+after_success:
+  - coveralls
 notifications:
   irc: "irc.upstandinghackers.com#hammer"
diff --git a/SConstruct b/SConstruct
index 429b0d8b5a907e14efa7b66a5b1466601c1e4628..8f68832a8b419ebd57a7ed9bc6d9668b3be751cf 100644
--- a/SConstruct
+++ b/SConstruct
@@ -12,6 +12,12 @@ AddOption("--variant",
           action="store",
           help="Build variant (debug or opt)")
 
+AddOption("--coverage",
+          dest="coverage",
+          default=False,
+          action="store_true",
+          help="Build with coverage instrumentation")
+
 env['BUILDDIR'] = 'build/$VARIANT'
 
 dbg = env.Clone(VARIANT='debug')
@@ -25,6 +31,12 @@ if GetOption("variant") == 'debug':
 else:
     env = opt
 
+if GetOption("coverage"):
+    env.Append(CFLAGS=["-fprofile-arcs", "-ftest-coverage"],
+               CXXFLAGS=["-fprofile-arcs", "-ftest-coverage"],
+               LDFLAGS=["-fprofile-arcs", "-ftest-coverage"],
+               LIBS=['gcov'])
+
 if os.getenv("CC") == "clang":
     env.Replace(CC="clang",
                 CXX="clang++")