Kapitel 13. Beispiel eines Makefile

Hier ein Beispiel für ein Makefile, welches als Vorlage für einen neuen Port dienen kann. Alle zusätzlichen Kommentare in eckigen Klammern müssen entfernt werden!

Es wird empfohlen, die hier gezeigte Formatierung zu übernehmen (Reihenfolge der Variablen, Leerzeichen zwischen einzelnen Abschnitten, usw.). Dadurch werden die wichtigen Informationen sofort ersichtlich. Zur Überprüfung Ihres Makefiles sollten Sie portlint verwenden.

[the header...just to make it easier for us to identify the ports.]
# New ports collection makefile for:   xdvi
[the "version required" line is only needed when the PORTVERSION
 variable is not specific enough to describe the port.]
# Date created:                26 May 1995
[this is the person who did the original port to FreeBSD, in particular, the
person who wrote the first version of this Makefile.  Remember, this should
not be changed when upgrading the port later.]
# Whom:                        Satoshi Asami <asami@FreeBSD.org>
#
# $FreeBSD$
[ ^^^^^^^^^ This will be automatically replaced with RCS ID string by CVS
when it is committed to our repository.  If upgrading a port, do not alter
this line back to "$FreeBSD$".  CVS deals with it automatically.]
#

[section to describe the port itself and the master site - PORTNAME
 and PORTVERSION are always first, followed by CATEGORIES,
 and then MASTER_SITES, which can be followed by MASTER_SITE_SUBDIR.
 PKGNAMEPREFIX and PKGNAMESUFFIX, if needed, will be after that.
 Then comes DISTNAME, EXTRACT_SUFX and/or DISTFILES, and then
 EXTRACT_ONLY, as necessary.]
PORTNAME=      xdvi
PORTVERSION=   18.2
CATEGORIES=    print
[do not forget the trailing slash ("/")!
 if you are not using MASTER_SITE_* macros]
MASTER_SITES=  ${MASTER_SITE_XCONTRIB}
MASTER_SITE_SUBDIR= applications
PKGNAMEPREFIX= ja-
DISTNAME=      xdvi-pl18
[set this if the source is not in the standard ".tar.gz" form]
EXTRACT_SUFX=  .tar.Z

[section for distributed patches -- can be empty]
PATCH_SITES=   ftp://ftp.sra.co.jp/pub/X11/japanese/
PATCHFILES=    xdvi-18.patch1.gz xdvi-18.patch2.gz

[maintainer; *mandatory*!  This is the person who is volunteering to
 handle port updates, build breakages, and to whom a users can direct
 questions and bug reports.  To keep the quality of the Ports Collection
 as high as possible, we no longer accept new ports that are assigned to
 "ports@FreeBSD.org".]
MAINTAINER=    asami@FreeBSD.org
COMMENT=       A DVI Previewer for the X Window System

[dependencies -- can be empty]
RUN_DEPENDS=   gs:${PORTSDIR}/print/ghostscript
LIB_DEPENDS=   Xpm.5:${PORTSDIR}/graphics/xpm

[this section is for other standard bsd.port.mk variables that do not
 belong to any of the above]
[If it asks questions during configure, build, install...]
IS_INTERACTIVE=        yes
[If it extracts to a directory other than ${DISTNAME}...]
WRKSRC=                ${WRKDIR}/xdvi-new
[If the distributed patches were not made relative to ${WRKSRC}, you
 may need to tweak this]
PATCH_DIST_STRIP=      -p1
[If it requires a "configure" script generated by GNU autoconf to be run]
GNU_CONFIGURE= yes
[If it requires GNU make, not /usr/bin/make, to build...]
USE_GMAKE=     yes
[If it is an X application and requires "xmkmf -a" to be run...]
USE_IMAKE=     yes
[et cetera.]

[non-standard variables to be used in the rules below]
MY_FAVORITE_RESPONSE=  "yeah, right"

[then the special rules, in the order they are called]
pre-fetch:
    i go fetch something, yeah

post-patch:
    i need to do something after patch, great

pre-install:
    and then some more stuff before installing, wow

[and then the epilogue]
.include <bsd.port.mk>

Fragen zum FreeBSD Ports-System richten Sie bitte an <ports@FreeBSD.org>, Fragen zu diesem Dokument hingegen an <de-bsd-translators@de.FreeBSD.org>.