[BACK]Return to bsd.port.mk CVS log [TXT][DIR] Up to [local] / src / share / mk

Annotation of src/share/mk/bsd.port.mk, Revision 1.27

1.9       imp         1: #-*- mode: Fundamental; tab-width: 4; -*-
                      2: # ex:ts=4
1.27    ! marc        3: #  $OpenBSD: bsd.port.mk,v 1.26 1998/03/27 03:30:43 marc Exp $
1.9       imp         4: #  $NetBSD: $
1.1       niklas      5: #
                      6: #  bsd.port.mk - 940820 Jordan K. Hubbard.
                      7: #  This file is in the public domain.
                      8: #
1.13      imp         9: # FreeBSD Id: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp
1.6       niklas     10: #
1.1       niklas     11: # Please view me with 4 column tabs!
                     12:
1.13      imp        13: # There are two different types of "maintainers" in the whole ports
                     14: # framework concept.  Maintainers of the bsd.port*.mk files
                     15: # are listed below in the ${OSNAME}_MAINTAINER entries (this file
                     16: # is used by multiple *BSD flavors).  You should consult them directly
                     17: # if you have any questions/suggestions regarding this file since only
                     18: # they are allowed to modify the master copies in the CVS repository!
                     19:
                     20: # For each port, the MAINTAINER variable is what you should consult for
                     21: # contact information on the person(s) to contact if you have questions/
                     22: # suggestions about that specific port.  By default (if no MAINTAINER
                     23: # is listed), a port is maintained by the subscribers of the ports@freebsd.org
                     24: # mailing list, and any correspondece should be directed there.
1.9       imp        25: #
1.13      imp        26: FreeBSD_MAINTAINER=    asami@FreeBSD.ORG
1.21      joey       27: OpenBSD_MAINTAINER=    joey@OpenBSD.ORG
1.1       niklas     28:
                     29: # Supported Variables and their behaviors:
                     30: #
                     31: # Variables that typically apply to all ports:
                     32: #
1.10      niklas     33: # ONLY_FOR_ARCHS- If a port only makes sense to certain architectures, this
                     34: #                is a list containing the names for them.  It is checked
                     35: #                against the predefined ${MACHINE} value
1.13      imp        36: # ARCH         - The architecture, as returned by "uname -m".
1.9       imp        37: # OPSYS            - Portability clause.  This is the operating system the
                     38: #                makefile is being used on.  Automatically set to
                     39: #                "FreeBSD," "NetBSD," or "OpenBSD" as appropriate.
                     40: # PORTSDIR     - The root of the ports tree.  Defaults:
1.13      imp        41: #                  FreeBSD/OpenBSD: /usr/ports
                     42: #                  NetBSD:          /usr/opt
1.1       niklas     43: # DISTDIR      - Where to get gzip'd, tarballed copies of original sources
1.9       imp        44: #                (default: ${PORTSDIR}/distfiles).
1.1       niklas     45: # PREFIX       - Where to install things in general (default: /usr/local).
                     46: # MASTER_SITES - Primary location(s) for distribution files if not found
1.9       imp        47: #                locally.
1.1       niklas     48: # PATCH_SITES  - Primary location(s) for distribution patch files
1.9       imp        49: #                (see PATCHFILES below) if not found locally.
1.1       niklas     50: #
1.9       imp        51: # MASTER_SITE_BACKUP - Backup location(s) for distribution files and patch
                     52: #                files if not found locally and ${MASTER_SITES}/${PATCH_SITES}
                     53: #                (default:
1.27    ! marc       54: #                ftp://ftp.openbsd.org/pub/OpenBSD/distfiles/${DIST_SUBDIR}/
1.9       imp        55: #                ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
1.1       niklas     56: # MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
                     57: #                value.
1.27    ! marc       58: # MASTER_SITE_OPENBSD - If set, only use ftp.openbsd.org as the
        !            59: #                MASTER_SITE_OVERRIDE.
        !            60: # MASTER_SITE_FREEBSD - If set, only use ftp.freebsd.org as the
        !            61: #                MASTER_SITE_OVERRIDE.
1.1       niklas     62: # PACKAGES     - A top level directory where all packages go (rather than
                     63: #                going locally to each port). (default: ${PORTSDIR}/packages).
                     64: # GMAKE            - Set to path of GNU make if not in $PATH (default: gmake).
                     65: # XMKMF            - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
                     66: # MAINTAINER   - The e-mail address of the contact person for this port
                     67: #                (default: ports@FreeBSD.ORG).
1.9       imp        68: # CATEGORIES   - A list of descriptive categories into which this port falls.
1.14      niklas     69: # WRKOBJDIR        - A top level directory where, if defined, the separate working
                     70: #                directories will get created, and symbolically linked to from
                     71: #                ${WRKDIR} (see below).  This is useful for building ports on
                     72: #                several architectures, then ${PORTSDIR} can be NFS-mounted
                     73: #                while ${WRKOBJDIR} is local to every arch.
                     74:
1.1       niklas     75: #
                     76: # Variables that typically apply to an individual port.  Non-Boolean
                     77: # variables without defaults are *mandatory*.
                     78: #
                     79: # WRKDIR       - A temporary working directory that gets *clobbered* on clean
                     80: #                (default: ${.CURDIR}/work).
                     81: # WRKSRC       - A subdirectory of ${WRKDIR} where the distribution actually
                     82: #                unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
                     83: #                NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
                     84: # DISTNAME     - Name of port or distribution.
                     85: # DISTFILES        - Name(s) of archive file(s) containing distribution
                     86: #                (default: ${DISTNAME}${EXTRACT_SUFX}).
                     87: # PATCHFILES   - Name(s) of additional files that contain distribution
                     88: #                patches (default: none).  make will look for them at
                     89: #                PATCH_SITES (see above).  They will automatically be
                     90: #                uncompressed before patching if the names end with
                     91: #                ".gz" or ".Z".
1.9       imp        92: # DIST_SUBDIR  - Suffix to ${DISTDIR}.  If set, all ${DISTFILES}
1.1       niklas     93: #                and ${PATCHFILES} will be put in this subdirectory of
                     94: #                ${DISTDIR}.  Also they will be fetched in this subdirectory
                     95: #                from FreeBSD mirror sites.
1.9       imp        96: # ALLFILES     - All of ${DISTFILES} and ${PATCHFILES}.
                     97: # IGNOREFILES  - If some of the ${ALLFILES} are not checksum-able, set
                     98: #                this variable to their names.
1.1       niklas     99: # PKGNAME      - Name of the package file to create if the DISTNAME
                    100: #                isn't really relevant for the port/package
                    101: #                (default: ${DISTNAME}).
                    102: # EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to
                    103: #                actually extract.
                    104: # PATCHDIR         - A directory containing any additional patches you made
                    105: #                to port this software to FreeBSD (default:
                    106: #                ${.CURDIR}/patches)
                    107: # SCRIPTDIR    - A directory containing any auxiliary scripts
                    108: #                (default: ${.CURDIR}/scripts)
                    109: # FILESDIR         - A directory containing any miscellaneous additional files.
                    110: #                (default: ${.CURDIR}/files)
                    111: # PKGDIR       - A direction containing any package creation files.
                    112: #                (default: ${.CURDIR}/pkg)
                    113: # PKG_DBDIR        - Where package installation is recorded (default: /var/db/pkg)
                    114: # FORCE_PKG_REGISTER - If set, it will overwrite any existing package
                    115: #                registration information in ${PKG_DBDIR}/${PKGNAME}.
                    116: # NO_MTREE     - If set, will not invoke mtree from bsd.port.mk from
1.13      imp       117: #                the "install" target.
                    118: # MTREE_FILE   - The name of the mtree file (default: /etc/mtree/BSD.x11.dist
                    119: #                if USE_IMAKE or USE_X11 is set, /etc/mtree/BSD.local.dist
                    120: #                otherwise.)
1.26      marc      121: # COMES_WITH   - The first version that a port was made part of the
                    122: #                standard OpenBSD distribution.  If the current OpenBSD
                    123: #                version is >= this version then a notice will be
                    124: #                displayed instead the port being generated.
1.1       niklas    125: #
1.6       niklas    126: # NO_BUILD     - Use a dummy (do-nothing) build target.
                    127: # NO_CONFIGURE - Use a dummy (do-nothing) configure target.
1.9       imp       128: # NO_CDROM     - Port may not go on CDROM.  Set this string to reason.
1.6       niklas    129: # NO_DESCRIBE  - Use a dummy (do-nothing) describe target.
1.1       niklas    130: # NO_EXTRACT   - Use a dummy (do-nothing) extract target.
1.6       niklas    131: # NO_INSTALL   - Use a dummy (do-nothing) install target.
1.1       niklas    132: # NO_PACKAGE   - Use a dummy (do-nothing) package target.
1.6       niklas    133: # NO_PKG_REGISTER - Don't register a port install as a package.
1.1       niklas    134: # NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}.
                    135: # NO_WRKDIR        - There's no work directory at all; port does this someplace
                    136: #                else.
                    137: # NO_DEPENDS   - Don't verify build of dependencies.
1.9       imp       138: # BROKEN       - Port is broken.  Set this string to the reason why.
1.1       niklas    139: # RESTRICTED   - Port is restricted.  Set this string to the reason why.
                    140: # USE_GMAKE        - Says that the port uses gmake.
1.13      imp       141: # USE_PERL5        - Says that the port uses perl5 for building and running.
1.1       niklas    142: # USE_IMAKE        - Says that the port uses imake.
1.13      imp       143: # USE_X11      - Says that the port uses X11 (i.e., installs in ${X11BASE}).
1.1       niklas    144: # NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
                    145: #                      target.
                    146: # HAS_CONFIGURE    - Says that the port has its own configure script.
                    147: # GNU_CONFIGURE    - Set if you are using GNU configure (optional).
                    148: # CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
                    149: # CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set.
1.13      imp       150: # CONFIGURE_ENV - Pass these env (shell-like) to configure if
1.1       niklas    151: #                ${HAS_CONFIGURE} is set.
1.13      imp       152: # SCRIPTS_ENV  - Additional environment vars passed to scripts in
                    153: #                 ${SCRIPTDIR} executed by bsd.port.mk.
                    154: # MAKE_ENV     - Additional environment vars passed to sub-make in build
                    155: #                stage.
1.1       niklas    156: # IS_INTERACTIVE - Set this if your port needs to interact with the user
                    157: #                during a build.  User can then decide to skip this port by
                    158: #                setting ${BATCH}, or compiling only the interactive ports
                    159: #                by setting ${INTERACTIVE}.
1.7       niklas    160: # FETCH_DEPENDS - A list of "path:dir" pairs of other ports this
                    161: #                package depends in the "fetch" stage.  "path" is the
                    162: #                name of a file if it starts with a slash (/), an
                    163: #                executable otherwise.  make will test for the
                    164: #                existence (if it is a full pathname) or search for
                    165: #                it in your $PATH (if it is an executable) and go
                    166: #                into "dir" to do a "make all install" if it's not
                    167: #                found.
                    168: # BUILD_DEPENDS - A list of "path:dir" pairs of other ports this
                    169: #                package depends to build (between the "extract" and
                    170: #                "build" stages, inclusive).  The test done to
                    171: #                determine the existence of the dependency is the
                    172: #                same as FETCH_DEPENDS.
                    173: # RUN_DEPENDS  - A list of "path:dir" pairs of other ports this
                    174: #                package depends to run.  The test done to determine
                    175: #                the existence of the dependency is the same as
                    176: #                FETCH_DEPENDS.  This will be checked during the
                    177: #                "install" stage and the name of the dependency will
                    178: #                be put into the package as well.
1.1       niklas    179: # LIB_DEPENDS  - A list of "lib:dir" pairs of other ports this package
                    180: #                depends on.  "lib" is the name of a shared library.
                    181: #                make will use "ldconfig -r" to search for the
                    182: #                library.  Note that lib can be any regular expression,
                    183: #                and you need two backslashes in front of dots (.) to
                    184: #                supress its special meaning (e.g., use
                    185: #                "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
                    186: # DEPENDS      - A list of other ports this package depends on being
                    187: #                made first.  Use this for things that don't fall into
                    188: #                the above two categories.
                    189: # EXTRACT_CMD  - Command for extracting archive (default: tar).
                    190: # EXTRACT_SUFX - Suffix for archive names (default: .tar.gz).
                    191: # EXTRACT_BEFORE_ARGS -
                    192: #                Arguments to ${EXTRACT_CMD} before filename
1.13      imp       193: #                (default: -xzf).
1.1       niklas    194: # EXTRACT_AFTER_ARGS -
                    195: #                Arguments to ${EXTRACT_CMD} following filename
                    196: #                (default: none).
                    197: #
1.6       niklas    198: # FETCH_CMD          - Full path to ftp/http fetch command if not in $PATH
                    199: #                (default: /usr/bin/fetch).
                    200: # FETCH_BEFORE_ARGS -
                    201: #                Arguments to ${FETCH_CMD} before filename (default: none).
                    202: # FETCH_AFTER_ARGS -
                    203: #                Arguments to ${FETCH_CMD} following filename (default: none).
1.1       niklas    204: #
                    205: # Motif support:
                    206: #
                    207: # REQUIRES_MOTIF - Set this in your port if it requires Motif.  It will  be
                    208: #                built only if HAVE_MOTIF is set.
                    209: # HAVE_MOTIF   - If set, means system has Motif.  Typically set in
1.13      imp       210: #                /etc/make.conf (FreeBSD,NetBSD) or
                    211: #                /etc/mk.conf (OpenBSD).
1.1       niklas    212: # MOTIF_STATIC - If set, link libXm statically; otherwise, link it
1.13      imp       213: #                dynamically.  Typically set in
                    214: #                /etc/make.conf (FreeBSD,NetBSD) or
                    215: #                /etc/mk.conf (OpenBSD).
1.6       niklas    216: # MOTIFLIB     - Set automatically to appropriate value depending on
                    217: #                ${MOTIF_STATIC}.  Substitute references to -lXm with
                    218: #                patches to make your port conform to our standards.
1.13      imp       219: # MOTIF_ONLY   - If set, build Motif ports only.  (Not much use except for
                    220: #                building packages.)
1.1       niklas    221: #
                    222: # Variables to change if you want a special behavior:
                    223: #
                    224: # ECHO_MSG     - Used to print all the '===>' style prompts - override this
                    225: #                to turn them off (default: /bin/echo).
1.13      imp       226: # DEPENDS_TARGET - The target to execute when a port is calling a
                    227: #                dependency (default: "install").
1.6       niklas    228: # PATCH_DEBUG  - If set, print out more information about the patches as
                    229: #                it attempts to apply them.
                    230: #
1.9       imp       231: # Variables that serve as convenient "aliases" for your *-install targets.
                    232: # Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".
1.6       niklas    233: #
                    234: # INSTALL_PROGRAM - A command to install binary executables.
                    235: # INSTALL_SCRIPT - A command to install executable scripts.
                    236: # INSTALL_DATA - A command to install sharable data.
                    237: # INSTALL_MAN  - A command to install manpages (doesn't compress).
1.1       niklas    238: #
1.9       imp       239: # If your port doesn't automatically compress manpages, set the following.
                    240: # Depending on the setting of NOMANCOMPRESS, the make rules will compress
                    241: # the manpages for you.
                    242: #
                    243: # MAN<sect>        - A list of manpages, categorized by section.  For
                    244: #                example, if your port has "man/man1/foo.1" and
                    245: #                "man/mann/bar.n", set "MAN1=foo.1" and "MANN=bar.n".
                    246: #                The available sections chars are "123456789LN".
                    247: # MANPREFIX        - The directory prefix for ${MAN<sect>} (default: ${PREFIX}).
                    248: #
1.1       niklas    249: # Default targets and their behaviors:
                    250: #
                    251: # fetch            - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
                    252: #                into ${DISTDIR} as necessary.
                    253: # fetch-list   - Show list of files that would be retrieved by fetch
                    254: # extract      - Unpacks ${DISTFILES} into ${WRKDIR}.
                    255: # patch            - Apply any provided patches to the source.
                    256: # configure        - Runs either GNU configure, one or more local configure
                    257: #                scripts or nothing, depending on what's available.
                    258: # build            - Actually compile the sources.
                    259: # install      - Install the results of a build.
                    260: # reinstall        - Install the results of a build, ignoring "already installed"
                    261: #                flag.
                    262: # package      - Create a package from an _installed_ port.
                    263: # describe     - Try to generate a one-line description for each port for
                    264: #                use in INDEX files and the like.
                    265: # checkpatch   - Do a "patch -C" instead of a "patch".  Note that it may
                    266: #                give incorrect results if multiple patches deal with
                    267: #                the same file.
                    268: # checksum     - Use files/md5 to ensure that your distfiles are valid.
                    269: # makesum      - Generate files/md5 (only do this for your own ports!).
                    270: #
                    271: # Default sequence for "all" is:  fetch checksum extract patch configure build
                    272: #
                    273: # Please read the comments in the targets section below, you
                    274: # should be able to use the pre-* or post-* targets/scripts
                    275: # (which are available for every stage except checksum) or
                    276: # override the do-* targets to do pretty much anything you want.
                    277: #
                    278: # NEVER override the "regular" targets unless you want to open
                    279: # a major can of worms.
                    280:
1.27    ! marc      281: .if defined(ONLY_FOR_ARCHS)
1.10      niklas    282: .for __ARCH in ${ONLY_FOR_ARCHS}
                    283: .if ${MACHINE} == "${__ARCH}"
                    284: __ARCH_OK= 1
                    285: .endif
                    286: .endfor
                    287: .else
                    288: __ARCH_OK= 1
                    289: .endif
                    290:
                    291: .if !defined(__ARCH_OK)
                    292: .MAIN: all
                    293:
1.25      marc      294: fetch fetch-list extract patch clean clean-depends configure build install reinstall package describe checkpatch checksum makesum all:
1.10      niklas    295:    @echo "This port is only for ${ONLY_FOR_ARCHS},"
                    296:    @echo "and you are running ${MACHINE}."
                    297: .else
                    298:
1.27    ! marc      299: # Get the operating system type
        !           300: OPSYS!=    uname -s
        !           301:
1.13      imp       302: # Get the architecture
                    303: ARCH!= uname -m
1.9       imp       304:
1.1       niklas    305: .if exists(${.CURDIR}/../Makefile.inc)
                    306: .include "${.CURDIR}/../Makefile.inc"
                    307: .endif
                    308:
1.9       imp       309: .if (${OPSYS} == "OpenBSD")
1.10      niklas    310: NOMANCOMPRESS?=    yes
1.14      niklas    311: DEF_UMASK?=        022
                    312: .else
                    313: DEF_UMASK?=        0022
1.9       imp       314: .endif
1.6       niklas    315:
1.13      imp       316: .if exists(${.CURDIR}/Makefile.${ARCH}-${OPSYS})
                    317: .include "${.CURDIR}/Makefile.${ARCH}-${OPSYS}"
                    318: .elif exists(${.CURDIR}/Makefile.${OPSYS})
                    319: .include "${.CURDIR}/Makefile.${OPSYS}"
                    320: .elif exists(${.CURDIR}/Makefile.${ARCH})
                    321: .include "${.CURDIR}/Makefile.${ARCH}"
                    322: .endif
                    323:
1.1       niklas    324: # These need to be absolute since we don't know how deep in the ports
                    325: # tree we are and thus can't go relative.  They can, of course, be overridden
1.9       imp       326: # by individual Makefiles or local system make configuration.
                    327: .if (${OPSYS} == "NetBSD")
1.13      imp       328: PORTSDIR?=     /usr/opt
1.9       imp       329: .else
1.13      imp       330: PORTSDIR?=     /usr/ports
1.9       imp       331: .endif
1.13      imp       332: LOCALBASE?=        ${DESTDIR}/usr/local
                    333: X11BASE?=      ${DESTDIR}/usr/X11R6
1.9       imp       334: DISTDIR?=      ${PORTSDIR}/distfiles
                    335: _DISTDIR?=     ${DISTDIR}/${DIST_SUBDIR}
1.1       niklas    336: PACKAGES?=     ${PORTSDIR}/packages
                    337: TEMPLATES?=        ${PORTSDIR}/templates
                    338: .if !defined(NO_WRKDIR)
1.10      niklas    339: .if defined(OBJMACHINE)
                    340: WRKDIR?=       ${.CURDIR}/work.${MACHINE}
                    341: .else
1.1       niklas    342: WRKDIR?=       ${.CURDIR}/work
1.10      niklas    343: .endif
1.1       niklas    344: .else
                    345: WRKDIR?=       ${.CURDIR}
                    346: .endif
                    347: .if defined(NO_WRKSUBDIR)
                    348: WRKSRC?=       ${WRKDIR}
                    349: .else
                    350: WRKSRC?=       ${WRKDIR}/${DISTNAME}
                    351: .endif
1.13      imp       352:
1.14      niklas    353: .if defined(WRKOBJDIR)
                    354: # XXX Is pwd -P available in FreeBSD's /bin/sh?
                    355: __canonical_PORTSDIR!= cd ${PORTSDIR}; pwd -P
                    356: __canonical_CURDIR!=   cd ${.CURDIR}; pwd -P
                    357: PORTSUBDIR=        ${__canonical_CURDIR:S,${__canonical_PORTSDIR}/,,}
                    358: .endif
                    359:
1.13      imp       360: .if exists(${.CURDIR}/patches.${ARCH}-${OPSYS})
                    361: PATCHDIR?=     ${.CURDIR}/patches.${ARCH}-${OPSYS}
                    362: .elif exists(${.CURDIR}/patches.${OPSYS})
                    363: PATCHDIR?=     ${.CURDIR}/patches.${OPSYS}
                    364: .elif exists(${.CURDIR}/patches.${ARCH})
                    365: PATCHDIR?=     ${.CURDIR}/patches.${ARCH}
                    366: .else
1.1       niklas    367: PATCHDIR?=     ${.CURDIR}/patches
1.13      imp       368: .endif
                    369:
                    370: .if exists(${.CURDIR}/scripts.${ARCH}-${OPSYS})
                    371: SCRIPTDIR?=        ${.CURDIR}/scripts.${ARCH}-${OPSYS}
                    372: .elif exists(${.CURDIR}/scripts.${OPSYS})
                    373: SCRIPTDIR?=        ${.CURDIR}/scripts.${OPSYS}
                    374: .elif exists(${.CURDIR}/scripts.${ARCH})
                    375: SCRIPTDIR?=        ${.CURDIR}/scripts.${ARCH}
                    376: .else
1.1       niklas    377: SCRIPTDIR?=        ${.CURDIR}/scripts
1.13      imp       378: .endif
                    379:
                    380: .if exists(${.CURDIR}/files.${ARCH}-${OPSYS})
                    381: FILESDIR?=     ${.CURDIR}/files.${ARCH}-${OPSYS}
                    382: .elif exists(${.CURDIR}/files.${OPSYS})
                    383: FILESDIR?=     ${.CURDIR}/files.${OPSYS}
                    384: .elif exists(${.CURDIR}/files.${ARCH})
                    385: FILESDIR?=     ${.CURDIR}/files.${ARCH}
                    386: .else
1.1       niklas    387: FILESDIR?=     ${.CURDIR}/files
1.13      imp       388: .endif
                    389:
                    390: .if exists(${.CURDIR}/pkg.${ARCH}-${OPSYS})
                    391: PKGDIR?=       ${.CURDIR}/pkg.${ARCH}-${OPSYS}
                    392: .elif exists(${.CURDIR}/pkg.${OPSYS})
                    393: PKGDIR?=       ${.CURDIR}/pkg.${OPSYS}
                    394: .elif exists(${.CURDIR}/pkg.${ARCH})
                    395: PKGDIR?=       ${.CURDIR}/pkg.${ARCH}
                    396: .else
1.1       niklas    397: PKGDIR?=       ${.CURDIR}/pkg
1.13      imp       398: .endif
                    399:
1.1       niklas    400: .if defined(USE_IMAKE) || defined(USE_X11)
                    401: PREFIX?=       ${X11BASE}
                    402: .else
                    403: PREFIX?=       ${LOCALBASE}
                    404: .endif
                    405: # The following 4 lines should go away as soon as the ports are all updated
                    406: .if defined(EXEC_DEPENDS)
                    407: BUILD_DEPENDS+=    ${EXEC_DEPENDS}
                    408: RUN_DEPENDS+=  ${EXEC_DEPENDS}
                    409: .endif
                    410: .if defined(USE_GMAKE)
1.13      imp       411: BUILD_DEPENDS+=        gmake:${PORTSDIR}/devel/gmake
                    412: .endif
1.15      niklas    413: # OpenBSD has perl5 in-tree
                    414: #.if defined(USE_PERL5)
                    415: #BUILD_DEPENDS+=       perl5.00401:${PORTSDIR}/lang/perl5
                    416: #RUN_DEPENDS+=     perl5.00401:${PORTSDIR}/lang/perl5
                    417: #.endif
1.1       niklas    418:
                    419: .if exists(${PORTSDIR}/../Makefile.inc)
                    420: .include "${PORTSDIR}/../Makefile.inc"
                    421: .endif
                    422:
                    423: # Don't change these!!!  These names are built into the _TARGET_USE macro,
                    424: # there is no way to refer to them cleanly from within the macro AFAIK.
                    425: EXTRACT_COOKIE?=   ${WRKDIR}/.extract_done
                    426: CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done
                    427: INSTALL_COOKIE?=   ${WRKDIR}/.install_done
                    428: BUILD_COOKIE?=     ${WRKDIR}/.build_done
                    429: PATCH_COOKIE?=     ${WRKDIR}/.patch_done
                    430: PACKAGE_COOKIE?=   ${WRKDIR}/.package_done
                    431:
                    432: # How to do nothing.  Override if you, for some strange reason, would rather
                    433: # do something.
1.6       niklas    434: DO_NADA?=      /usr/bin/true
1.1       niklas    435:
                    436: # Miscellaneous overridable commands:
                    437: GMAKE?=            gmake
                    438: XMKMF?=            xmkmf -a
1.13      imp       439: .if exists(/sbin/md5)
                    440: MD5?=          /sbin/md5
1.9       imp       441: .elif exists(/bin/md5)
1.4       deraadt   442: MD5?=          /bin/md5
1.13      imp       443: .elif exists(/usr/bin/md5)
                    444: MD5?=          /usr/bin/md5
1.9       imp       445: .else
1.13      imp       446: MD5?=          md5
1.9       imp       447: .endif
1.1       niklas    448: MD5_FILE?=     ${FILESDIR}/md5
                    449:
                    450: MAKE_FLAGS?=   -f
                    451: MAKEFILE?=     Makefile
                    452: MAKE_ENV+=     PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
                    453:
1.13      imp       454: .if exists(/usr/bin/fetch)
                    455: FETCH_CMD?=        /usr/bin/fetch
                    456: .else
1.6       niklas    457: FETCH_CMD?=        /usr/bin/ftp
1.9       imp       458: .endif
1.1       niklas    459:
                    460: TOUCH?=            /usr/bin/touch
                    461: TOUCH_FLAGS?=  -f
                    462:
                    463: PATCH?=            /usr/bin/patch
                    464: PATCH_STRIP?=  -p0
                    465: PATCH_DIST_STRIP?= -p0
                    466: .if defined(PATCH_DEBUG)
1.6       niklas    467: PATCH_DEBUG_TMP=   yes
1.1       niklas    468: PATCH_ARGS?=   -d ${WRKSRC} -E ${PATCH_STRIP}
                    469: PATCH_DIST_ARGS?=  -d ${WRKSRC} -E ${PATCH_DIST_STRIP}
                    470: .else
1.6       niklas    471: PATCH_DEBUG_TMP=   no
1.3       niklas    472: PATCH_ARGS?=   -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
                    473: PATCH_DIST_ARGS?=  -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
1.1       niklas    474: .endif
                    475: .if defined(BATCH)
                    476: PATCH_ARGS+=       --batch
                    477: PATCH_DIST_ARGS+=  --batch
                    478: .endif
                    479:
                    480: .if defined(PATCH_CHECK_ONLY)
                    481: PATCH_ARGS+=   -C
                    482: PATCH_DIST_ARGS+=  -C
                    483: .endif
                    484:
1.9       imp       485: .if exists(/bin/tar)
1.5       tholo     486: EXTRACT_CMD?=  /bin/tar
1.9       imp       487: .else
                    488: EXTRACT_CMD?=  /usr/bin/tar
                    489: .endif
1.1       niklas    490: EXTRACT_SUFX?= .tar.gz
                    491: # Backwards compatability.
                    492: .if defined(EXTRACT_ARGS)
                    493: EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
                    494: .else
                    495: EXTRACT_BEFORE_ARGS?=   -xzf
                    496: .endif
                    497:
                    498: # Figure out where the local mtree file is
1.13      imp       499: .if !defined(MTREE_FILE)
                    500: .if defined(USE_IMAKE) || defined(USE_X11)
                    501: MTREE_FILE=    /etc/mtree/BSD.x11.dist
                    502: .else
                    503: MTREE_FILE=    /etc/mtree/BSD.local.dist
                    504: .endif
1.1       niklas    505: .endif
                    506: MTREE_CMD?=    /usr/sbin/mtree
1.13      imp       507: MTREE_ARGS?=   -U -f ${MTREE_FILE} -d -e -p
1.1       niklas    508:
1.10      niklas    509: .if (${OPSYS} == "OpenBSD")
                    510: .include <bsd.own.mk>
                    511: MAKE_ENV+= EXTRA_SYS_MK_INCLUDES="<bsd.own.mk>"
                    512: .endif
                    513:
1.6       niklas    514: # A few aliases for *-install targets
                    515: INSTALL_PROGRAM= \
1.12      millert   516:    ${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
1.6       niklas    517: INSTALL_SCRIPT= \
1.12      millert   518:    ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
1.6       niklas    519: INSTALL_DATA= \
1.12      millert   520:    ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
1.6       niklas    521: INSTALL_MAN= \
1.12      millert   522:    ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
1.6       niklas    523:
1.13      imp       524: INSTALL_MACROS=    BSD_INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
                    525:            BSD_INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
                    526:            BSD_INSTALL_DATA="${INSTALL_DATA}" \
                    527:            BSD_INSTALL_MAN="${INSTALL_MAN}"
                    528: MAKE_ENV+= ${INSTALL_MACROS}
                    529: SCRIPTS_ENV+=  ${INSTALL_MACROS}
                    530:
1.1       niklas    531: # The user can override the NO_PACKAGE by specifying this from
                    532: # the make command line
                    533: .if defined(FORCE_PACKAGE)
                    534: .undef NO_PACKAGE
                    535: .endif
                    536:
1.13      imp       537: COMMENT?=  ${PKGDIR}/COMMENT
                    538: DESCR?=        ${PKGDIR}/DESCR
                    539: PLIST?=        ${PKGDIR}/PLIST
                    540:
1.1       niklas    541: PKG_CMD?=      /usr/sbin/pkg_create
                    542: .if !defined(PKG_ARGS)
1.13      imp       543: PKG_ARGS=      -v -c ${COMMENT} -d ${DESCR} -f ${PLIST} -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
1.1       niklas    544: .if exists(${PKGDIR}/INSTALL)
                    545: PKG_ARGS+=     -i ${PKGDIR}/INSTALL
                    546: .endif
                    547: .if exists(${PKGDIR}/DEINSTALL)
                    548: PKG_ARGS+=     -k ${PKGDIR}/DEINSTALL
                    549: .endif
                    550: .if exists(${PKGDIR}/REQ)
                    551: PKG_ARGS+=     -r ${PKGDIR}/REQ
                    552: .endif
1.9       imp       553: .if exists(${PKGDIR}/MESSAGE)
                    554: PKG_ARGS+=     -D ${PKGDIR}/MESSAGE
                    555: .endif
1.13      imp       556: .if !defined(NO_MTREE)
                    557: PKG_ARGS+=     -m ${MTREE_FILE}
1.1       niklas    558: .endif
                    559: .endif
                    560: PKG_SUFX?=     .tgz
                    561: # where pkg_add records its dirty deeds.
                    562: PKG_DBDIR?=        /var/db/pkg
                    563:
                    564: # shared/dynamic motif libs
                    565: .if defined(HAVE_MOTIF)
                    566: .if defined(MOTIF_STATIC)
                    567: MOTIFLIB?= ${X11BASE}/lib/libXm.a
                    568: .else
                    569: MOTIFLIB?= -L${X11BASE}/lib -lXm
                    570: .endif
                    571: .endif
                    572:
1.13      imp       573: AWK?=      /usr/bin/awk
                    574: BASENAME?= /usr/bin/basename
1.9       imp       575: CAT?=      /bin/cat
1.1       niklas    576: CP?=       /bin/cp
1.13      imp       577: ECHO?=     /bin/echo
1.9       imp       578: FALSE?=        /usr/bin/false
                    579: GREP?=     /usr/bin/grep
1.13      imp       580: GUNZIP_CMD?=   /usr/bin/gunzip -f
1.1       niklas    581: GZCAT?=        /usr/bin/gzcat
1.9       imp       582: GZIP?=     -9
                    583: GZIP_CMD?= /usr/bin/gzip -nf ${GZIP}
1.22      niklas    584: LDCONFIG?= [ ! -x /sbin/ldconfig ] || /sbin/ldconfig
1.14      niklas    585: LN?=       /bin/ln
1.13      imp       586: MKDIR?=        /bin/mkdir -p
                    587: MV?=       /bin/mv
1.18      niklas    588: READLINK?= /usr/bin/readlink
1.13      imp       589: RM?=       /bin/rm
                    590: RMDIR?=        /bin/rmdir
1.1       niklas    591: SED?=      /usr/bin/sed
1.20      todd      592: PORTSPATH?=    ${PATH}:${X11BASE}/bin:${LOCALBASE}/bin
                    593: SETENV?=   /usr/bin/env PATH=${PORTSPATH}
1.13      imp       594: SH?=       /bin/sh
                    595: TR?=       /usr/bin/tr
1.1       niklas    596:
                    597: # Used to print all the '===>' style prompts - override this to turn them off.
                    598: ECHO_MSG?=     ${ECHO}
                    599:
                    600: ALL_TARGET?=       all
                    601: INSTALL_TARGET?=   install
                    602:
1.9       imp       603: # Popular master sites
1.13      imp       604: MASTER_SITE_XCONTRIB+= \
                    605:    ftp://crl.dec.com/pub/X11/contrib/%SUBDIR%/ \
                    606:     ftp://ftp.eu.net/X11/contrib/%SUBDIR%/
                    607:
                    608: MASTER_SITE_GNU+=  \
                    609:    ftp://prep.ai.mit.edu/pub/gnu/%SUBDIR%/ \
                    610:    ftp://wuarchive.wustl.edu/systems/gnu/%SUBDIR%/
                    611:
                    612: MASTER_SITE_PERL_CPAN+=    \
                    613:    ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/%SUBDIR%/ \
                    614:    ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/%SUBDIR%/
                    615:
                    616: MASTER_SITE_TEX_CTAN+=  \
                    617:         ftp://ftp.cdrom.com/pub/tex/ctan/%SUBDIR%/  \
                    618:         ftp://wuarchive.wustl.edu/packages/TeX/%SUBDIR%/  \
                    619:         ftp://ftp.funet.fi/pub/TeX/CTAN/%SUBDIR%/  \
                    620:         ftp://ftp.tex.ac.uk/public/ctan/tex-archive/%SUBDIR%/  \
                    621:         ftp://ftp.dante.de/tex-archive/%SUBDIR%/
                    622:
                    623: MASTER_SITE_SUNSITE+=  \
                    624:    ftp://sunsite.unc.edu/pub/Linux/%SUBDIR%/ \
                    625:    ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/%SUBDIR%/ \
                    626:    ftp://ftp.funet.fi/pub/mirrors/sunsite.unc.edu/pub/Linux/%SUBDIR%/
                    627:
                    628: # Empty declaration to avoid "variable MASTER_SITES recursive" error
                    629: MASTER_SITES?=
                    630: PATCH_SITES?=
                    631:
                    632: # Substitute subdirectory names
                    633: MASTER_SITES:= ${MASTER_SITES:S/%SUBDIR%/${MASTER_SITE_SUBDIR}/}
                    634: PATCH_SITES:=  ${PATCH_SITES:S/%SUBDIR%/${PATCH_SITE_SUBDIR}/}
1.9       imp       635:
1.27    ! marc      636: # Two backup master sites, First one at ftp.openbsd.org
        !           637: #
        !           638: _MASTER_SITE_OPENBSD?= \
        !           639:    ftp://ftp.openbsd.org/pub/OpenBSD/distfiles/${DIST_SUBDIR}/
        !           640:
        !           641: # The second backup master site is ftp.freebsd.org
        !           642: #
        !           643: _MASTER_SITE_FREEBSD?= \
        !           644:    ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
        !           645:
        !           646: # set the backup master sites.
        !           647: #
1.9       imp       648: MASTER_SITE_BACKUP?=   \
1.27    ! marc      649:    ${_MASTER_SITE_OPENBSD} ${_MASTER_SITE_FREEBSD}
        !           650:
        !           651: # If the user has this set, go to the OpenBSD repository for everything.
        !           652: #
        !           653: .if defined(MASTER_SITE_OPENBSD)
        !           654: MASTER_SITE_OVERRIDE=  ${_MASTER_SITE_OPENBSD}
        !           655: .endif
1.9       imp       656:
                    657: # If the user has this set, go to the FreeBSD repository for everything.
1.27    ! marc      658: #
1.1       niklas    659: .if defined(MASTER_SITE_FREEBSD)
1.27    ! marc      660: MASTER_SITE_OVERRIDE=  ${_MASTER_SITE_FREEBSD}
1.1       niklas    661: .endif
                    662:
1.13      imp       663: # Where to put distfiles that don't have any other master site
1.27    ! marc      664: # ;;; This is referenced in a few Makefiles -- I'd like to get rid of it
        !           665: #
1.13      imp       666: MASTER_SITE_LOCAL?= \
                    667:    ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/LOCAL_PORTS/
                    668:
1.1       niklas    669: # I guess we're in the master distribution business! :)  As we gain mirror
                    670: # sites for distfiles, add them to this list.
                    671: .if !defined(MASTER_SITE_OVERRIDE)
1.9       imp       672: MASTER_SITES+= ${MASTER_SITE_BACKUP}
                    673: PATCH_SITES+=  ${MASTER_SITE_BACKUP}
1.1       niklas    674: .else
                    675: MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
                    676: PATCH_SITES:=  ${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
                    677: .endif
                    678:
1.7       niklas    679: # Search CDROM first if mounted, symlink instead of copy if
                    680: # FETCH_SYMLINK_DISTFILES is set
                    681: .if exists(/cdrom/ports/distfiles)
                    682: MASTER_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
                    683: PATCH_SITES:=  file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
                    684: .if defined(FETCH_SYMLINK_DISTFILES)
                    685: FETCH_BEFORE_ARGS+=    -l
                    686: .endif
                    687: .endif
                    688:
1.1       niklas    689: # Derived names so that they're easily overridable.
                    690: DISTFILES?=        ${DISTNAME}${EXTRACT_SUFX}
                    691: PKGNAME?=      ${DISTNAME}
                    692:
1.9       imp       693: ALLFILES?= ${DISTFILES} ${PATCHFILES}
                    694:
                    695: .if defined(IGNOREFILES)
                    696: CKSUMFILES!=   \
                    697:    for file in ${ALLFILES}; do \
                    698:        ignore=0; \
                    699:        for tmp in ${IGNOREFILES}; do \
                    700:            if [ "$$file" = "$$tmp" ]; then \
                    701:                ignore=1; \
                    702:            fi; \
                    703:        done; \
                    704:        if [ "$$ignore" = 0 ]; then \
                    705:            echo "$$file"; \
                    706:        fi; \
                    707:    done
                    708: .else
                    709: CKSUMFILES=        ${ALLFILES}
                    710: .endif
                    711:
                    712: # List of all files, with ${DIST_SUBDIR} in front.  Used for checksum.
                    713: .if defined(DIST_SUBDIR)
                    714: _CKSUMFILES?=  ${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
                    715: _IGNOREFILES?= ${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
                    716: .else
                    717: _CKSUMFILES?=  ${CKSUMFILES}
                    718: _IGNOREFILES?= ${IGNOREFILES}
                    719: .endif
                    720:
1.1       niklas    721: # This is what is actually going to be extracted, and is overridable
                    722: #  by user.
                    723: EXTRACT_ONLY?= ${DISTFILES}
                    724:
                    725: # Documentation
                    726: MAINTAINER?=   ports@FreeBSD.ORG
1.9       imp       727:
                    728: .if !defined(CATEGORIES)
                    729: .BEGIN:
                    730:    @${ECHO_MSG} "CATEGORIES is mandatory."
                    731:    @${FALSE}
                    732: .endif
1.1       niklas    733:
                    734: # Note this has to start with a capital letter (or more accurately, it
                    735: #  shouldn't match "[a-z]*"), see the target "delete-package-links" below.
                    736: PKGREPOSITORYSUBDIR?=  All
                    737: PKGREPOSITORY?=        ${PACKAGES}/${PKGREPOSITORYSUBDIR}
                    738: .if exists(${PACKAGES})
                    739: PKGFILE?=      ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
                    740: .else
                    741: PKGFILE?=      ${PKGNAME}${PKG_SUFX}
                    742: .endif
                    743:
                    744: CONFIGURE_SCRIPT?= configure
                    745:
                    746: .if defined(GNU_CONFIGURE)
                    747: CONFIGURE_ARGS+=   --prefix=${PREFIX}
                    748: HAS_CONFIGURE=     yes
                    749: .endif
                    750:
1.13      imp       751: # Passed to most of script invocations
                    752: SCRIPTS_ENV+=  CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
                    753:          WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
                    754:          SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
                    755:          PORTSDIR=${PORTSDIR} DEPENDS="${DEPENDS}" \
                    756:          PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
                    757:
                    758: .if defined(BATCH)
                    759: SCRIPTS_ENV+=  BATCH=yes
                    760: .endif
                    761:
1.9       imp       762: MANPREFIX?=    ${PREFIX}
                    763:
                    764: .for sect in 1 2 3 4 5 6 7 8 9
                    765: MAN${sect}PREFIX?= ${MANPREFIX}
                    766: .endfor
                    767: MANLPREFIX?=   ${MANPREFIX}
                    768: MANNPREFIX?=   ${MANPREFIX}
                    769:
                    770: MANLANG?=  ""  # english only by default
                    771:
                    772: .for lang in ${MANLANG}
                    773:
                    774: .for sect in 1 2 3 4 5 6 7 8 9
                    775: .if defined(MAN${sect})
                    776: _MANPAGES+=    ${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%}
                    777: .endif
                    778: .endfor
                    779:
                    780: .if defined(MANL)
                    781: _MANPAGES+=    ${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%}
                    782: .endif
                    783:
                    784: .if defined(MANN)
                    785: _MANPAGES+=    ${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
                    786: .endif
                    787:
                    788: .endfor
                    789:
                    790: .if defined(_MANPAGES) && defined(MANCOMPRESSED)
                    791: _MANPAGES:=    ${_MANPAGES:S/$/.gz/}
                    792: .endif
                    793:
1.1       niklas    794: .MAIN: all
                    795:
                    796: ################################################################
                    797: # Many ways to disable a port.
                    798: #
                    799: # If we're in BATCH mode and the port is interactive, or we're
                    800: # in interactive mode and the port is non-interactive, skip all
                    801: # the important targets.  The reason we have two modes is that
                    802: # one might want to leave a build in BATCH mode running
                    803: # overnight, then come back in the morning and do _only_ the
                    804: # interactive ones that required your intervention.
                    805: #
                    806: # Don't attempt to build ports that require Motif if you don't
                    807: # have Motif.
                    808: #
                    809: # Ignore ports that can't be resold if building for a CDROM.
                    810: #
                    811: # Don't build a port if it's restricted and we don't want to get
                    812: # into that.
                    813: #
                    814: # Don't build a port if it's broken.
1.27    ! marc      815: #
        !           816: # Don't build a port if it comes with the base system.
1.1       niklas    817: ################################################################
                    818:
1.13      imp       819: .if !defined(NO_IGNORE)
1.9       imp       820: .if (defined(IS_INTERACTIVE) && defined(BATCH))
                    821: IGNORE=    "is an interactive port"
                    822: .elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
                    823: IGNORE=    "is not an interactive port"
                    824: .elif (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF))
                    825: IGNORE=    "requires Motif"
1.13      imp       826: .elif (defined(MOTIF_ONLY) && !defined(REQUIRES_MOTIF))
                    827: IGNORE=    "does not require Motif"
1.9       imp       828: .elif (defined(NO_CDROM) && defined(FOR_CDROM))
                    829: IGNORE=    "may not be placed on a CDROM: ${NO_CDROM}"
                    830: .elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
                    831: IGNORE=    "is restricted: ${RESTRICTED}"
1.13      imp       832: .elif ((defined(USE_IMAKE) || defined(USE_X11)) && !exists(${X11BASE}))
                    833: IGNORE=    "uses X11, but ${X11BASE} not found"
1.9       imp       834: .elif defined(BROKEN)
                    835: IGNORE=    "is marked as broken: ${BROKEN}"
1.27    ! marc      836: .elif defined(COMES_WITH)
        !           837: OS_VER!=   uname -r
        !           838: .if ( ${OS_VER} >= ${COMES_WITH} )
        !           839: IGNORE= "comes with ${OPSYS} as of release ${COMES_WITH}"
        !           840: .endif
1.1       niklas    841: .endif
                    842:
                    843: .if defined(IGNORE)
1.9       imp       844: .if defined(IGNORE_SILENT)
                    845: IGNORECMD= ${DO_NADA}
                    846: .else
                    847: IGNORECMD= ${ECHO_MSG} "===>  ${PKGNAME} ${IGNORE}."
                    848: .endif
                    849: fetch:
                    850:    @${IGNORECMD}
                    851: checksum:
                    852:    @${IGNORECMD}
                    853: extract:
                    854:    @${IGNORECMD}
                    855: patch:
                    856:    @${IGNORECMD}
                    857: configure:
                    858:    @${IGNORECMD}
1.1       niklas    859: all:
1.9       imp       860:    @${IGNORECMD}
1.1       niklas    861: build:
1.9       imp       862:    @${IGNORECMD}
1.1       niklas    863: install:
1.9       imp       864:    @${IGNORECMD}
1.1       niklas    865: package:
1.9       imp       866:    @${IGNORECMD}
1.1       niklas    867: .endif
1.13      imp       868: .endif
1.1       niklas    869:
                    870: .if defined(ALL_HOOK)
                    871: all:
1.6       niklas    872:    @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
1.1       niklas    873:      DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
                    874:      PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                    875:      FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                    876:      DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
                    877:      RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
                    878:    ${ALL_HOOK}
                    879: .endif
                    880:
                    881: .if !target(all)
                    882: all: build
                    883: .endif
                    884:
1.13      imp       885: .if !defined(DEPENDS_TARGET)
                    886: .if make(reinstall)
                    887: DEPENDS_TARGET=    reinstall
                    888: .else
                    889: DEPENDS_TARGET=    install
1.1       niklas    890: .endif
                    891: .endif
                    892:
                    893: ################################################################
                    894: # The following are used to create easy dummy targets for
                    895: # disabling some bit of default target behavior you don't want.
                    896: # They still check to see if the target exists, and if so don't
                    897: # do anything, since you might want to set this globally for a
                    898: # group of ports in a Makefile.inc, but still be able to
                    899: # override from an individual Makefile.
                    900: ################################################################
                    901:
1.9       imp       902: # Disable checksum
                    903: .if defined(NO_CHECKSUM) && !target(checksum)
                    904: checksum: fetch
                    905:    @${DO_NADA}
                    906: .endif
                    907:
1.1       niklas    908: # Disable extract
                    909: .if defined(NO_EXTRACT) && !target(extract)
                    910: extract: checksum
                    911:    @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
                    912: checksum: fetch
                    913:    @${DO_NADA}
                    914: makesum:
                    915:    @${DO_NADA}
                    916: .endif
                    917:
1.9       imp       918: # Disable patch
                    919: .if defined(NO_PATCH) && !target(patch)
                    920: patch: extract
                    921:    @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
                    922: .endif
                    923:
1.1       niklas    924: # Disable configure
                    925: .if defined(NO_CONFIGURE) && !target(configure)
                    926: configure: patch
                    927:    @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
                    928: .endif
                    929:
                    930: # Disable build
                    931: .if defined(NO_BUILD) && !target(build)
                    932: build: configure
                    933:    @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
                    934: .endif
                    935:
1.9       imp       936: # Disable install
                    937: .if defined(NO_INSTALL) && !target(install)
                    938: install: build
                    939:    @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
                    940: .endif
                    941:
1.1       niklas    942: # Disable package
                    943: .if defined(NO_PACKAGE) && !target(package)
                    944: package:
1.9       imp       945: .if defined(IGNORE_SILENT)
1.1       niklas    946:    @${DO_NADA}
1.9       imp       947: .else
                    948:    @${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
1.1       niklas    949: .endif
                    950: .endif
                    951:
1.9       imp       952: # Disable describe
                    953: .if defined(NO_DESCRIBE) && !target(describe)
                    954: describe:
                    955:    @${DO_NADA}
1.1       niklas    956: .endif
                    957:
                    958: ################################################################
                    959: # More standard targets start here.
                    960: #
                    961: # These are the body of the build/install framework.  If you are
                    962: # not happy with the default actions, and you can't solve it by
                    963: # adding pre-* or post-* targets/scripts, override these.
                    964: ################################################################
                    965:
                    966: # Fetch
                    967:
                    968: .if !target(do-fetch)
                    969: do-fetch:
1.9       imp       970:    @${MKDIR} ${_DISTDIR}
                    971:    @(cd ${_DISTDIR}; \
1.1       niklas    972:     for file in ${DISTFILES}; do \
                    973:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    974:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp       975:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas    976:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                    977:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                    978:                exit 1; \
                    979:            fi ; \
                    980:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                    981:            for site in ${MASTER_SITES}; do \
                    982:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas    983:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas    984:                    continue 2; \
                    985:                fi \
                    986:            done; \
1.6       niklas    987:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp       988:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas    989:            exit 1; \
                    990:        fi \
                    991:     done)
                    992: .if defined(PATCHFILES)
1.9       imp       993:    @(cd ${_DISTDIR}; \
1.1       niklas    994:     for file in ${PATCHFILES}; do \
                    995:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    996:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp       997:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas    998:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                    999:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                   1000:                exit 1; \
                   1001:            fi ; \
                   1002:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                   1003:            for site in ${PATCH_SITES}; do \
                   1004:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas   1005:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas   1006:                    continue 2; \
                   1007:                fi \
                   1008:            done; \
1.6       niklas   1009:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp      1010:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas   1011:            exit 1; \
                   1012:        fi \
                   1013:     done)
                   1014: .endif
                   1015: .endif
                   1016:
                   1017: # Extract
                   1018:
                   1019: .if !target(do-extract)
                   1020: do-extract:
1.6       niklas   1021: .if !defined(NO_WRKDIR)
1.14      niklas   1022: .if defined(WRKOBJDIR)
                   1023:    @${RM} -rf ${WRKOBJDIR}/${PORTSUBDIR}
1.18      niklas   1024:    @${MKDIR} ${WRKOBJDIR}/${PORTSUBDIR}
                   1025:    @if [ ! -L ${WRKDIR} ] || \
                   1026:      [ X`${READLINK} ${WRKDIR}` != X${WRKOBJDIR}/${PORTSUBDIR} ]; then \
                   1027:        echo "${WRKDIR} -> ${WRKOBJDIR}/${PORTSUBDIR}"; \
                   1028:        ${RM} -f ${WRKDIR}; \
                   1029:        ${LN} -sf ${WRKOBJDIR}/${PORTSUBDIR} ${WRKDIR}; \
                   1030:    fi
1.14      niklas   1031: .else
1.1       niklas   1032:    @${RM} -rf ${WRKDIR}
1.9       imp      1033:    @${MKDIR} ${WRKDIR}
1.6       niklas   1034: .endif
1.14      niklas   1035: .endif
1.1       niklas   1036:    @for file in ${EXTRACT_ONLY}; do \
1.10      niklas   1037:        if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1.1       niklas   1038:        then \
                   1039:            exit 1; \
                   1040:        fi \
                   1041:    done
                   1042: .endif
                   1043:
                   1044: # Patch
                   1045:
                   1046: .if !target(do-patch)
                   1047: do-patch:
                   1048: .if defined(PATCHFILES)
                   1049:    @${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
1.9       imp      1050:    @(cd ${_DISTDIR}; \
1.1       niklas   1051:      for i in ${PATCHFILES}; do \
1.6       niklas   1052:        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
                   1053:            ${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
                   1054:        fi; \
1.1       niklas   1055:        case $$i in \
                   1056:            *.Z|*.gz) \
                   1057:                ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
                   1058:                ;; \
                   1059:            *) \
                   1060:                ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
                   1061:                ;; \
                   1062:        esac; \
                   1063:      done)
                   1064: .endif
                   1065:    @if [ -d ${PATCHDIR} ]; then \
1.6       niklas   1066:        if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
                   1067:            ${ECHO_MSG} "===>   Ignoring empty patch directory"; \
                   1068:            if [ -d ${PATCHDIR}/CVS ]; then \
                   1069:                ${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
                   1070:            fi; \
                   1071:        else \
1.9       imp      1072:            ${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
1.6       niklas   1073:            for i in ${PATCHDIR}/patch-*; do \
                   1074:                case $$i in \
1.13      imp      1075:                    *.orig|*.rej|*~) \
1.6       niklas   1076:                        ${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
                   1077:                        ;; \
                   1078:                    *) \
                   1079:                        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1.9       imp      1080:                            ${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
1.6       niklas   1081:                        fi; \
                   1082:                        ${PATCH} ${PATCH_ARGS} < $$i; \
                   1083:                        ;; \
                   1084:                esac; \
                   1085:            done; \
                   1086:        fi; \
1.1       niklas   1087:    fi
                   1088: .endif
                   1089:
                   1090: # Configure
                   1091:
                   1092: .if !target(do-configure)
                   1093: do-configure:
1.7       niklas   1094:    @if [ -f ${SCRIPTDIR}/configure ]; then \
1.13      imp      1095:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1096:          ${SCRIPTDIR}/configure; \
1.1       niklas   1097:    fi
                   1098: .if defined(HAS_CONFIGURE)
1.6       niklas   1099:    @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
1.1       niklas   1100:        INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1.6       niklas   1101:        INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1.1       niklas   1102:        ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
                   1103: .endif
                   1104: .if defined(USE_IMAKE)
1.20      todd     1105:    @(cd ${WRKSRC} && ${SETENV} ${XMKMF})
1.1       niklas   1106: .endif
                   1107: .endif
                   1108:
                   1109: # Build
                   1110:
                   1111: .if !target(do-build)
                   1112: do-build:
                   1113: .if defined(USE_GMAKE)
                   1114:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                   1115: .else defined(USE_GMAKE)
                   1116:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                   1117: .endif
                   1118: .endif
                   1119:
                   1120: # Install
                   1121:
                   1122: .if !target(do-install)
                   1123: do-install:
                   1124: .if defined(USE_GMAKE)
1.6       niklas   1125:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1       niklas   1126: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6       niklas   1127:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1       niklas   1128: .endif
                   1129: .else defined(USE_GMAKE)
1.6       niklas   1130:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1       niklas   1131: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6       niklas   1132:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1       niklas   1133: .endif
                   1134: .endif
                   1135: .endif
                   1136:
                   1137: # Package
                   1138:
                   1139: .if !target(do-package)
                   1140: do-package:
1.13      imp      1141:    @if [ -e ${PLIST} ]; then \
1.1       niklas   1142:        ${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
                   1143:        if [ -d ${PACKAGES} ]; then \
                   1144:            if [ ! -d ${PKGREPOSITORY} ]; then \
1.9       imp      1145:                if ! ${MKDIR} ${PKGREPOSITORY}; then \
1.1       niklas   1146:                    ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
                   1147:                    exit 1; \
                   1148:                fi; \
                   1149:            fi; \
                   1150:        fi; \
                   1151:        if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
                   1152:            if [ -d ${PACKAGES} ]; then \
                   1153:                ${MAKE} ${.MAKEFLAGS} package-links; \
                   1154:            fi; \
                   1155:        else \
                   1156:            ${MAKE} ${.MAKEFLAGS} delete-package; \
                   1157:            exit 1; \
                   1158:        fi; \
                   1159:    fi
                   1160: .endif
                   1161:
                   1162: # Some support rules for do-package
                   1163:
                   1164: .if !target(package-links)
                   1165: package-links:
                   1166:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                   1167:    @for cat in ${CATEGORIES}; do \
                   1168:        if [ ! -d ${PACKAGES}/$$cat ]; then \
1.9       imp      1169:            if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1.1       niklas   1170:                ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
                   1171:                exit 1; \
                   1172:            fi; \
                   1173:        fi; \
                   1174:        ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
                   1175:    done;
                   1176: .endif
                   1177:
                   1178: .if !target(delete-package-links)
                   1179: delete-package-links:
                   1180:    @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
                   1181: .endif
                   1182:
                   1183: .if !target(delete-package)
                   1184: delete-package:
                   1185:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                   1186:    @${RM} -f ${PKGFILE}
                   1187: .endif
                   1188:
                   1189: ################################################################
                   1190: # This is the "generic" port target, actually a macro used from the
                   1191: # six main targets.  See below for more.
                   1192: ################################################################
                   1193:
                   1194: _PORT_USE: .USE
                   1195: .if make(real-fetch)
1.6       niklas   1196:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1.1       niklas   1197: .endif
                   1198: .if make(real-extract)
1.6       niklas   1199:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1.1       niklas   1200: .endif
                   1201: .if make(real-install)
1.13      imp      1202: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
                   1203:    @if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
                   1204:        ${ECHO_MSG} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
                   1205:        ${ECHO_MSG} "      If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
                   1206:        ${ECHO_MSG} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
                   1207:        ${ECHO_MSG} "      If you really wish to overwrite the old port of ${PKGNAME}"; \
                   1208:        ${ECHO_MSG} "      without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
                   1209:        ${ECHO_MSG} "      in your environment or the \"make install\" command line."; \
                   1210:        exit 1; \
                   1211:    fi
                   1212: .endif
1.14      niklas   1213:    @if [ `${SH} -c umask` != ${DEF_UMASK} ]; then \
1.13      imp      1214:        ${ECHO_MSG} "===>  Warning: your umask is \"`${SH} -c umask`"\".; \
                   1215:        ${ECHO_MSG} "      If this is not desired, set it to an appropriate value"; \
                   1216:        ${ECHO_MSG} "      and install this port again by \`\`make reinstall''."; \
                   1217:    fi
1.9       imp      1218:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1.1       niklas   1219: .endif
                   1220: .if make(real-install)
                   1221: .if !defined(NO_MTREE)
                   1222:    @if [ `id -u` = 0 ]; then \
1.13      imp      1223:        if [ ! -f ${MTREE_FILE} ]; then \
                   1224:            ${ECHO_MSG} "Error: mtree file \"${MTREE_FILE}\" is missing."; \
                   1225:            ${ECHO_MSG} "Copy it from a suitable location (e.g., /usr/src/etc/mtree) and try again."; \
                   1226:            exit 1; \
                   1227:        else \
                   1228:            ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
                   1229:        fi; \
1.1       niklas   1230:    else \
                   1231:        ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
                   1232:        ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
                   1233:    fi
                   1234: .endif
                   1235: .endif
1.6       niklas   1236:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1.1       niklas   1237:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1.13      imp      1238:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1239:            ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
1.1       niklas   1240:    fi
1.6       niklas   1241:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
                   1242:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1.1       niklas   1243:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1.13      imp      1244:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1245:            ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
1.1       niklas   1246:    fi
1.9       imp      1247: .if make(real-install) && defined(_MANPAGES)
                   1248: .if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS)
                   1249:    @${ECHO_MSG} "===>   Uncompressing manual pages for ${PKGNAME}"
                   1250: .for manpage in ${_MANPAGES}
                   1251:    @${GUNZIP_CMD} ${manpage}
                   1252: .endfor
                   1253: .elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS)
                   1254:    @${ECHO_MSG} "===>   Compressing manual pages for ${PKGNAME}"
                   1255: .for manpage in ${_MANPAGES}
                   1256:    @${GZIP_CMD} ${manpage}
                   1257: .endfor
                   1258: .endif
                   1259: .endif
                   1260: .if make(real-install) && !defined(NO_PKG_REGISTER)
1.6       niklas   1261:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1.1       niklas   1262: .endif
                   1263: .if !make(real-fetch) \
                   1264:    && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
                   1265:    && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
                   1266:    @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
                   1267: .endif
                   1268:
                   1269: ################################################################
                   1270: # Skeleton targets start here
                   1271: #
                   1272: # You shouldn't have to change these.  Either add the pre-* or
                   1273: # post-* targets/scripts or redefine the do-* targets.  These
                   1274: # targets don't do anything other than checking for cookies and
                   1275: # call the necessary targets/scripts.
                   1276: ################################################################
                   1277:
                   1278: .if !target(fetch)
                   1279: fetch:
1.6       niklas   1280:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1.1       niklas   1281: .endif
                   1282:
                   1283: .if !target(extract)
                   1284: extract: checksum ${EXTRACT_COOKIE}
                   1285: .endif
                   1286:
                   1287: .if !target(patch)
                   1288: patch: extract ${PATCH_COOKIE}
                   1289: .endif
                   1290:
                   1291: .if !target(configure)
                   1292: configure: patch ${CONFIGURE_COOKIE}
                   1293: .endif
                   1294:
                   1295: .if !target(build)
                   1296: build: configure ${BUILD_COOKIE}
                   1297: .endif
                   1298:
                   1299: .if !target(install)
                   1300: install: build ${INSTALL_COOKIE}
                   1301: .endif
                   1302:
                   1303: .if !target(package)
                   1304: package: install ${PACKAGE_COOKIE}
                   1305: .endif
                   1306:
                   1307: ${EXTRACT_COOKIE}:
1.6       niklas   1308:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1.1       niklas   1309: ${PATCH_COOKIE}:
1.6       niklas   1310:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1.1       niklas   1311: ${CONFIGURE_COOKIE}:
1.6       niklas   1312:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1.1       niklas   1313: ${BUILD_COOKIE}:
1.6       niklas   1314:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1.1       niklas   1315: ${INSTALL_COOKIE}:
1.6       niklas   1316:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1.1       niklas   1317: ${PACKAGE_COOKIE}:
1.6       niklas   1318:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1.1       niklas   1319:
                   1320: # And call the macros
                   1321:
                   1322: real-fetch: _PORT_USE
                   1323: real-extract: _PORT_USE
                   1324:    @${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
                   1325: real-patch: _PORT_USE
                   1326:    @${ECHO_MSG} "===>  Patching for ${PKGNAME}"
                   1327: real-configure: _PORT_USE
                   1328:    @${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
                   1329: real-build: _PORT_USE
                   1330:    @${ECHO_MSG} "===>  Building for ${PKGNAME}"
                   1331: real-install: _PORT_USE
                   1332:    @${ECHO_MSG} "===>  Installing for ${PKGNAME}"
                   1333: real-package: _PORT_USE
                   1334:
                   1335: # Empty pre-* and post-* targets, note we can't use .if !target()
                   1336: # in the _PORT_USE macro
                   1337:
                   1338: .for name in fetch extract patch configure build install package
                   1339:
                   1340: .if !target(pre-${name})
                   1341: pre-${name}:
                   1342:    @${DO_NADA}
                   1343: .endif
                   1344:
                   1345: .if !target(post-${name})
                   1346: post-${name}:
                   1347:    @${DO_NADA}
                   1348: .endif
                   1349:
                   1350: .endfor
                   1351:
                   1352: # Checkpatch
                   1353: #
                   1354: # Special target to verify patches
                   1355:
                   1356: .if !target(checkpatch)
                   1357: checkpatch:
1.6       niklas   1358:    @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1.1       niklas   1359: .endif
                   1360:
                   1361: # Reinstall
                   1362: #
                   1363: # Special target to re-run install
                   1364:
                   1365: .if !target(reinstall)
1.13      imp      1366: reinstall:
                   1367:    @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
                   1368:    @DEPENDS_TARGET=${DEPENDS_TARGET} ${MAKE} install
1.1       niklas   1369: .endif
                   1370:
                   1371: ################################################################
                   1372: # Some more targets supplied for users' convenience
                   1373: ################################################################
                   1374:
                   1375: # Cleaning up
                   1376:
                   1377: .if !target(pre-clean)
                   1378: pre-clean:
                   1379:    @${DO_NADA}
                   1380: .endif
                   1381:
                   1382: .if !target(clean)
                   1383: clean: pre-clean
1.9       imp      1384: .if !defined(NOCLEANDEPENDS)
                   1385:    @${MAKE} clean-depends
                   1386: .endif
1.1       niklas   1387:    @${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
1.6       niklas   1388: .if !defined(NO_WRKDIR)
1.9       imp      1389:    @if [ -d ${WRKDIR} ]; then \
                   1390:        if [ -w ${WRKDIR} ]; then \
                   1391:            ${RM} -rf ${WRKDIR}; \
                   1392:        else \
                   1393:            ${ECHO_MSG} "===>   ${WRKDIR} not writable, skipping"; \
                   1394:        fi; \
                   1395:    fi
1.6       niklas   1396: .else
1.1       niklas   1397:    @${RM} -f ${WRKDIR}/.*_done
                   1398: .endif
                   1399: .endif
                   1400:
1.9       imp      1401: .if !target(pre-distclean)
                   1402: pre-distclean:
                   1403:    @${DO_NADA}
                   1404: .endif
                   1405:
                   1406: .if !target(distclean)
                   1407: distclean: pre-distclean clean
                   1408:    @${ECHO_MSG} "===>  Dist cleaning for ${PKGNAME}"
1.13      imp      1409:    @(if [ -d ${_DISTDIR} ]; then \
                   1410:        cd ${_DISTDIR}; \
                   1411:        ${RM} -f ${DISTFILES} ${PATCHFILES}; \
                   1412:    fi)
1.9       imp      1413: .if defined(DIST_SUBDIR)
1.13      imp      1414:    -@${RMDIR} ${_DISTDIR}
1.9       imp      1415: .endif
                   1416: .endif
                   1417:
1.1       niklas   1418: # Prints out a list of files to fetch (useful to do a batch fetch)
                   1419:
                   1420: .if !target(fetch-list)
                   1421: fetch-list:
1.9       imp      1422:    @${MKDIR} ${_DISTDIR}
                   1423:    @(cd ${_DISTDIR}; \
1.1       niklas   1424:     for file in ${DISTFILES}; do \
                   1425:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1426:            for site in ${MASTER_SITES}; do \
1.6       niklas   1427:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1       niklas   1428:                    break; \
                   1429:            done; \
                   1430:            ${ECHO} "echo $${file} not fetched" ; \
                   1431:        fi \
                   1432:    done)
                   1433: .if defined(PATCHFILES)
1.9       imp      1434:    @(cd ${_DISTDIR}; \
1.1       niklas   1435:     for file in ${PATCHFILES}; do \
                   1436:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1437:            for site in ${PATCH_SITES}; do \
1.6       niklas   1438:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1       niklas   1439:                    break; \
                   1440:            done; \
                   1441:            ${ECHO} "echo $${file} not fetched" ; \
                   1442:        fi \
                   1443:     done)
                   1444: .endif
                   1445: .endif
                   1446:
                   1447: # Checksumming utilities
                   1448:
                   1449: .if !target(makesum)
                   1450: makesum: fetch
1.9       imp      1451:    @${MKDIR} ${FILESDIR}
1.1       niklas   1452:    @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
                   1453:    @(cd ${DISTDIR}; \
1.9       imp      1454:     for file in ${_CKSUMFILES}; do \
1.1       niklas   1455:        ${MD5} $$file >> ${MD5_FILE}; \
                   1456:     done)
1.9       imp      1457:    @for file in ${_IGNOREFILES}; do \
                   1458:        ${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
                   1459:    done
1.1       niklas   1460: .endif
                   1461:
                   1462: .if !target(checksum)
                   1463: checksum: fetch
                   1464:    @if [ ! -f ${MD5_FILE} ]; then \
                   1465:        ${ECHO_MSG} ">> No MD5 checksum file."; \
                   1466:    else \
1.9       imp      1467:        (cd ${DISTDIR}; OK="true"; \
                   1468:          for file in ${_CKSUMFILES}; do \
1.6       niklas   1469:            CKSUM=`${MD5} < $$file`; \
1.13      imp      1470:            CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1.1       niklas   1471:            if [ "$$CKSUM2" = "" ]; then \
1.9       imp      1472:                ${ECHO_MSG} ">> No checksum recorded for $$file."; \
                   1473:                OK="false"; \
                   1474:            elif [ "$$CKSUM2" = "IGNORE" ]; then \
                   1475:                ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
                   1476:                ${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
1.1       niklas   1477:                OK="false"; \
1.13      imp      1478:            elif [ "$$CKSUM" = "$$CKSUM2" ]; then \
                   1479:                ${ECHO_MSG} ">> Checksum OK for $$file."; \
                   1480:            else \
1.9       imp      1481:                ${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1.13      imp      1482:                OK="false"; \
1.1       niklas   1483:            fi; \
                   1484:          done; \
1.9       imp      1485:          for file in ${_IGNOREFILES}; do \
                   1486:            CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
                   1487:            if [ "$$CKSUM2" = "" ]; then \
                   1488:                ${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
                   1489:                OK="false"; \
                   1490:            elif [ "$$CKSUM2" != "IGNORE" ]; then \
                   1491:                ${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
                   1492:                ${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
                   1493:                OK="false"; \
                   1494:            fi; \
                   1495:          done; \
1.13      imp      1496:          if [ "$$OK" != "true" ]; then \
                   1497:            ${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
                   1498:            ${ECHO_MSG} "are up to date.  If you want to override this check, type"; \
                   1499:            ${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \
                   1500:            exit 1; \
1.1       niklas   1501:          fi) ; \
                   1502:    fi
                   1503: .endif
                   1504:
                   1505: ################################################################
                   1506: # The special package-building targets
                   1507: # You probably won't need to touch these
                   1508: ################################################################
                   1509:
                   1510: # Nobody should want to override this unless PKGNAME is simply bogus.
                   1511:
                   1512: .if !target(package-name)
                   1513: package-name:
                   1514:    @${ECHO} ${PKGNAME}
                   1515: .endif
                   1516:
                   1517: # Show (recursively) all the packages this package depends on.
                   1518:
                   1519: .if !target(package-depends)
                   1520: package-depends:
1.13      imp      1521:    @for dir in `${ECHO} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
                   1522:        if [ -d $$dir ]; then \
                   1523:            (cd $$dir ; ${MAKE} package-name package-depends); \
                   1524:        else \
                   1525:            ${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
                   1526:        fi; \
1.1       niklas   1527:    done
                   1528: .endif
                   1529:
                   1530: # Build a package but don't check the package cookie
                   1531:
                   1532: .if !target(repackage)
                   1533: repackage: pre-repackage package
                   1534:
                   1535: pre-repackage:
                   1536:    @${RM} -f ${PACKAGE_COOKIE}
                   1537: .endif
                   1538:
                   1539: # Build a package but don't check the cookie for installation, also don't
                   1540: # install package cookie
                   1541:
                   1542: .if !target(package-noinstall)
                   1543: package-noinstall:
1.6       niklas   1544:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1       niklas   1545: .endif
                   1546:
                   1547: ################################################################
                   1548: # Dependency checking
                   1549: ################################################################
                   1550:
                   1551: .if !target(depends)
                   1552: depends: lib-depends misc-depends
1.6       niklas   1553:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
                   1554:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
                   1555:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1       niklas   1556:
                   1557: .if make(fetch-depends)
                   1558: DEPENDS_TMP+=  ${FETCH_DEPENDS}
                   1559: .endif
                   1560:
                   1561: .if make(build-depends)
                   1562: DEPENDS_TMP+=  ${BUILD_DEPENDS}
                   1563: .endif
                   1564:
                   1565: .if make(run-depends)
                   1566: DEPENDS_TMP+=  ${RUN_DEPENDS}
                   1567: .endif
                   1568:
                   1569: _DEPENDS_USE:  .USE
                   1570: .if defined(DEPENDS_TMP)
1.13      imp      1571: .if !defined(NO_DEPENDS)
1.20      todd     1572:    @PATH=${PORTSPATH}; for i in ${DEPENDS_TMP}; do \
1.1       niklas   1573:        prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13      imp      1574:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1575:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1576:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1577:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1.1       niklas   1578:        else \
1.13      imp      1579:            target=${DEPENDS_TARGET}; \
1.1       niklas   1580:        fi; \
                   1581:        if expr "$$prog" : \\/ >/dev/null; then \
                   1582:            if [ -e "$$prog" ]; then \
                   1583:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - found"; \
                   1584:                notfound=0; \
                   1585:            else \
                   1586:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - not found"; \
                   1587:                notfound=1; \
                   1588:            fi; \
                   1589:        else \
1.9       imp      1590:            if which "$$prog" > /dev/null 2>&1 ; then \
1.1       niklas   1591:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
                   1592:                notfound=0; \
                   1593:            else \
                   1594:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
                   1595:                notfound=1; \
                   1596:            fi; \
                   1597:        fi; \
                   1598:        if [ $$notfound != 0 ]; then \
1.13      imp      1599:            ${ECHO_MSG} "===>  Verifying $$target for $$prog in $$dir"; \
1.1       niklas   1600:            if [ ! -d "$$dir" ]; then \
                   1601:                ${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
                   1602:            else \
1.13      imp      1603:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1604:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1605:            fi; \
                   1606:        fi; \
                   1607:    done
                   1608: .endif
                   1609: .else
                   1610:    @${DO_NADA}
                   1611: .endif
                   1612:
                   1613: fetch-depends: _DEPENDS_USE
                   1614: build-depends: _DEPENDS_USE
                   1615: run-depends:   _DEPENDS_USE
                   1616:
                   1617: lib-depends:
                   1618: .if defined(LIB_DEPENDS)
1.13      imp      1619: .if !defined(NO_DEPENDS)
1.16      niklas   1620: .if (${MACHINE_ARCH} == "alpha")
                   1621:    @for i in ${LIB_DEPENDS}; do \
1.24      niklas   1622:        lib=`${ECHO} $$i | ${SED} -e 's/\\\.[0-9][0-9]*\\\.[0-9]*:.*//'`; \
1.16      niklas   1623:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1624:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1625:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1626:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1627:        else \
                   1628:            target=${DEPENDS_TARGET}; \
                   1629:        fi; \
1.17      niklas   1630:        tmp=`mktemp /tmp/bpmXXXXXXXXXX`; \
                   1631:        if ${LD} -r -o $$tmp -l$$lib; then \
1.16      niklas   1632:            ${ECHO_MSG} "===>  ${PKGNAME} depends on library: $$lib - found"; \
                   1633:        else \
                   1634:            ${ECHO_MSG} "===>  ${PKGNAME} depends on library: $$lib - not found"; \
                   1635:            ${ECHO_MSG} "===>  Verifying $$target for $$lib in $$dir"; \
                   1636:            if [ ! -d "$$dir" ]; then \
                   1637:                ${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
                   1638:            else \
                   1639:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
                   1640:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1641:            fi; \
                   1642:        fi; \
1.17      niklas   1643:        ${RM} -f $$tmp; \
1.16      niklas   1644:    done
                   1645: .else
1.1       niklas   1646:    @for i in ${LIB_DEPENDS}; do \
                   1647:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13      imp      1648:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1649:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1650:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1651:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1652:        else \
                   1653:            target=${DEPENDS_TARGET}; \
                   1654:        fi; \
1.1       niklas   1655:        if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \
                   1656:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \
                   1657:        else \
                   1658:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \
1.13      imp      1659:            ${ECHO_MSG} "===>  Verifying $$target for $$lib in $$dir"; \
1.1       niklas   1660:            if [ ! -d "$$dir" ]; then \
                   1661:                ${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
                   1662:            else \
1.13      imp      1663:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1664:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1665:            fi; \
                   1666:        fi; \
                   1667:    done
1.16      niklas   1668: .endif
1.1       niklas   1669: .endif
                   1670: .else
                   1671:    @${DO_NADA}
                   1672: .endif
                   1673:
                   1674: misc-depends:
                   1675: .if defined(DEPENDS)
                   1676: .if !defined(NO_DEPENDS)
1.13      imp      1677:    @for dir in ${DEPENDS}; do \
                   1678:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1679:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1680:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1681:        else \
                   1682:            target=${DEPENDS_TARGET}; \
                   1683:        fi; \
                   1684:        ${ECHO_MSG} "===>  ${PKGNAME} depends on: $$dir"; \
                   1685:        ${ECHO_MSG} "===>  Verifying $$target for $$dir"; \
                   1686:        if [ ! -d $$dir ]; then \
                   1687:            ${ECHO_MSG} ">> No directory for $$dir.  Skipping.."; \
1.1       niklas   1688:        else \
1.13      imp      1689:            (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1690:        fi \
                   1691:    done
                   1692:    @${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
                   1693: .endif
                   1694: .else
                   1695:    @${DO_NADA}
                   1696: .endif
                   1697:
                   1698: .endif
                   1699:
1.9       imp      1700: .if !target(clean-depends)
                   1701: clean-depends:
                   1702: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
                   1703:    || defined(RUN_DEPENDS)
1.13      imp      1704:    @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
                   1705:        if [ -d $$dir ] ; then \
                   1706:            (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
                   1707:        fi \
1.9       imp      1708:    done
                   1709: .endif
                   1710: .if defined(DEPENDS)
1.13      imp      1711:    @for dir in `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
                   1712:        if [ -d $$dir ] ; then \
                   1713:            (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
                   1714:        fi \
1.9       imp      1715:    done
                   1716: .endif
                   1717: .endif
                   1718:
1.1       niklas   1719: .if !target(depends-list)
                   1720: depends-list:
1.13      imp      1721:    @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
1.9       imp      1722:        (cd $$dir; ${MAKE} package-name depends-list); \
1.1       niklas   1723:    done
                   1724: .endif
                   1725:
                   1726: ################################################################
                   1727: # Everything after here are internal targets and really
                   1728: # shouldn't be touched by anybody but the release engineers.
                   1729: ################################################################
                   1730:
                   1731: # This target generates an index entry suitable for aggregation into
                   1732: # a large index.  Format is:
                   1733: #
                   1734: # distribution-name|port-path|installation-prefix|comment| \
                   1735: #  description-file|maintainer|categories|build deps|run deps
                   1736: #
                   1737: .if !target(describe)
                   1738: describe:
1.13      imp      1739:    @${ECHO} -n "${PKGNAME}|${.CURDIR}|"; \
                   1740:    ${ECHO} -n "${PREFIX}|"; \
                   1741:    if [ -f ${COMMENT} ]; then \
                   1742:        ${ECHO} -n "`${CAT} ${COMMENT}`"; \
1.1       niklas   1743:    else \
                   1744:        ${ECHO} -n "** No Description"; \
1.13      imp      1745:    fi; \
                   1746:    if [ -f ${DESCR} ]; then \
                   1747:        ${ECHO} -n "|${DESCR}"; \
1.1       niklas   1748:    else \
                   1749:        ${ECHO} -n "|/dev/null"; \
1.13      imp      1750:    fi; \
                   1751:    ${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
                   1752:    case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
                   1753:        ABCDE) ;; \
                   1754:        *) cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`;; \
                   1755:    esac; \
                   1756:    ${ECHO} -n "|"; \
                   1757:    case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
                   1758:        ABCD) ;; \
                   1759:        *) cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`;; \
                   1760:    esac; \
                   1761:    ${ECHO} ""
1.1       niklas   1762: .endif
                   1763:
                   1764: .if !target(readmes)
                   1765: readmes:   readme
                   1766: .endif
                   1767:
                   1768: .if !target(readme)
                   1769: readme:
                   1770:    @rm -f README.html
1.6       niklas   1771:    @cd ${.CURDIR} && make README.html
1.1       niklas   1772: .endif
                   1773:
                   1774: README.html:
                   1775:    @${ECHO_MSG} "===>  Creating README.html for ${PKGNAME}"
                   1776:    @${CAT} ${TEMPLATES}/README.port | \
                   1777:        ${SED} -e 's&%%PORT%%&'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'&g' \
                   1778:            -e 's&%%PKG%%&${PKGNAME}&g' \
                   1779:            -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
                   1780:            -e '/%%COMMENT%%/d' \
                   1781:            -e 's&%%BUILD_DEPENDS%%&'"`${MAKE} print-depends-list`"'&' \
                   1782:            -e 's&%%RUN_DEPENDS%%&'"`${MAKE} print-package-depends`"'&' \
                   1783:        >> $@
                   1784:
                   1785: .if !target(print-depends-list)
                   1786: print-depends-list:
                   1787: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
                   1788:    defined(LIB_DEPENDS) || defined(DEPENDS)
                   1789:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      1790:    @${ECHO} -n `make depends-list | sort -u`
1.1       niklas   1791:    @${ECHO} '" to build.'
                   1792: .endif
                   1793: .endif
                   1794:
                   1795: .if !target(print-package-depends)
                   1796: print-package-depends:
                   1797: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
                   1798:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      1799:    @${ECHO} -n `make package-depends | sort -u`
1.1       niklas   1800:    @${ECHO} '" to run.'
                   1801: .endif
                   1802: .endif
                   1803:
                   1804: # Fake installation of package so that user can pkg_delete it later.
                   1805: # Also, make sure that an installed port is recognized correctly in
                   1806: # accordance to the @pkgdep directive in the packing lists
                   1807:
                   1808: .if !target(fake-pkg)
                   1809: fake-pkg:
1.13      imp      1810:    @if [ ! -f ${PLIST} -o ! -f ${COMMENT} -o ! -f ${DESCR} ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
1.9       imp      1811:    @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
1.1       niklas   1812: .if defined(FORCE_PKG_REGISTER)
                   1813:    @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
                   1814: .endif
                   1815:    @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
                   1816:        ${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \
1.9       imp      1817:        ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
1.1       niklas   1818:        ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1.13      imp      1819:        ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
                   1820:        ${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1.1       niklas   1821:        if [ -f ${PKGDIR}/INSTALL ]; then \
                   1822:            ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
                   1823:        fi; \
                   1824:        if [ -f ${PKGDIR}/DEINSTALL ]; then \
                   1825:            ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
                   1826:        fi; \
                   1827:        if [ -f ${PKGDIR}/REQ ]; then \
                   1828:            ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
                   1829:        fi; \
1.13      imp      1830:        for dep in `make package-depends ECHO_MSG=/usr/bin/true | sort -u`; do \
                   1831:            if [ -d ${PKG_DBDIR}/$$dep ]; then \
                   1832:                if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
                   1833:                    >/dev/null 2>&1; then \
                   1834:                    ${ECHO} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \
                   1835:                fi; \
                   1836:            fi; \
                   1837:        done; \
1.1       niklas   1838:    fi
                   1839: .endif
                   1840:
                   1841: # Depend is generally meaningless for arbitrary ports, but if someone wants
                   1842: # one they can override this.  This is just to catch people who've gotten into
                   1843: # the habit of typing `make depend all install' as a matter of course.
                   1844: #
                   1845: .if !target(depend)
                   1846: depend:
                   1847: .endif
                   1848:
                   1849: # Same goes for tags
                   1850: .if !target(tags)
                   1851: tags:
1.10      niklas   1852: .endif
                   1853:
1.1       niklas   1854: .endif