Firstly, use target-specific *_VALAFLAGS variables (rather than AM_VALAFLAGS) to specify the flags to pass to the valac compiler. Doing this enables a couple of dist and clean features in automake which wouldn’t otherwise be enabled. It’s also means you can specify multiple targets in a single Makefile.am, which is good for non-recursive automake.
When building a library, explicitly specify --vapi, --header, --internal-vapi, --internal-header and --gir (as appropriate) in the *_VALAFLAGS variable directly, rather than including them through another variable. automake looks for these flags in order to build dist and clean rules for the generated VAPI, C header and GIR files.
automake will automatically delete .stamp, VAPI and generated C header and source files on maintainer-clean, but not as part of any other clean target — this is because automake is designed to ensure generated C files are included in the distribution tarball. Failing to specify --header, --vapi (etc.) directly in *_VALAFLAGS will cause the appropriate maintainer-clean rules to not be generated.
automake knows nothing about .deps files (which accompany .vapi files), and will not generate dist rules for them; that must be done manually using:
vapidir = $(datadir)/vala/vapi dist_vapi_DATA = my-library.deps
Source: lang_vala_finish_target() in the automake-1.13 script. Read it: it’s quite clear and informative.
Note: That documentation seems to be a bit out of date regarding VALAFLAGS. ↩