- Abstracts the build system (
- Manages dependencies (build & runtime)
- Creates package which can be distributed or installed
- Allows distro-specific patches or configurations
- Supports installation/uninstallation/upgrade scripts
- Tracks files on system so you know why a specific file has been installed (who owns it)
- Makes uninstallation easier.
- Makes upgrades easier (renamed files in source package will not leave orphans, scripts can safely migrate databases).
make will execute a
MakeFile in the current directory, building required targets.
make install will attempt to install those targets into
makepkg -i builds based on the rules of
PKGBUILD. This could be:
make install DESTDIR=/usr
cmake --build . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
cmake --build . --target=install
or any of
cargo build --release
There are lots of build systems.
make is only one of them, and is often only a part of one (e.g. autoconf).
PKGBUILD is a nice way so that arch package users (or build machines) can use a single command (
makepkg) without the need to know anything about the build system. It's meant to define how to build a package instead of how to build the sources.
PKGBUILD also gives the opportunity to define build-dependencies or runtime dependencies. This means if you need
cmake to build a package, it will be automatically installed (if
-s is specified) and automatically removed (if
-r is specified). If your package depends on
python3, then it will ensure that
python3 is installed on your system automatically.
PKGBUILD also gives the possibility for Arch maintainers to add their own patches/customizations to original source packages. If a upstream package installs a library executable to
/usr/lib/, but Arch's standards would rather have these in
/usr/libexec/, then the
PKGBUILD file allows these kind of customizations.
If you don't use the
makepkg does not try to install the build. Instead the output is a
.tar.xz file which could be uploaded to an archive and installed by other users with
pacman. This is how the official arch repositories work.
Arch developers will write
PKGBUILD files, then build machines will parse those files, build packages, and upload them to the official repository so that you can use
pacman to download/install them.
Another advantage of using
make install is that your package manager keeps an index of what is installed, where, and which version. This means if you ever have a question about why a file is on your system, you should be able to query the package manager who will tell you which package "owns" the file and which version it is. When you uninstall the package, the package manager knows of all files so that it doesn't leave anything orphaned. When you upgrade your package, the package manager knows which files to replace/rename/delete during the installation and may also run a script or two to ensure that things migrate smoothly.