All of the non-cpp/h files should be ignored, yes. Your problem is you ignored my previous advice to use git.mk. You really need to use git.mk if you want to do this properly. It will handle all of this for you if you follow the instructions.
If the .cpp/.h files are generated, then they need to be ignored too. If they’re really generated by autoreconf and not by configure – that is, if they’re generated by the maintainer and distributed with your project tarball, not built by the end user who only runs configure and not autoreconf – then they need to be added to MAINTAINERCLEANFILES as well. That seems weird for .cpp/.h files, though, so I am very suspicious of that. .cpp/.h files are usually generated by make and belong in normal CLEANFILES (except for config.h, which is always generated by configure), but for some reason that appears to not be the case for you, which is suspicious. Assuming the information you provided is correct, your build system might be doing something weird/wrong.
Remember this advice from Autotools 101:
- MOSTLYCLEANFILES exists, but I recommend ignoring it, because it’s mostly not useful
- CLEANFILES is for things generated by make
- DISTCLEANFILES is for things generated by configure
- MAINTAINERCLEANFILES is for things generated by autogen.sh/autoreconf
git.mk will add all of the above to the .gitignore that it generates. If generated files are missing from the .gitignore, it means you messed up the *CLEANFILES. Also remember that because .gitignore is itself generated by make, it is itself going to be ignored. Do not try to commit it.
I’m going to insist that git.mk is the only reasonable way to integrate Autotools with git. Getting that all correct manually and keeping your *CLEANFILES synchronized with your .gitignore without the assistance of git.mk would be error-prone and pointless.
P.S. You should really use Meson instead, which is GNOME’s recommended replacement for Autotools, but we have another thread for that discussion now.