Builds without any warnings and better makefile

The makefile has lots of redundancy so I fixed that and I don't like warnings so those are fixed. You really ought to check the return values of read/write functions anyways.