pkgfile is a tool that tells you which package owns a specified file or which files a given package provides.
After installing the package, you should update the file list database as root:
# pkgfile --update
$ pkgfile makepkg # Search for a package that contains a file named 'makepkg'. core/pacman # Your searched file is in the 'pacman' package in the [core] repository.
$ pkgfile --list core/pacman # List all files provided by the 'pacman' package in the [core] repository.