some minor makefile tweaking
encode function done.