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

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