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

1.9       imp         1: #-*- mode: Fundamental; tab-width: 4; -*-
                      2: # ex:ts=4
1.38    ! form        3: #  $OpenBSD: bsd.port.mk,v 1.37 1998/07/13 03:11:14 todd 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}
1.38    ! form      853: .if ( ${MACHINE} == "${__ARCH}" || ${MACHINE_ARCH} == "${__ARCH}" )
1.29      marc      854: __ARCH_OK= 1
                    855: .endif
                    856: .endfor
                    857: .if !defined(__ARCH_OK)
1.38    ! form      858: .if ( ${MACHINE} != ${MACHINE_ARCH} )
        !           859: IGNORE= "is only for ${ONLY_FOR_ARCHS}, not ${MACHINE} \(${MACHINE_ARCH}\)"
        !           860: .else
1.29      marc      861: IGNORE= "is only for ${ONLY_FOR_ARCHS}, not ${MACHINE}"
1.38    ! form      862: .endif
1.29      marc      863: .endif
1.27      marc      864: .elif defined(COMES_WITH)
1.32      marc      865: .if ( ${OPSYS_VER} >= ${COMES_WITH} )
1.27      marc      866: IGNORE= "comes with ${OPSYS} as of release ${COMES_WITH}"
                    867: .endif
1.1       niklas    868: .endif
                    869:
                    870: .if defined(IGNORE)
1.9       imp       871: .if defined(IGNORE_SILENT)
                    872: IGNORECMD= ${DO_NADA}
                    873: .else
                    874: IGNORECMD= ${ECHO_MSG} "===>  ${PKGNAME} ${IGNORE}."
                    875: .endif
                    876: fetch:
                    877:    @${IGNORECMD}
                    878: checksum:
                    879:    @${IGNORECMD}
                    880: extract:
                    881:    @${IGNORECMD}
                    882: patch:
                    883:    @${IGNORECMD}
                    884: configure:
                    885:    @${IGNORECMD}
1.1       niklas    886: all:
1.9       imp       887:    @${IGNORECMD}
1.1       niklas    888: build:
1.9       imp       889:    @${IGNORECMD}
1.1       niklas    890: install:
1.9       imp       891:    @${IGNORECMD}
1.1       niklas    892: package:
1.9       imp       893:    @${IGNORECMD}
1.1       niklas    894: .endif
1.13      imp       895: .endif
1.1       niklas    896:
                    897: .if defined(ALL_HOOK)
                    898: all:
1.6       niklas    899:    @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
1.1       niklas    900:      DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
                    901:      PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                    902:      FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                    903:      DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
                    904:      RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
                    905:    ${ALL_HOOK}
                    906: .endif
                    907:
                    908: .if !target(all)
                    909: all: build
                    910: .endif
                    911:
1.13      imp       912: .if !defined(DEPENDS_TARGET)
                    913: .if make(reinstall)
                    914: DEPENDS_TARGET=    reinstall
                    915: .else
                    916: DEPENDS_TARGET=    install
1.1       niklas    917: .endif
                    918: .endif
                    919:
                    920: ################################################################
                    921: # The following are used to create easy dummy targets for
                    922: # disabling some bit of default target behavior you don't want.
                    923: # They still check to see if the target exists, and if so don't
                    924: # do anything, since you might want to set this globally for a
                    925: # group of ports in a Makefile.inc, but still be able to
                    926: # override from an individual Makefile.
                    927: ################################################################
                    928:
1.9       imp       929: # Disable checksum
                    930: .if defined(NO_CHECKSUM) && !target(checksum)
                    931: checksum: fetch
                    932:    @${DO_NADA}
                    933: .endif
                    934:
1.1       niklas    935: # Disable extract
                    936: .if defined(NO_EXTRACT) && !target(extract)
                    937: extract: checksum
                    938:    @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
                    939: checksum: fetch
                    940:    @${DO_NADA}
                    941: makesum:
                    942:    @${DO_NADA}
                    943: .endif
                    944:
1.9       imp       945: # Disable patch
                    946: .if defined(NO_PATCH) && !target(patch)
                    947: patch: extract
                    948:    @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
                    949: .endif
                    950:
1.1       niklas    951: # Disable configure
                    952: .if defined(NO_CONFIGURE) && !target(configure)
                    953: configure: patch
                    954:    @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
                    955: .endif
                    956:
                    957: # Disable build
                    958: .if defined(NO_BUILD) && !target(build)
                    959: build: configure
                    960:    @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
                    961: .endif
                    962:
1.9       imp       963: # Disable install
                    964: .if defined(NO_INSTALL) && !target(install)
                    965: install: build
                    966:    @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
                    967: .endif
                    968:
1.1       niklas    969: # Disable package
                    970: .if defined(NO_PACKAGE) && !target(package)
                    971: package:
1.9       imp       972: .if defined(IGNORE_SILENT)
1.1       niklas    973:    @${DO_NADA}
1.9       imp       974: .else
                    975:    @${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
1.1       niklas    976: .endif
                    977: .endif
                    978:
1.9       imp       979: # Disable describe
                    980: .if defined(NO_DESCRIBE) && !target(describe)
                    981: describe:
                    982:    @${DO_NADA}
1.1       niklas    983: .endif
                    984:
                    985: ################################################################
                    986: # More standard targets start here.
                    987: #
                    988: # These are the body of the build/install framework.  If you are
                    989: # not happy with the default actions, and you can't solve it by
                    990: # adding pre-* or post-* targets/scripts, override these.
                    991: ################################################################
                    992:
                    993: # Fetch
                    994:
                    995: .if !target(do-fetch)
                    996: do-fetch:
1.9       imp       997:    @${MKDIR} ${_DISTDIR}
                    998:    @(cd ${_DISTDIR}; \
1.1       niklas    999:     for file in ${DISTFILES}; do \
                   1000:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1001:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp      1002:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas   1003:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                   1004:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                   1005:                exit 1; \
1.28      marc     1006:            fi ; \
                   1007:            if [ ! -z ${CDROM_COPY} ]; then \
                   1008:                if ${CDROM_COPY} ${CDROM_OPT} ${CDROM_SITE}/$$file .; then \
                   1009:                    continue; \
                   1010:                fi ; \
1.1       niklas   1011:            fi ; \
                   1012:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                   1013:            for site in ${MASTER_SITES}; do \
                   1014:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas   1015:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas   1016:                    continue 2; \
                   1017:                fi \
                   1018:            done; \
1.6       niklas   1019:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp      1020:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas   1021:            exit 1; \
                   1022:        fi \
                   1023:     done)
                   1024: .if defined(PATCHFILES)
1.9       imp      1025:    @(cd ${_DISTDIR}; \
1.1       niklas   1026:     for file in ${PATCHFILES}; do \
                   1027:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1028:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp      1029:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas   1030:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                   1031:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                   1032:                exit 1; \
                   1033:            fi ; \
                   1034:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                   1035:            for site in ${PATCH_SITES}; do \
                   1036:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas   1037:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas   1038:                    continue 2; \
                   1039:                fi \
                   1040:            done; \
1.6       niklas   1041:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp      1042:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas   1043:            exit 1; \
                   1044:        fi \
                   1045:     done)
                   1046: .endif
                   1047: .endif
                   1048:
                   1049: # Extract
                   1050:
                   1051: .if !target(do-extract)
                   1052: do-extract:
1.6       niklas   1053: .if !defined(NO_WRKDIR)
1.14      niklas   1054: .if defined(WRKOBJDIR)
                   1055:    @${RM} -rf ${WRKOBJDIR}/${PORTSUBDIR}
1.18      niklas   1056:    @${MKDIR} ${WRKOBJDIR}/${PORTSUBDIR}
                   1057:    @if [ ! -L ${WRKDIR} ] || \
                   1058:      [ X`${READLINK} ${WRKDIR}` != X${WRKOBJDIR}/${PORTSUBDIR} ]; then \
                   1059:        echo "${WRKDIR} -> ${WRKOBJDIR}/${PORTSUBDIR}"; \
                   1060:        ${RM} -f ${WRKDIR}; \
                   1061:        ${LN} -sf ${WRKOBJDIR}/${PORTSUBDIR} ${WRKDIR}; \
                   1062:    fi
1.14      niklas   1063: .else
1.1       niklas   1064:    @${RM} -rf ${WRKDIR}
1.9       imp      1065:    @${MKDIR} ${WRKDIR}
1.6       niklas   1066: .endif
1.14      niklas   1067: .endif
1.1       niklas   1068:    @for file in ${EXTRACT_ONLY}; do \
1.10      niklas   1069:        if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1.1       niklas   1070:        then \
                   1071:            exit 1; \
                   1072:        fi \
                   1073:    done
                   1074: .endif
                   1075:
                   1076: # Patch
                   1077:
                   1078: .if !target(do-patch)
                   1079: do-patch:
                   1080: .if defined(PATCHFILES)
                   1081:    @${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
1.9       imp      1082:    @(cd ${_DISTDIR}; \
1.1       niklas   1083:      for i in ${PATCHFILES}; do \
1.6       niklas   1084:        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
                   1085:            ${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
                   1086:        fi; \
1.1       niklas   1087:        case $$i in \
                   1088:            *.Z|*.gz) \
                   1089:                ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
                   1090:                ;; \
                   1091:            *) \
                   1092:                ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
                   1093:                ;; \
                   1094:        esac; \
                   1095:      done)
                   1096: .endif
                   1097:    @if [ -d ${PATCHDIR} ]; then \
1.6       niklas   1098:        if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
                   1099:            ${ECHO_MSG} "===>   Ignoring empty patch directory"; \
                   1100:            if [ -d ${PATCHDIR}/CVS ]; then \
                   1101:                ${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
                   1102:            fi; \
                   1103:        else \
1.9       imp      1104:            ${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
1.6       niklas   1105:            for i in ${PATCHDIR}/patch-*; do \
                   1106:                case $$i in \
1.13      imp      1107:                    *.orig|*.rej|*~) \
1.6       niklas   1108:                        ${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
                   1109:                        ;; \
                   1110:                    *) \
                   1111:                        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1.9       imp      1112:                            ${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
1.6       niklas   1113:                        fi; \
                   1114:                        ${PATCH} ${PATCH_ARGS} < $$i; \
                   1115:                        ;; \
                   1116:                esac; \
                   1117:            done; \
                   1118:        fi; \
1.1       niklas   1119:    fi
                   1120: .endif
                   1121:
                   1122: # Configure
                   1123:
                   1124: .if !target(do-configure)
                   1125: do-configure:
1.7       niklas   1126:    @if [ -f ${SCRIPTDIR}/configure ]; then \
1.13      imp      1127:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1128:          ${SCRIPTDIR}/configure; \
1.1       niklas   1129:    fi
                   1130: .if defined(HAS_CONFIGURE)
1.6       niklas   1131:    @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
1.1       niklas   1132:        INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1.6       niklas   1133:        INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1.1       niklas   1134:        ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
                   1135: .endif
                   1136: .if defined(USE_IMAKE)
1.20      todd     1137:    @(cd ${WRKSRC} && ${SETENV} ${XMKMF})
1.1       niklas   1138: .endif
                   1139: .endif
                   1140:
                   1141: # Build
                   1142:
                   1143: .if !target(do-build)
                   1144: do-build:
                   1145: .if defined(USE_GMAKE)
                   1146:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                   1147: .else defined(USE_GMAKE)
                   1148:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                   1149: .endif
                   1150: .endif
                   1151:
                   1152: # Install
                   1153:
                   1154: .if !target(do-install)
                   1155: do-install:
                   1156: .if defined(USE_GMAKE)
1.6       niklas   1157:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1       niklas   1158: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6       niklas   1159:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1       niklas   1160: .endif
                   1161: .else defined(USE_GMAKE)
1.6       niklas   1162:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1       niklas   1163: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6       niklas   1164:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1       niklas   1165: .endif
                   1166: .endif
                   1167: .endif
                   1168:
                   1169: # Package
                   1170:
                   1171: .if !target(do-package)
                   1172: do-package:
1.13      imp      1173:    @if [ -e ${PLIST} ]; then \
1.1       niklas   1174:        ${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
                   1175:        if [ -d ${PACKAGES} ]; then \
                   1176:            if [ ! -d ${PKGREPOSITORY} ]; then \
1.9       imp      1177:                if ! ${MKDIR} ${PKGREPOSITORY}; then \
1.1       niklas   1178:                    ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
                   1179:                    exit 1; \
                   1180:                fi; \
                   1181:            fi; \
                   1182:        fi; \
                   1183:        if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
                   1184:            if [ -d ${PACKAGES} ]; then \
                   1185:                ${MAKE} ${.MAKEFLAGS} package-links; \
                   1186:            fi; \
                   1187:        else \
                   1188:            ${MAKE} ${.MAKEFLAGS} delete-package; \
                   1189:            exit 1; \
                   1190:        fi; \
                   1191:    fi
                   1192: .endif
                   1193:
                   1194: # Some support rules for do-package
                   1195:
                   1196: .if !target(package-links)
                   1197: package-links:
                   1198:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                   1199:    @for cat in ${CATEGORIES}; do \
                   1200:        if [ ! -d ${PACKAGES}/$$cat ]; then \
1.9       imp      1201:            if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1.1       niklas   1202:                ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
                   1203:                exit 1; \
                   1204:            fi; \
                   1205:        fi; \
                   1206:        ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
                   1207:    done;
                   1208: .endif
                   1209:
                   1210: .if !target(delete-package-links)
                   1211: delete-package-links:
                   1212:    @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
                   1213: .endif
                   1214:
                   1215: .if !target(delete-package)
                   1216: delete-package:
                   1217:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                   1218:    @${RM} -f ${PKGFILE}
                   1219: .endif
                   1220:
                   1221: ################################################################
                   1222: # This is the "generic" port target, actually a macro used from the
                   1223: # six main targets.  See below for more.
                   1224: ################################################################
                   1225:
                   1226: _PORT_USE: .USE
                   1227: .if make(real-fetch)
1.6       niklas   1228:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1.1       niklas   1229: .endif
                   1230: .if make(real-extract)
1.6       niklas   1231:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1.1       niklas   1232: .endif
                   1233: .if make(real-install)
1.13      imp      1234: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
1.37      todd     1235:    @if [ -d ${PKG_DBDIR}/${PKGNAME} -o "X$$(ls -d ${PKG_DBDIR}/${PKGNAME:C/-.*//g}-* 2> /dev/null)" != "X" ]; then \
1.13      imp      1236:        ${ECHO_MSG} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
                   1237:        ${ECHO_MSG} "      If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
                   1238:        ${ECHO_MSG} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
                   1239:        ${ECHO_MSG} "      If you really wish to overwrite the old port of ${PKGNAME}"; \
                   1240:        ${ECHO_MSG} "      without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
                   1241:        ${ECHO_MSG} "      in your environment or the \"make install\" command line."; \
                   1242:        exit 1; \
                   1243:    fi
                   1244: .endif
1.14      niklas   1245:    @if [ `${SH} -c umask` != ${DEF_UMASK} ]; then \
1.13      imp      1246:        ${ECHO_MSG} "===>  Warning: your umask is \"`${SH} -c umask`"\".; \
                   1247:        ${ECHO_MSG} "      If this is not desired, set it to an appropriate value"; \
                   1248:        ${ECHO_MSG} "      and install this port again by \`\`make reinstall''."; \
                   1249:    fi
1.9       imp      1250:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1.1       niklas   1251: .endif
                   1252: .if make(real-install)
                   1253: .if !defined(NO_MTREE)
                   1254:    @if [ `id -u` = 0 ]; then \
1.13      imp      1255:        if [ ! -f ${MTREE_FILE} ]; then \
                   1256:            ${ECHO_MSG} "Error: mtree file \"${MTREE_FILE}\" is missing."; \
                   1257:            ${ECHO_MSG} "Copy it from a suitable location (e.g., /usr/src/etc/mtree) and try again."; \
                   1258:            exit 1; \
                   1259:        else \
                   1260:            ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
                   1261:        fi; \
1.1       niklas   1262:    else \
                   1263:        ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
                   1264:        ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
                   1265:    fi
                   1266: .endif
                   1267: .endif
1.6       niklas   1268:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1.1       niklas   1269:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1.13      imp      1270:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1271:            ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
1.1       niklas   1272:    fi
1.6       niklas   1273:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
                   1274:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1.1       niklas   1275:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1.13      imp      1276:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1277:            ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
1.1       niklas   1278:    fi
1.9       imp      1279: .if make(real-install) && defined(_MANPAGES)
                   1280: .if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS)
                   1281:    @${ECHO_MSG} "===>   Uncompressing manual pages for ${PKGNAME}"
                   1282: .for manpage in ${_MANPAGES}
                   1283:    @${GUNZIP_CMD} ${manpage}
                   1284: .endfor
                   1285: .elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS)
                   1286:    @${ECHO_MSG} "===>   Compressing manual pages for ${PKGNAME}"
                   1287: .for manpage in ${_MANPAGES}
                   1288:    @${GZIP_CMD} ${manpage}
                   1289: .endfor
                   1290: .endif
                   1291: .endif
                   1292: .if make(real-install) && !defined(NO_PKG_REGISTER)
1.6       niklas   1293:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1.1       niklas   1294: .endif
                   1295: .if !make(real-fetch) \
                   1296:    && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
                   1297:    && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
                   1298:    @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
                   1299: .endif
                   1300:
                   1301: ################################################################
                   1302: # Skeleton targets start here
                   1303: #
                   1304: # You shouldn't have to change these.  Either add the pre-* or
                   1305: # post-* targets/scripts or redefine the do-* targets.  These
                   1306: # targets don't do anything other than checking for cookies and
                   1307: # call the necessary targets/scripts.
                   1308: ################################################################
                   1309:
                   1310: .if !target(fetch)
                   1311: fetch:
1.6       niklas   1312:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1.1       niklas   1313: .endif
                   1314:
                   1315: .if !target(extract)
                   1316: extract: checksum ${EXTRACT_COOKIE}
                   1317: .endif
                   1318:
                   1319: .if !target(patch)
                   1320: patch: extract ${PATCH_COOKIE}
                   1321: .endif
                   1322:
                   1323: .if !target(configure)
                   1324: configure: patch ${CONFIGURE_COOKIE}
                   1325: .endif
                   1326:
                   1327: .if !target(build)
                   1328: build: configure ${BUILD_COOKIE}
                   1329: .endif
                   1330:
                   1331: .if !target(install)
                   1332: install: build ${INSTALL_COOKIE}
                   1333: .endif
                   1334:
                   1335: .if !target(package)
                   1336: package: install ${PACKAGE_COOKIE}
                   1337: .endif
                   1338:
                   1339: ${EXTRACT_COOKIE}:
1.6       niklas   1340:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1.1       niklas   1341: ${PATCH_COOKIE}:
1.6       niklas   1342:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1.1       niklas   1343: ${CONFIGURE_COOKIE}:
1.6       niklas   1344:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1.1       niklas   1345: ${BUILD_COOKIE}:
1.6       niklas   1346:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1.1       niklas   1347: ${INSTALL_COOKIE}:
1.32      marc     1348:    @touch ${INSTALL_PRE_COOKIE}
1.6       niklas   1349:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1.1       niklas   1350: ${PACKAGE_COOKIE}:
1.6       niklas   1351:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1.1       niklas   1352:
                   1353: # And call the macros
                   1354:
                   1355: real-fetch: _PORT_USE
                   1356: real-extract: _PORT_USE
                   1357:    @${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
                   1358: real-patch: _PORT_USE
                   1359:    @${ECHO_MSG} "===>  Patching for ${PKGNAME}"
                   1360: real-configure: _PORT_USE
                   1361:    @${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
                   1362: real-build: _PORT_USE
                   1363:    @${ECHO_MSG} "===>  Building for ${PKGNAME}"
                   1364: real-install: _PORT_USE
                   1365:    @${ECHO_MSG} "===>  Installing for ${PKGNAME}"
                   1366: real-package: _PORT_USE
                   1367:
                   1368: # Empty pre-* and post-* targets, note we can't use .if !target()
                   1369: # in the _PORT_USE macro
                   1370:
                   1371: .for name in fetch extract patch configure build install package
                   1372:
                   1373: .if !target(pre-${name})
                   1374: pre-${name}:
                   1375:    @${DO_NADA}
                   1376: .endif
                   1377:
                   1378: .if !target(post-${name})
                   1379: post-${name}:
                   1380:    @${DO_NADA}
                   1381: .endif
                   1382:
                   1383: .endfor
                   1384:
                   1385: # Checkpatch
                   1386: #
                   1387: # Special target to verify patches
                   1388:
                   1389: .if !target(checkpatch)
                   1390: checkpatch:
1.6       niklas   1391:    @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1.1       niklas   1392: .endif
                   1393:
                   1394: # Reinstall
                   1395: #
                   1396: # Special target to re-run install
                   1397:
                   1398: .if !target(reinstall)
1.13      imp      1399: reinstall:
1.32      marc     1400:    @${RM} -f ${INSTALL_PRE_COOKIE} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
1.13      imp      1401:    @DEPENDS_TARGET=${DEPENDS_TARGET} ${MAKE} install
1.1       niklas   1402: .endif
                   1403:
                   1404: ################################################################
                   1405: # Some more targets supplied for users' convenience
                   1406: ################################################################
                   1407:
                   1408: # Cleaning up
                   1409:
                   1410: .if !target(pre-clean)
                   1411: pre-clean:
                   1412:    @${DO_NADA}
                   1413: .endif
                   1414:
                   1415: .if !target(clean)
                   1416: clean: pre-clean
1.9       imp      1417: .if !defined(NOCLEANDEPENDS)
                   1418:    @${MAKE} clean-depends
                   1419: .endif
1.1       niklas   1420:    @${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
1.6       niklas   1421: .if !defined(NO_WRKDIR)
1.9       imp      1422:    @if [ -d ${WRKDIR} ]; then \
                   1423:        if [ -w ${WRKDIR} ]; then \
                   1424:            ${RM} -rf ${WRKDIR}; \
                   1425:        else \
                   1426:            ${ECHO_MSG} "===>   ${WRKDIR} not writable, skipping"; \
                   1427:        fi; \
                   1428:    fi
1.6       niklas   1429: .else
1.1       niklas   1430:    @${RM} -f ${WRKDIR}/.*_done
                   1431: .endif
                   1432: .endif
                   1433:
1.9       imp      1434: .if !target(pre-distclean)
                   1435: pre-distclean:
                   1436:    @${DO_NADA}
                   1437: .endif
                   1438:
                   1439: .if !target(distclean)
                   1440: distclean: pre-distclean clean
                   1441:    @${ECHO_MSG} "===>  Dist cleaning for ${PKGNAME}"
1.13      imp      1442:    @(if [ -d ${_DISTDIR} ]; then \
                   1443:        cd ${_DISTDIR}; \
                   1444:        ${RM} -f ${DISTFILES} ${PATCHFILES}; \
                   1445:    fi)
1.9       imp      1446: .if defined(DIST_SUBDIR)
1.13      imp      1447:    -@${RMDIR} ${_DISTDIR}
1.9       imp      1448: .endif
                   1449: .endif
                   1450:
1.1       niklas   1451: # Prints out a list of files to fetch (useful to do a batch fetch)
                   1452:
                   1453: .if !target(fetch-list)
                   1454: fetch-list:
1.9       imp      1455:    @${MKDIR} ${_DISTDIR}
                   1456:    @(cd ${_DISTDIR}; \
1.1       niklas   1457:     for file in ${DISTFILES}; do \
                   1458:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1459:            for site in ${MASTER_SITES}; do \
1.6       niklas   1460:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1       niklas   1461:                    break; \
                   1462:            done; \
                   1463:            ${ECHO} "echo $${file} not fetched" ; \
                   1464:        fi \
                   1465:    done)
                   1466: .if defined(PATCHFILES)
1.9       imp      1467:    @(cd ${_DISTDIR}; \
1.1       niklas   1468:     for file in ${PATCHFILES}; do \
                   1469:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1470:            for site in ${PATCH_SITES}; do \
1.6       niklas   1471:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1       niklas   1472:                    break; \
                   1473:            done; \
                   1474:            ${ECHO} "echo $${file} not fetched" ; \
                   1475:        fi \
                   1476:     done)
                   1477: .endif
                   1478: .endif
                   1479:
                   1480: # Checksumming utilities
                   1481:
                   1482: .if !target(makesum)
                   1483: makesum: fetch
1.9       imp      1484:    @${MKDIR} ${FILESDIR}
1.1       niklas   1485:    @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
                   1486:    @(cd ${DISTDIR}; \
1.9       imp      1487:     for file in ${_CKSUMFILES}; do \
1.1       niklas   1488:        ${MD5} $$file >> ${MD5_FILE}; \
                   1489:     done)
1.9       imp      1490:    @for file in ${_IGNOREFILES}; do \
                   1491:        ${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
                   1492:    done
1.1       niklas   1493: .endif
                   1494:
                   1495: .if !target(checksum)
                   1496: checksum: fetch
                   1497:    @if [ ! -f ${MD5_FILE} ]; then \
                   1498:        ${ECHO_MSG} ">> No MD5 checksum file."; \
                   1499:    else \
1.9       imp      1500:        (cd ${DISTDIR}; OK="true"; \
                   1501:          for file in ${_CKSUMFILES}; do \
1.6       niklas   1502:            CKSUM=`${MD5} < $$file`; \
1.13      imp      1503:            CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1.1       niklas   1504:            if [ "$$CKSUM2" = "" ]; then \
1.9       imp      1505:                ${ECHO_MSG} ">> No checksum recorded for $$file."; \
                   1506:                OK="false"; \
                   1507:            elif [ "$$CKSUM2" = "IGNORE" ]; then \
                   1508:                ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
                   1509:                ${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
1.1       niklas   1510:                OK="false"; \
1.13      imp      1511:            elif [ "$$CKSUM" = "$$CKSUM2" ]; then \
                   1512:                ${ECHO_MSG} ">> Checksum OK for $$file."; \
                   1513:            else \
1.9       imp      1514:                ${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1.13      imp      1515:                OK="false"; \
1.1       niklas   1516:            fi; \
                   1517:          done; \
1.9       imp      1518:          for file in ${_IGNOREFILES}; do \
                   1519:            CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
                   1520:            if [ "$$CKSUM2" = "" ]; then \
                   1521:                ${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
                   1522:                OK="false"; \
                   1523:            elif [ "$$CKSUM2" != "IGNORE" ]; then \
                   1524:                ${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
                   1525:                ${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
                   1526:                OK="false"; \
                   1527:            fi; \
                   1528:          done; \
1.13      imp      1529:          if [ "$$OK" != "true" ]; then \
                   1530:            ${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
                   1531:            ${ECHO_MSG} "are up to date.  If you want to override this check, type"; \
                   1532:            ${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \
                   1533:            exit 1; \
1.1       niklas   1534:          fi) ; \
                   1535:    fi
1.32      marc     1536: .endif
                   1537:
                   1538: # packing list utilities.  This generates a packing list from a recently
                   1539: # installed port.  Not perfect, but pretty close.  The generated file
                   1540: # will have to have some tweaks done by hand.
1.35      marc     1541: # Note: add @comment PACKAGE(arch=${ARCH}, opsys=${OPSYS}, vers=${OPSYS_VER})
                   1542: # when port is installed or package created.
1.32      marc     1543: #
                   1544: .if !target(plist)
                   1545: plist: install
                   1546:    @${MKDIR} ${PKGDIR}
                   1547:    @(dirs=""; \
                   1548:      ld=""; \
1.33      marc     1549:      ${ECHO} "@cwd ${PREFIX}"; \
                   1550:      ${ECHO} "@name ${PKGNAME}"; \
1.32      marc     1551:      for f in `${MAKE} package-depends|sort -u`; do ${ECHO} "@pkgdep $$f"; done; \
                   1552:      for f in `find ${PREFIX} -newer ${INSTALL_PRE_COOKIE} -print 2> /dev/null`; do \
                   1553:       ff=`${ECHO} $$f | ${SED} -e 's|^${PREFIX}/||'`; \
                   1554:       if [ -d $$f ]; then dirs="$$ff $$dirs"; \
                   1555:       else \
                   1556:        ${ECHO} $$ff; \
1.33      marc     1557:        if ${ECHO} $$f | ${GREP} -E -q -e '[^/]+\.a$$'; then \
                   1558:         ${ECHO} '@exec ranlib %D/%F'; \
                   1559:        elif ${ECHO} $$f | ${GREP} -E -q -e '[^/]+\.so\.[0-9]+\.[0-9]+$$'; then \
1.32      marc     1560:         ld="$$LDCONFIG `${DIRNAME} $$f`"; \
                   1561:        fi; \
                   1562:       fi; \
                   1563:      done; \
                   1564:      for f in $$dirs; do \
                   1565:        if ${GREP} -q -e `${BASENAME} $$f` ${MTREE_FILE}; then \
                   1566:         :; \
                   1567:        else \
                   1568:         ${ECHO} "@dirrm $$f"; \
                   1569:        fi; \
                   1570:       done; \
                   1571:      for f in $$ld; do ${ECHO} "@exec ${LDCONFIG} -m $$f"; done; \
                   1572:    ) > ${PLIST}-auto
1.1       niklas   1573: .endif
                   1574:
                   1575: ################################################################
                   1576: # The special package-building targets
                   1577: # You probably won't need to touch these
                   1578: ################################################################
                   1579:
                   1580: # Nobody should want to override this unless PKGNAME is simply bogus.
                   1581:
                   1582: .if !target(package-name)
                   1583: package-name:
                   1584:    @${ECHO} ${PKGNAME}
                   1585: .endif
                   1586:
                   1587: # Show (recursively) all the packages this package depends on.
                   1588:
                   1589: .if !target(package-depends)
                   1590: package-depends:
1.13      imp      1591:    @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 \
                   1592:        if [ -d $$dir ]; then \
                   1593:            (cd $$dir ; ${MAKE} package-name package-depends); \
                   1594:        else \
                   1595:            ${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
                   1596:        fi; \
1.1       niklas   1597:    done
                   1598: .endif
                   1599:
                   1600: # Build a package but don't check the package cookie
                   1601:
                   1602: .if !target(repackage)
                   1603: repackage: pre-repackage package
                   1604:
                   1605: pre-repackage:
                   1606:    @${RM} -f ${PACKAGE_COOKIE}
                   1607: .endif
                   1608:
                   1609: # Build a package but don't check the cookie for installation, also don't
                   1610: # install package cookie
                   1611:
                   1612: .if !target(package-noinstall)
                   1613: package-noinstall:
1.6       niklas   1614:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1       niklas   1615: .endif
                   1616:
                   1617: ################################################################
                   1618: # Dependency checking
                   1619: ################################################################
                   1620:
                   1621: .if !target(depends)
                   1622: depends: lib-depends misc-depends
1.6       niklas   1623:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
                   1624:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
                   1625:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1       niklas   1626:
                   1627: .if make(fetch-depends)
                   1628: DEPENDS_TMP+=  ${FETCH_DEPENDS}
                   1629: .endif
                   1630:
                   1631: .if make(build-depends)
                   1632: DEPENDS_TMP+=  ${BUILD_DEPENDS}
                   1633: .endif
                   1634:
                   1635: .if make(run-depends)
                   1636: DEPENDS_TMP+=  ${RUN_DEPENDS}
                   1637: .endif
                   1638:
                   1639: _DEPENDS_USE:  .USE
                   1640: .if defined(DEPENDS_TMP)
1.13      imp      1641: .if !defined(NO_DEPENDS)
1.20      todd     1642:    @PATH=${PORTSPATH}; for i in ${DEPENDS_TMP}; do \
1.1       niklas   1643:        prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13      imp      1644:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1645:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1646:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1647:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1.1       niklas   1648:        else \
1.13      imp      1649:            target=${DEPENDS_TARGET}; \
1.1       niklas   1650:        fi; \
                   1651:        if expr "$$prog" : \\/ >/dev/null; then \
                   1652:            if [ -e "$$prog" ]; then \
                   1653:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - found"; \
                   1654:                notfound=0; \
                   1655:            else \
                   1656:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - not found"; \
                   1657:                notfound=1; \
                   1658:            fi; \
                   1659:        else \
1.9       imp      1660:            if which "$$prog" > /dev/null 2>&1 ; then \
1.1       niklas   1661:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
                   1662:                notfound=0; \
                   1663:            else \
                   1664:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
                   1665:                notfound=1; \
                   1666:            fi; \
                   1667:        fi; \
                   1668:        if [ $$notfound != 0 ]; then \
1.13      imp      1669:            ${ECHO_MSG} "===>  Verifying $$target for $$prog in $$dir"; \
1.1       niklas   1670:            if [ ! -d "$$dir" ]; then \
                   1671:                ${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
                   1672:            else \
1.13      imp      1673:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1674:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1675:            fi; \
                   1676:        fi; \
                   1677:    done
                   1678: .endif
                   1679: .else
                   1680:    @${DO_NADA}
                   1681: .endif
                   1682:
                   1683: fetch-depends: _DEPENDS_USE
                   1684: build-depends: _DEPENDS_USE
                   1685: run-depends:   _DEPENDS_USE
                   1686:
                   1687: lib-depends:
                   1688: .if defined(LIB_DEPENDS)
1.13      imp      1689: .if !defined(NO_DEPENDS)
1.16      niklas   1690: .if (${MACHINE_ARCH} == "alpha")
                   1691:    @for i in ${LIB_DEPENDS}; do \
1.24      niklas   1692:        lib=`${ECHO} $$i | ${SED} -e 's/\\\.[0-9][0-9]*\\\.[0-9]*:.*//'`; \
1.16      niklas   1693:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1694:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1695:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1696:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1697:        else \
                   1698:            target=${DEPENDS_TARGET}; \
                   1699:        fi; \
1.17      niklas   1700:        tmp=`mktemp /tmp/bpmXXXXXXXXXX`; \
                   1701:        if ${LD} -r -o $$tmp -l$$lib; then \
1.16      niklas   1702:            ${ECHO_MSG} "===>  ${PKGNAME} depends on library: $$lib - found"; \
                   1703:        else \
                   1704:            ${ECHO_MSG} "===>  ${PKGNAME} depends on library: $$lib - not found"; \
                   1705:            ${ECHO_MSG} "===>  Verifying $$target for $$lib in $$dir"; \
                   1706:            if [ ! -d "$$dir" ]; then \
                   1707:                ${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
                   1708:            else \
                   1709:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
                   1710:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1711:            fi; \
                   1712:        fi; \
1.17      niklas   1713:        ${RM} -f $$tmp; \
1.16      niklas   1714:    done
                   1715: .else
1.1       niklas   1716:    @for i in ${LIB_DEPENDS}; do \
                   1717:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13      imp      1718:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1719:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1720:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1721:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1722:        else \
                   1723:            target=${DEPENDS_TARGET}; \
                   1724:        fi; \
1.1       niklas   1725:        if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \
                   1726:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \
                   1727:        else \
                   1728:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \
1.13      imp      1729:            ${ECHO_MSG} "===>  Verifying $$target for $$lib in $$dir"; \
1.1       niklas   1730:            if [ ! -d "$$dir" ]; then \
                   1731:                ${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
                   1732:            else \
1.13      imp      1733:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1734:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1735:            fi; \
                   1736:        fi; \
                   1737:    done
1.16      niklas   1738: .endif
1.1       niklas   1739: .endif
                   1740: .else
                   1741:    @${DO_NADA}
                   1742: .endif
                   1743:
                   1744: misc-depends:
                   1745: .if defined(DEPENDS)
                   1746: .if !defined(NO_DEPENDS)
1.13      imp      1747:    @for dir in ${DEPENDS}; do \
                   1748:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1749:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1750:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1751:        else \
                   1752:            target=${DEPENDS_TARGET}; \
                   1753:        fi; \
                   1754:        ${ECHO_MSG} "===>  ${PKGNAME} depends on: $$dir"; \
                   1755:        ${ECHO_MSG} "===>  Verifying $$target for $$dir"; \
                   1756:        if [ ! -d $$dir ]; then \
                   1757:            ${ECHO_MSG} ">> No directory for $$dir.  Skipping.."; \
1.1       niklas   1758:        else \
1.13      imp      1759:            (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1760:        fi \
                   1761:    done
                   1762:    @${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
                   1763: .endif
                   1764: .else
                   1765:    @${DO_NADA}
                   1766: .endif
                   1767:
                   1768: .endif
                   1769:
1.9       imp      1770: .if !target(clean-depends)
                   1771: clean-depends:
                   1772: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
                   1773:    || defined(RUN_DEPENDS)
1.13      imp      1774:    @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
                   1775:        if [ -d $$dir ] ; then \
                   1776:            (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
                   1777:        fi \
1.9       imp      1778:    done
                   1779: .endif
                   1780: .if defined(DEPENDS)
1.13      imp      1781:    @for dir in `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
                   1782:        if [ -d $$dir ] ; then \
                   1783:            (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
                   1784:        fi \
1.9       imp      1785:    done
                   1786: .endif
                   1787: .endif
                   1788:
1.1       niklas   1789: .if !target(depends-list)
                   1790: depends-list:
1.13      imp      1791:    @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      1792:        (cd $$dir; ${MAKE} package-name depends-list); \
1.1       niklas   1793:    done
                   1794: .endif
                   1795:
                   1796: ################################################################
                   1797: # Everything after here are internal targets and really
                   1798: # shouldn't be touched by anybody but the release engineers.
                   1799: ################################################################
                   1800:
                   1801: # This target generates an index entry suitable for aggregation into
                   1802: # a large index.  Format is:
                   1803: #
                   1804: # distribution-name|port-path|installation-prefix|comment| \
                   1805: #  description-file|maintainer|categories|build deps|run deps
                   1806: #
                   1807: .if !target(describe)
                   1808: describe:
1.13      imp      1809:    @${ECHO} -n "${PKGNAME}|${.CURDIR}|"; \
                   1810:    ${ECHO} -n "${PREFIX}|"; \
                   1811:    if [ -f ${COMMENT} ]; then \
                   1812:        ${ECHO} -n "`${CAT} ${COMMENT}`"; \
1.1       niklas   1813:    else \
                   1814:        ${ECHO} -n "** No Description"; \
1.13      imp      1815:    fi; \
                   1816:    if [ -f ${DESCR} ]; then \
                   1817:        ${ECHO} -n "|${DESCR}"; \
1.1       niklas   1818:    else \
                   1819:        ${ECHO} -n "|/dev/null"; \
1.13      imp      1820:    fi; \
                   1821:    ${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
                   1822:    case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
                   1823:        ABCDE) ;; \
                   1824:        *) cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`;; \
                   1825:    esac; \
                   1826:    ${ECHO} -n "|"; \
                   1827:    case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
                   1828:        ABCD) ;; \
                   1829:        *) cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`;; \
                   1830:    esac; \
                   1831:    ${ECHO} ""
1.1       niklas   1832: .endif
                   1833:
                   1834: .if !target(readmes)
                   1835: readmes:   readme
                   1836: .endif
                   1837:
                   1838: .if !target(readme)
                   1839: readme:
                   1840:    @rm -f README.html
1.6       niklas   1841:    @cd ${.CURDIR} && make README.html
1.1       niklas   1842: .endif
                   1843:
                   1844: README.html:
                   1845:    @${ECHO_MSG} "===>  Creating README.html for ${PKGNAME}"
                   1846:    @${CAT} ${TEMPLATES}/README.port | \
                   1847:        ${SED} -e 's&%%PORT%%&'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'&g' \
                   1848:            -e 's&%%PKG%%&${PKGNAME}&g' \
                   1849:            -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
                   1850:            -e '/%%COMMENT%%/d' \
                   1851:            -e 's&%%BUILD_DEPENDS%%&'"`${MAKE} print-depends-list`"'&' \
                   1852:            -e 's&%%RUN_DEPENDS%%&'"`${MAKE} print-package-depends`"'&' \
                   1853:        >> $@
                   1854:
                   1855: .if !target(print-depends-list)
                   1856: print-depends-list:
                   1857: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
                   1858:    defined(LIB_DEPENDS) || defined(DEPENDS)
                   1859:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      1860:    @${ECHO} -n `make depends-list | sort -u`
1.1       niklas   1861:    @${ECHO} '" to build.'
                   1862: .endif
                   1863: .endif
                   1864:
                   1865: .if !target(print-package-depends)
                   1866: print-package-depends:
                   1867: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
                   1868:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      1869:    @${ECHO} -n `make package-depends | sort -u`
1.1       niklas   1870:    @${ECHO} '" to run.'
                   1871: .endif
                   1872: .endif
                   1873:
                   1874: # Fake installation of package so that user can pkg_delete it later.
                   1875: # Also, make sure that an installed port is recognized correctly in
                   1876: # accordance to the @pkgdep directive in the packing lists
                   1877:
                   1878: .if !target(fake-pkg)
                   1879: fake-pkg:
1.13      imp      1880:    @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      1881:    @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
1.1       niklas   1882: .if defined(FORCE_PKG_REGISTER)
                   1883:    @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
                   1884: .endif
                   1885:    @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
                   1886:        ${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \
1.9       imp      1887:        ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
1.1       niklas   1888:        ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1.13      imp      1889:        ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
                   1890:        ${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1.1       niklas   1891:        if [ -f ${PKGDIR}/INSTALL ]; then \
                   1892:            ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
                   1893:        fi; \
                   1894:        if [ -f ${PKGDIR}/DEINSTALL ]; then \
                   1895:            ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
                   1896:        fi; \
                   1897:        if [ -f ${PKGDIR}/REQ ]; then \
                   1898:            ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
                   1899:        fi; \
1.13      imp      1900:        for dep in `make package-depends ECHO_MSG=/usr/bin/true | sort -u`; do \
                   1901:            if [ -d ${PKG_DBDIR}/$$dep ]; then \
                   1902:                if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
                   1903:                    >/dev/null 2>&1; then \
                   1904:                    ${ECHO} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \
                   1905:                fi; \
                   1906:            fi; \
                   1907:        done; \
1.1       niklas   1908:    fi
                   1909: .endif
                   1910:
                   1911: # Depend is generally meaningless for arbitrary ports, but if someone wants
                   1912: # one they can override this.  This is just to catch people who've gotten into
                   1913: # the habit of typing `make depend all install' as a matter of course.
                   1914: #
                   1915: .if !target(depend)
                   1916: depend:
                   1917: .endif
                   1918:
                   1919: # Same goes for tags
                   1920: .if !target(tags)
                   1921: tags:
1.10      niklas   1922: .endif
                   1923: