[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.32

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