diff --git a/var/spack/repos/builtin/packages/bzip2/package.py b/var/spack/repos/builtin/packages/bzip2/package.py
index d44e97207f899087ce0e85d4f9e9f8ca454f788a..53ed853310b92e993404fd636487f280994f0d79 100644
--- a/var/spack/repos/builtin/packages/bzip2/package.py
+++ b/var/spack/repos/builtin/packages/bzip2/package.py
@@ -51,8 +51,10 @@ def libs(self):
def patch(self):
# bzip2 comes with two separate Makefiles for static and dynamic builds
# Tell both to use Spack's compiler wrapper instead of GCC
- filter_file(r'^CC=gcc', 'CC=cc', 'Makefile')
- filter_file(r'^CC=gcc', 'CC=cc', 'Makefile-libbz2_so')
+ filter_file(r'^CC=gcc', 'CC={0}'.format(spack_cc), 'Makefile')
+ filter_file(
+ r'^CC=gcc', 'CC={0}'.format(spack_cc), 'Makefile-libbz2_so'
+ )
# The Makefiles use GCC flags that are incompatible with PGI
if self.compiler.name == 'pgi':