A jet bundle approach to the variational structure of nonhomologic mechanical systems