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

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