Rename automake.py to h2.py

Add support for exporting makefile
Several bug fixes