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

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