diff --git a/synthesis/depend.py b/synthesis/depend.py
index ac87b384ce80ea7b27dde2caac4aa9bfe5b20004..80b6476be872d5000b464ea6a44fc59ff2fc4e13 100644
--- a/synthesis/depend.py
+++ b/synthesis/depend.py
@@ -233,7 +233,7 @@ clean:
         #each .dat depends on corresponding .vhd file
         f.write(lib+"/"+purename+"/_primary.dat: "+rp(file)+'\n')
         f.write('\t\tvcom $(VCOM_FLAGS) -work '
-            +lib+' '+rp(file)+'\n')
+        +lib+' '+rp(file)+' || rm -rf '+lib+'/'+purename+'\n')
         f.write('\n')
         if len(file_deps_dict[file]) != 0:
             f.write(lib+'/'+purename+"/_primary.dat:")