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

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