ncs-yang is the smartway to compile yang file/files along with it's dependencies from Makefile.
pip install ncs-yang