Replace filename with basename in template file and also regenerate enum types if Makefile.am changes.