Fix build system by stealing more gnome-boxes code

Parallel builds should work now and stamp files should be included
in distribution.