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

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