M: integrated root_dir and base_dir
M: enabled to specify template's compile directory
M: enabled to specify template's base directory