English French (fr_FR)
Chapter 5. Configuring the Makefile
Configuring the Makefile
Configuring the [.filename]#Makefile# is pretty simple, and again we suggest looking at existing examples before starting. Also, there is a <<porting-samplem,sample Makefile>> in this handbook, so take a look and please follow the ordering of variables and sections in that template to make the port easier for others to read.
Consider these problems in sequence during the design of the new [.filename]#Makefile#:
The Original Source
Does it live in `DISTDIR` as a standard ``gzip``ped tarball named something like [.filename]#foozolix-1.2.tar.gz#? If so, go on to the next step. If not, the distribution file format might require overriding one or more of `DISTVERSION`, `DISTNAME`, `EXTRACT_CMD`, `EXTRACT_BEFORE_ARGS`, `EXTRACT_AFTER_ARGS`, `EXTRACT_SUFX`, or `DISTFILES`.
In the worst case, create a custom `do-extract` target to override the default. This is rarely, if ever, necessary.
Naming
The first part of the port's [.filename]#Makefile# names the port, describes its version number, and lists it in the correct category.
`PORTNAME`
Set `PORTNAME` to the base name of the software. It is used as the base for the FreeBSD package, and for <<makefile-distname,`DISTNAME`>>.
The package name must be unique across the entire ports tree. Make sure that the `PORTNAME` is not already in use by an existing port, and that no other port already has the same `PKGBASE`. If the name has already been used, add either <<porting-pkgnameprefix-suffix,`PKGNAMEPREFIX` or `PKGNAMESUFFIX`>>.
Versions, `DISTVERSION` _or_ `PORTVERSION`
Set `DISTVERSION` to the version number of the software.
`PORTVERSION` is the version used for the FreeBSD package. It will be automatically derived from `DISTVERSION` to be compatible with FreeBSD's package versioning scheme. If the version contains _letters_, it might be needed to set `PORTVERSION` and not `DISTVERSION`.
Only one of `PORTVERSION` and `DISTVERSION` can be set at a time.
From time to time, some software will use a version scheme that is not compatible with how `DISTVERSION` translates in `PORTVERSION`.
When updating a port, it is possible to use man:pkg-version[8]'s `-t` argument to check if the new version is greater or lesser than before. See <<makefile-versions-ex-pkg-version>>.
Using man:pkg-version[8] to Compare Versions.
`pkg version -t` takes two versions as arguments, it will respond with `<`, `=` or `>` if the first version is less, equal, or more than the second version, respectively.