diff --git a/litex/build/tools.py b/litex/build/tools.py index 9e0880d59..34c054b16 100644 --- a/litex/build/tools.py +++ b/litex/build/tools.py @@ -23,6 +23,9 @@ def write_to_file(filename, contents, force_unix=False): newline = None if force_unix: newline = "\n" + if os.path.exists(filename): + if open(filename, "r", newline=newline).read() == contents: + return with open(filename, "w", newline=newline) as f: f.write(contents)