fix return value is not NULL issue and add Makefile for MAC OS