Some fixes and improvements in Makefiles

Hi,

It is not possible to clean some .beam files using ```make clean```. The following commits are to fix this.