makefiles: Generate the common rules for tests from configure.