diff --git a/python/dune/perftool/file.py b/python/dune/perftool/file.py
index b031959a2ccbac0441ddb446372ee73249c30f7b..ab6755700e7e312ce551c990a1d34c09dbc0ceb6 100644
--- a/python/dune/perftool/file.py
+++ b/python/dune/perftool/file.py
@@ -23,7 +23,7 @@ def generate_file(filename, tag, content, headerguard=True):
     with open(filename, 'w') as f:
         # Add a double inclusion protection header
         if headerguard:
-            macro = filename.upper().replace("/", "_").replace(".", "_")
+            macro = filename.upper().replace("/", "_").replace(".", "_").replace("-", "_")
             f.write("#ifndef {0}\n#define {0}\n\n".format(macro))
 
         # Add the includes from the cache