FreeBSD Ports Make Targets
The FreeBSD ports system is powerful, but many of the make targets most
useful for ordinary sysadmins and PC owners are documented only in a
Makefile obscure and largely invisible to those not building their own
ports: /usr/ports/Mk/bsd.port.mk
.
If you're authoring a port (or updating or patching a port), refer to the file on your own system for both names and descriptions, as well as the FreeBSD Porter's Handbook. I'm winging it and trying to simplify the descriptions here for non-author port users like myself.
Documented here are the default and sometimes useful make targets in the
ports tree. First, cd
into the port you want to do something with,
then make <target>
where "<target>" is one of these based on what you
want to do with the port. They are listed here in order of my personal
preference, more or less most useful to me first.
Running make
or make all
has the same effect as running:
make check-sanity fetch checksum extract patch configure build
The make
command I personally like to use to (re)configure, build
afresh, (re)install, and clean up a port is:
make clean config build deinstall install clean
Yes, I like to run the clean
target twice, and I know this forces a
port to be fully recompiled even if a previous run compiled successfully
and I haven't changed anything since. Except for bloatware ports that
take a geologic age to compile, such as modern GUI Web browsers and
office productivity suites, the muscle memory is often worth the time
lost rebuilding a port.
The ports system is well-designed and robust. Attempting to make a
target without its prerequisites met, such as make install
on a port
that hasn't been built, configured, or downloaded yet, will cause the
ports system to run those dependent make targets first.
The make targets most useful to me
fetch
Download the distribution and patch files needed to build this port.
fetch-recursive
Like fetch
, download the distribution and patch files needed for this
port, but also download the files needed for the ports this one depends
on.
extract
Unpack the port's distribution files into its work directory.
patch
Apply any provided patches to the source files in the work directory.
config
Interactively configure this port's options through a series of dialog boxes.
showconfig
Print this port's currently configured options.
configure
Run the port's configure script. This is the step usually given as
./configure
in many open source projects' source-based installation
directions. The actual scripts or programs run varies from port to
port.
build
Build the port by compiling its source code. This is the step usually
given as make
in many open source projects' source-based installation
directions.
test
Run the port's test suite, if it has one.
deinstall
Remove (uninstall) the package corresponding to this port, but do not
remove its dependencies. This is useful when attempting to make
install
an already-installed port or package.
install
Install the package made from this port.
clean
Remove the work directory and any other temporary files left from extracting, patching, and building this port.
Other make targets that might one day be useful
fetch-list
Instead of downloading any files, print out all the shell commands that
would be run if make fetch
was typed.
fetch-recursive-list
Instead of downloading any files, print out all the shell commands that
would be run if make fetch-recursive
was typed.
fetch-required
The description is the same as for make fetch-recursive
.
fetch-required-list
The description is the same as for make fetch-recursive-list
.
fetch-url-list
Print out the URLs of distribution and patch files needed to build this port, one URL per line.
fetch-urlall-list
Print out the URLs of distribution and patch files needed to build this port, as well as the files needed for the ports this one depends on, one URL per line.
all-depends-list
Print out the directories of ports that this port depends on.
build-depends-list
Print out the directories of ports that this port depends on in order to build this port into a package, one directory per line.
package-depends-list
Print out the names of the packages that this port depends on. This is based on the dependency tree as recorded in each dependent port's Makefile, not as recorded in the currently installed ports.
The names printed are the names with version numbers, their root directories within the ports tree, and their packagen names in "category/name" format.
actual-package-depends
Print out the names of packages as in make package-depends-list
, but
based on the dependencies of currently installed ports instead.
Each line of the output is in the form of:
"package-name": {origin: "category/package-name", version "1.0"}
run-depends-list
Print out the directories of ports that this port depends on in order for the program built from it to run, one directory per line.
test-depends-list
Print out the directories of ports that this port depends on in order for its post-build tests to run, one directory per line.
reinstall
Install the results of a build, like make install
, but ignore its
already-installed state. This does not remove an already-installed
package first (see "deinstall" for that), but it does re-run make
install
if the ports system thinks the results of the most recent build
run are already installed if they really aren't (or aren't installed
properly).
deinstall-all
Remove (uninstall) all installations with the same package origin.
package
Create a package from the installed build of this port. (This does not create a package from a build of this port awaiting installation.)
package-recursive
Like make package
, but create a package for this port and all of its
dependencies.
clean-depends
Like make clean
, but on this port and every port this one depends on.
config-recursive
Like make config
, but configure options for this port and every port
this one depends on.
showconfig-recursive
Like make showconfig
, but print the configuration options for this
port and every port this one depends on.
rmconfig
Remove the configuration options for this port, resetting them to default.
rmconfig-recursive
Like make rmconfig
, but remove the configuration options for this port
and every port this one depends on, resetting them to default for every
port affected.
Other make targets that seem intended for port authors only
- describe
- Try to generate a one-line description for each port for use in INDEX files and the like.
- check-plist
- Checks for files missing from the plist, and files in the plist that are not installed by the port.
- check-sanity
- Perform some basic checks of the port layout.
- checkpatch
- Do a "patch -C" instead of a "patch". Note that it may give incorrect results if multiple patches deal with the same file.
- checksum
- Use distinfo to ensure that your distfiles are valid.
- checksum-recursive
- Run checksum in this port and all dependencies.
- makesum
- Generate distinfo (only do this for your own ports!).