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

1.1       niklas      1: # -*- mode: Fundamental; tab-width: 4; -*-
1.5     ! tholo       2: #  $OpenBSD: bsd.port.mk,v 1.4 1996/06/11 10:38:02 deraadt Exp $
1.1       niklas      3: #
                      4: #  bsd.port.mk - 940820 Jordan K. Hubbard.
                      5: #  This file is in the public domain.
                      6: #
                      7: # Please view me with 4 column tabs!
                      8:
                      9:
                     10: # Supported Variables and their behaviors:
                     11: #
                     12: # Variables that typically apply to all ports:
                     13: #
                     14: # PORTSDIR     - The root of the ports tree (default: /usr/ports).
                     15: # DISTDIR      - Where to get gzip'd, tarballed copies of original sources
                     16: #                (default: ${PORTSDIR}/distfiles/${DIST_SUBDIR}).
                     17: # PREFIX       - Where to install things in general (default: /usr/local).
                     18: # MASTER_SITES - Primary location(s) for distribution files if not found
                     19: #                locally (default:
                     20: #                 ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
                     21: # PATCH_SITES  - Primary location(s) for distribution patch files
                     22: #                (see PATCHFILES below) if not found locally (default:
                     23: #                 ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
                     24: #
                     25: # MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
                     26: #                value.
                     27: # MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for
                     28: #                MASTER_SITES.
                     29: # PACKAGES     - A top level directory where all packages go (rather than
                     30: #                going locally to each port). (default: ${PORTSDIR}/packages).
                     31: # GMAKE            - Set to path of GNU make if not in $PATH (default: gmake).
                     32: # XMKMF            - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
                     33: # MAINTAINER   - The e-mail address of the contact person for this port
                     34: #                (default: ports@FreeBSD.ORG).
                     35: # CATEGORIES   - A list of descriptive categories into which this port falls
                     36: #                (default: orphans).
                     37: #
                     38: # Variables that typically apply to an individual port.  Non-Boolean
                     39: # variables without defaults are *mandatory*.
                     40: #
                     41: #
                     42: # WRKDIR       - A temporary working directory that gets *clobbered* on clean
                     43: #                (default: ${.CURDIR}/work).
                     44: # WRKSRC       - A subdirectory of ${WRKDIR} where the distribution actually
                     45: #                unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
                     46: #                NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
                     47: # DISTNAME     - Name of port or distribution.
                     48: # DISTFILES        - Name(s) of archive file(s) containing distribution
                     49: #                (default: ${DISTNAME}${EXTRACT_SUFX}).
                     50: # PATCHFILES   - Name(s) of additional files that contain distribution
                     51: #                patches (default: none).  make will look for them at
                     52: #                PATCH_SITES (see above).  They will automatically be
                     53: #                uncompressed before patching if the names end with
                     54: #                ".gz" or ".Z".
                     55: # DIST_SUBDIR  - Suffix to ${DISTDIR} (see above).  If set, all ${DISTFILES}
                     56: #                and ${PATCHFILES} will be put in this subdirectory of
                     57: #                ${DISTDIR}.  Also they will be fetched in this subdirectory
                     58: #                from FreeBSD mirror sites.
                     59: # PKGNAME      - Name of the package file to create if the DISTNAME
                     60: #                isn't really relevant for the port/package
                     61: #                (default: ${DISTNAME}).
                     62: # EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to
                     63: #                actually extract.
                     64: # PATCHDIR         - A directory containing any additional patches you made
                     65: #                to port this software to FreeBSD (default:
                     66: #                ${.CURDIR}/patches)
                     67: # SCRIPTDIR    - A directory containing any auxiliary scripts
                     68: #                (default: ${.CURDIR}/scripts)
                     69: # FILESDIR         - A directory containing any miscellaneous additional files.
                     70: #                (default: ${.CURDIR}/files)
                     71: # PKGDIR       - A direction containing any package creation files.
                     72: #                (default: ${.CURDIR}/pkg)
                     73: # PKG_DBDIR        - Where package installation is recorded (default: /var/db/pkg)
                     74: # FORCE_PKG_REGISTER - If set, it will overwrite any existing package
                     75: #                registration information in ${PKG_DBDIR}/${PKGNAME}.
                     76: # NO_MTREE     - If set, will not invoke mtree from bsd.port.mk from
                     77: #                the "install" target.  This is the default if
                     78: #                USE_IMAKE or USE_X11 is set.
                     79: #
                     80: # NO_EXTRACT   - Use a dummy (do-nothing) extract target.
                     81: # NO_CONFIGURE - Use a dummy (do-nothing) configure target.
                     82: # NO_BUILD     - Use a dummy (do-nothing) build target.
                     83: # NO_PACKAGE   - Use a dummy (do-nothing) package target.
                     84: # NO_INSTALL   - Use a dummy (do-nothing) install target.
                     85: # NO_CDROM     - Use dummy (do-nothing) targets if FOR_CDROM is set.
                     86: # NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}.
                     87: # NO_WRKDIR        - There's no work directory at all; port does this someplace
                     88: #                else.
                     89: # NO_DEPENDS   - Don't verify build of dependencies.
                     90: # BROKEN       - Port is broken.
                     91: # RESTRICTED   - Port is restricted.  Set this string to the reason why.
                     92: # USE_GMAKE        - Says that the port uses gmake.
                     93: # USE_IMAKE        - Says that the port uses imake.
                     94: # USE_X11      - Says that the port uses X11.
                     95: # NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
                     96: #                      target.
                     97: # HAS_CONFIGURE    - Says that the port has its own configure script.
                     98: # GNU_CONFIGURE    - Set if you are using GNU configure (optional).
                     99: # CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
                    100: # CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set.
                    101: # CONFIGURE_ENV  - Pass these env (shell-like) to configure if
                    102: #                ${HAS_CONFIGURE} is set.
                    103: # IS_INTERACTIVE - Set this if your port needs to interact with the user
                    104: #                during a build.  User can then decide to skip this port by
                    105: #                setting ${BATCH}, or compiling only the interactive ports
                    106: #                by setting ${INTERACTIVE}.
                    107: # FETCH_DEPENDS - A list of "prog:dir" pairs of other ports this
                    108: #                package depends in the "fetch" stage.  "prog" is the
                    109: #                name of an executable.  make will search your $PATH
                    110: #                for it and go into "dir" to do a "make all install"
                    111: #                if it's not found.
                    112: # BUILD_DEPENDS - A list of "prog:dir" pairs of other ports this
                    113: #                package depends to build (somewhere between the
                    114: #                "extract" to "build" stage).  "prog" is the name
                    115: #                of an executable.  make will search your $PATH for
                    116: #                it and go into "dir" to do a "make all install" if
                    117: #                it's not found.
                    118: # RUN_DEPENDS  - A list of "prog:dir" pairs of other ports this package
                    119: #                depends to run.  "prog" is the name of an
                    120: #                executable.  make will search your $PATH for it and
                    121: #                go into "dir" to do a "make all install" if it's not
                    122: #                found.  This will be build during the "install" stage
                    123: #                and its name will be put into the package as well.
                    124: # LIB_DEPENDS  - A list of "lib:dir" pairs of other ports this package
                    125: #                depends on.  "lib" is the name of a shared library.
                    126: #                make will use "ldconfig -r" to search for the
                    127: #                library.  Note that lib can be any regular expression,
                    128: #                and you need two backslashes in front of dots (.) to
                    129: #                supress its special meaning (e.g., use
                    130: #                "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
                    131: # DEPENDS      - A list of other ports this package depends on being
                    132: #                made first.  Use this for things that don't fall into
                    133: #                the above two categories.
                    134: # EXTRACT_CMD  - Command for extracting archive (default: tar).
                    135: # EXTRACT_SUFX - Suffix for archive names (default: .tar.gz).
                    136: # EXTRACT_BEFORE_ARGS -
                    137: #                Arguments to ${EXTRACT_CMD} before filename
                    138: #                (default: -C ${WRKDIR} -xzf).
                    139: # EXTRACT_AFTER_ARGS -
                    140: #                Arguments to ${EXTRACT_CMD} following filename
                    141: #                (default: none).
                    142: #
                    143: # NCFTP            - Full path to ncftp command if not in $PATH (default: ncftp).
                    144: # NCFTPFLAGS    - Arguments to ${NCFTP} (default: -N).
                    145: #
                    146: # Motif support:
                    147: #
                    148: # REQUIRES_MOTIF - Set this in your port if it requires Motif.  It will  be
                    149: #                built only if HAVE_MOTIF is set.
                    150: # HAVE_MOTIF   - If set, means system has Motif.  Typically set in
                    151: #                /etc/make.conf.
                    152: # MOTIF_STATIC - If set, link libXm statically; otherwise, link it
                    153: #                dynamically.
                    154: #
                    155: # Variables to change if you want a special behavior:
                    156: #
                    157: # ECHO_MSG     - Used to print all the '===>' style prompts - override this
                    158: #                to turn them off (default: /bin/echo).
                    159: # IS_DEPENDED_TARGET -
                    160: #                The target to execute when a port is called as a
                    161: #                dependency (default: install).  E.g., "make fetch
                    162: #                IS_DEPENDED_TARGET=fetch" will fetch all the distfiles,
                    163: #                including those of dependencies, without actually building
                    164: #                any of them).
                    165: #
                    166: #
                    167: # Default targets and their behaviors:
                    168: #
                    169: # fetch            - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
                    170: #                into ${DISTDIR} as necessary.
                    171: # fetch-list   - Show list of files that would be retrieved by fetch
                    172: # extract      - Unpacks ${DISTFILES} into ${WRKDIR}.
                    173: # patch            - Apply any provided patches to the source.
                    174: # configure        - Runs either GNU configure, one or more local configure
                    175: #                scripts or nothing, depending on what's available.
                    176: # build            - Actually compile the sources.
                    177: # install      - Install the results of a build.
                    178: # reinstall        - Install the results of a build, ignoring "already installed"
                    179: #                flag.
                    180: # package      - Create a package from an _installed_ port.
                    181: # describe     - Try to generate a one-line description for each port for
                    182: #                use in INDEX files and the like.
                    183: # checkpatch   - Do a "patch -C" instead of a "patch".  Note that it may
                    184: #                give incorrect results if multiple patches deal with
                    185: #                the same file.
                    186: # checksum     - Use files/md5 to ensure that your distfiles are valid.
                    187: # makesum      - Generate files/md5 (only do this for your own ports!).
                    188: #
                    189: # Default sequence for "all" is:  fetch checksum extract patch configure build
                    190: #
                    191: # Please read the comments in the targets section below, you
                    192: # should be able to use the pre-* or post-* targets/scripts
                    193: # (which are available for every stage except checksum) or
                    194: # override the do-* targets to do pretty much anything you want.
                    195: #
                    196: # NEVER override the "regular" targets unless you want to open
                    197: # a major can of worms.
                    198:
                    199: .if exists(${.CURDIR}/../Makefile.inc)
                    200: .include "${.CURDIR}/../Makefile.inc"
                    201: .endif
                    202:
                    203: # These need to be absolute since we don't know how deep in the ports
                    204: # tree we are and thus can't go relative.  They can, of course, be overridden
                    205: # by individual Makefiles.
                    206: PORTSDIR?=     ${DESTDIR}/usr/ports
                    207: LOCALBASE?=        /usr/local
                    208: X11BASE?=      /usr/X11R6
                    209: DISTDIR?=      ${PORTSDIR}/distfiles/${DIST_SUBDIR}
                    210: PACKAGES?=     ${PORTSDIR}/packages
                    211: TEMPLATES?=        ${PORTSDIR}/templates
                    212: .if !defined(NO_WRKDIR)
                    213: WRKDIR?=       ${.CURDIR}/work
                    214: .else
                    215: WRKDIR?=       ${.CURDIR}
                    216: .endif
                    217: .if defined(NO_WRKSUBDIR)
                    218: WRKSRC?=       ${WRKDIR}
                    219: .else
                    220: WRKSRC?=       ${WRKDIR}/${DISTNAME}
                    221: .endif
                    222: PATCHDIR?=     ${.CURDIR}/patches
                    223: SCRIPTDIR?=        ${.CURDIR}/scripts
                    224: FILESDIR?=     ${.CURDIR}/files
                    225: PKGDIR?=       ${.CURDIR}/pkg
                    226: .if defined(USE_IMAKE) || defined(USE_X11)
                    227: PREFIX?=       ${X11BASE}
                    228: .else
                    229: PREFIX?=       ${LOCALBASE}
                    230: .endif
                    231: # The following 4 lines should go away as soon as the ports are all updated
                    232: .if defined(EXEC_DEPENDS)
                    233: BUILD_DEPENDS+=    ${EXEC_DEPENDS}
                    234: RUN_DEPENDS+=  ${EXEC_DEPENDS}
                    235: .endif
                    236: .if defined(USE_GMAKE)
                    237: BUILD_DEPENDS+=               gmake:${PORTSDIR}/devel/gmake
                    238: .endif
                    239:
                    240: .if exists(${PORTSDIR}/../Makefile.inc)
                    241: .include "${PORTSDIR}/../Makefile.inc"
                    242: .endif
                    243:
                    244: # Don't change these!!!  These names are built into the _TARGET_USE macro,
                    245: # there is no way to refer to them cleanly from within the macro AFAIK.
                    246: EXTRACT_COOKIE?=   ${WRKDIR}/.extract_done
                    247: CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done
                    248: INSTALL_COOKIE?=   ${WRKDIR}/.install_done
                    249: BUILD_COOKIE?=     ${WRKDIR}/.build_done
                    250: PATCH_COOKIE?=     ${WRKDIR}/.patch_done
                    251: PACKAGE_COOKIE?=   ${WRKDIR}/.package_done
                    252:
                    253: # How to do nothing.  Override if you, for some strange reason, would rather
                    254: # do something.
                    255: DO_NADA?=      echo -n
                    256:
                    257: # Miscellaneous overridable commands:
                    258: GMAKE?=            gmake
                    259: XMKMF?=            xmkmf -a
1.4       deraadt   260: MD5?=          /bin/md5
1.1       niklas    261: MD5_FILE?=     ${FILESDIR}/md5
                    262:
                    263: MAKE_FLAGS?=   -f
                    264: MAKEFILE?=     Makefile
                    265: MAKE_ENV+=     PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
                    266:
1.2       niklas    267: NCFTP?=            /usr/bin/ftp
                    268: NCFTPFLAGS?=
1.1       niklas    269:
                    270: TOUCH?=            /usr/bin/touch
                    271: TOUCH_FLAGS?=  -f
                    272:
                    273: PATCH?=            /usr/bin/patch
                    274: PATCH_STRIP?=  -p0
                    275: PATCH_DIST_STRIP?= -p0
                    276: .if defined(PATCH_DEBUG)
                    277: PATCH_ARGS?=   -d ${WRKSRC} -E ${PATCH_STRIP}
                    278: PATCH_DIST_ARGS?=  -d ${WRKSRC} -E ${PATCH_DIST_STRIP}
                    279: .else
1.3       niklas    280: PATCH_ARGS?=   -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
                    281: PATCH_DIST_ARGS?=  -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
1.1       niklas    282: .endif
                    283: .if defined(BATCH)
                    284: PATCH_ARGS+=       --batch
                    285: PATCH_DIST_ARGS+=  --batch
                    286: .endif
                    287:
                    288: .if defined(PATCH_CHECK_ONLY)
                    289: PATCH_ARGS+=   -C
                    290: PATCH_DIST_ARGS+=  -C
                    291: .endif
                    292:
1.5     ! tholo     293: EXTRACT_CMD?=  /bin/tar
1.1       niklas    294: EXTRACT_SUFX?= .tar.gz
                    295: # Backwards compatability.
                    296: .if defined(EXTRACT_ARGS)
                    297: EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
                    298: .else
                    299: EXTRACT_BEFORE_ARGS?=   -xzf
                    300: .endif
                    301:
                    302: # Figure out where the local mtree file is
                    303: .if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist)
                    304: MTREE_LOCAL=   /etc/mtree/BSD.local.dist
                    305: .endif
                    306: MTREE_CMD?=    /usr/sbin/mtree
                    307: MTREE_ARGS?=   -U -f ${MTREE_LOCAL} -d -e -p
                    308: .if defined(USE_X11) || defined(USE_IMAKE) || !defined(MTREE_LOCAL)
                    309: NO_MTREE=  yes
                    310: .endif
                    311:
                    312: # The user can override the NO_PACKAGE by specifying this from
                    313: # the make command line
                    314: .if defined(FORCE_PACKAGE)
                    315: .undef NO_PACKAGE
                    316: .endif
                    317:
                    318: PKG_CMD?=      /usr/sbin/pkg_create
                    319: .if !defined(PKG_ARGS)
                    320: PKG_ARGS=      -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort|uniq`"
                    321: .if exists(${PKGDIR}/INSTALL)
                    322: PKG_ARGS+=     -i ${PKGDIR}/INSTALL
                    323: .endif
                    324: .if exists(${PKGDIR}/DEINSTALL)
                    325: PKG_ARGS+=     -k ${PKGDIR}/DEINSTALL
                    326: .endif
                    327: .if exists(${PKGDIR}/REQ)
                    328: PKG_ARGS+=     -r ${PKGDIR}/REQ
                    329: .endif
                    330: .if !defined(NO_MTREE) && defined(MTREE_LOCAL)
                    331: PKG_ARGS+=     -m ${MTREE_LOCAL}
                    332: .endif
                    333: .endif
                    334: PKG_SUFX?=     .tgz
                    335: # where pkg_add records its dirty deeds.
                    336: PKG_DBDIR?=        /var/db/pkg
                    337:
                    338: # shared/dynamic motif libs
                    339: .if defined(HAVE_MOTIF)
                    340: .if defined(MOTIF_STATIC)
                    341: MOTIFLIB?= ${X11BASE}/lib/libXm.a
                    342: .else
                    343: MOTIFLIB?= -L${X11BASE}/lib -lXm
                    344: .endif
                    345: .endif
                    346:
                    347: ECHO?=     /bin/echo
                    348: CAT+=      /bin/cat
                    349: CP?=       /bin/cp
                    350: SETENV?=   /usr/bin/env
                    351: RM?=       /bin/rm
                    352: MKDIR?=        /bin/mkdir
                    353: GZCAT?=        /usr/bin/gzcat
                    354: BASENAME?= /usr/bin/basename
                    355: SED?=      /usr/bin/sed
                    356: CAT?=      /bin/cat
                    357: GREP?=     /usr/bin/grep
                    358: AWK?=      /usr/bin/awk
                    359:
                    360: # Used to print all the '===>' style prompts - override this to turn them off.
                    361: ECHO_MSG?=     ${ECHO}
                    362:
                    363: ALL_TARGET?=       all
                    364: INSTALL_TARGET?=   install
                    365:
                    366: # If the user has this set, go to the FreeBSD respository for everything.
                    367: .if defined(MASTER_SITE_FREEBSD)
                    368: MASTER_SITE_OVERRIDE=  ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
                    369: .endif
                    370:
                    371: # I guess we're in the master distribution business! :)  As we gain mirror
                    372: # sites for distfiles, add them to this list.
                    373: .if !defined(MASTER_SITE_OVERRIDE)
                    374: MASTER_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
                    375: PATCH_SITES+=  ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
                    376: .else
                    377: MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
                    378: PATCH_SITES:=  ${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
                    379: .endif
                    380:
                    381: # Derived names so that they're easily overridable.
                    382: DISTFILES?=        ${DISTNAME}${EXTRACT_SUFX}
                    383: PKGNAME?=      ${DISTNAME}
                    384:
                    385: # This is what is actually going to be extracted, and is overridable
                    386: #  by user.
                    387: EXTRACT_ONLY?= ${DISTFILES}
                    388:
                    389: # Documentation
                    390: MAINTAINER?=   ports@FreeBSD.ORG
                    391: CATEGORIES?=   orphans
                    392:
                    393: # Note this has to start with a capital letter (or more accurately, it
                    394: #  shouldn't match "[a-z]*"), see the target "delete-package-links" below.
                    395: PKGREPOSITORYSUBDIR?=  All
                    396: PKGREPOSITORY?=        ${PACKAGES}/${PKGREPOSITORYSUBDIR}
                    397: .if exists(${PACKAGES})
                    398: PKGFILE?=      ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
                    399: .else
                    400: PKGFILE?=      ${PKGNAME}${PKG_SUFX}
                    401: .endif
                    402:
                    403: CONFIGURE_SCRIPT?= configure
                    404:
                    405: .if defined(GNU_CONFIGURE)
                    406: CONFIGURE_ARGS+=   --prefix=${PREFIX}
                    407: HAS_CONFIGURE=     yes
                    408: .endif
                    409:
                    410: .MAIN: all
                    411:
                    412: ################################################################
                    413: # Many ways to disable a port.
                    414: #
                    415: # If we're in BATCH mode and the port is interactive, or we're
                    416: # in interactive mode and the port is non-interactive, skip all
                    417: # the important targets.  The reason we have two modes is that
                    418: # one might want to leave a build in BATCH mode running
                    419: # overnight, then come back in the morning and do _only_ the
                    420: # interactive ones that required your intervention.
                    421: #
                    422: # Don't attempt to build ports that require Motif if you don't
                    423: # have Motif.
                    424: #
                    425: # Ignore ports that can't be resold if building for a CDROM.
                    426: #
                    427: # Don't build a port if it's restricted and we don't want to get
                    428: # into that.
                    429: #
                    430: # Don't build a port if it's broken.
                    431: ################################################################
                    432:
                    433: .if (defined(IS_INTERACTIVE) && defined(BATCH)) || \
                    434:    (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) || \
                    435:    (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF)) || \
                    436:    (defined(NO_CDROM) && defined(FOR_CDROM)) || \
                    437:    (defined(RESTRICTED) && defined(NO_RESTRICTED)) || \
                    438:    defined(BROKEN)
                    439: IGNORE=    yes
                    440: .endif
                    441:
                    442: .if defined(IGNORE)
                    443: all:
                    444:    @${DO_NADA}
                    445: build:
                    446:    @${DO_NADA}
                    447: install:
                    448:    @${DO_NADA}
                    449: fetch:
                    450:    @${DO_NADA}
                    451: configure:
                    452:    @${DO_NADA}
                    453: package:
                    454:    @${DO_NADA}
                    455: .endif
                    456:
                    457: .if defined(ALL_HOOK)
                    458: all:
                    459:    @${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
                    460:      DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
                    461:      PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                    462:      FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                    463:      DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
                    464:      RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
                    465:    ${ALL_HOOK}
                    466: .endif
                    467:
                    468: .if !target(all)
                    469: all: build
                    470: .endif
                    471:
                    472: .if !defined(IS_DEPENDED_TARGET)
                    473: IS_DEPENDED_TARGET=    install
                    474: .endif
                    475:
                    476: .if !target(is_depended)
                    477: is_depended:   ${IS_DEPENDED_TARGET}
                    478: .endif
                    479:
                    480: ################################################################
                    481: # The following are used to create easy dummy targets for
                    482: # disabling some bit of default target behavior you don't want.
                    483: # They still check to see if the target exists, and if so don't
                    484: # do anything, since you might want to set this globally for a
                    485: # group of ports in a Makefile.inc, but still be able to
                    486: # override from an individual Makefile.
                    487: ################################################################
                    488:
                    489: # Disable extract
                    490: .if defined(NO_EXTRACT) && !target(extract)
                    491: extract: checksum
                    492:    @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
                    493: checksum: fetch
                    494:    @${DO_NADA}
                    495: makesum:
                    496:    @${DO_NADA}
                    497: .endif
                    498:
                    499: # Disable configure
                    500: .if defined(NO_CONFIGURE) && !target(configure)
                    501: configure: patch
                    502:    @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
                    503: .endif
                    504:
                    505: # Disable build
                    506: .if defined(NO_BUILD) && !target(build)
                    507: build: configure
                    508:    @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
                    509: .endif
                    510:
                    511: # Disable package
                    512: .if defined(NO_PACKAGE) && !target(package)
                    513: package:
                    514:    @${DO_NADA}
                    515: .endif
                    516:
                    517: # Disable install
                    518: .if defined(NO_INSTALL) && !target(install)
                    519: install: build
                    520:    @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
                    521: .endif
                    522:
                    523: # Disable patch
                    524: .if defined(NO_PATCH) && !target(patch)
                    525: patch: extract
                    526:    @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
                    527: .endif
                    528:
                    529: ################################################################
                    530: # More standard targets start here.
                    531: #
                    532: # These are the body of the build/install framework.  If you are
                    533: # not happy with the default actions, and you can't solve it by
                    534: # adding pre-* or post-* targets/scripts, override these.
                    535: ################################################################
                    536:
                    537: # Fetch
                    538:
                    539: .if !target(do-fetch)
                    540: do-fetch:
                    541:    @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi
                    542:    @(cd ${DISTDIR}; \
                    543:     for file in ${DISTFILES}; do \
                    544:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    545:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
                    546:                ${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \
                    547:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                    548:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                    549:                exit 1; \
                    550:            fi ; \
                    551:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                    552:            for site in ${MASTER_SITES}; do \
                    553:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
                    554:                (${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${NCFTPTAIL} || true); \
                    555:                if [ -f $$file -o -f `${BASENAME} $$file` ]; then \
                    556:                    continue 2; \
                    557:                fi \
                    558:            done; \
                    559:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\
                    560:            ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \
                    561:            exit 1; \
                    562:        fi \
                    563:     done)
                    564: .if defined(PATCHFILES)
                    565:    @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi
                    566:    @(cd ${DISTDIR}; \
                    567:     for file in ${PATCHFILES}; do \
                    568:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    569:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
                    570:                ${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \
                    571:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                    572:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                    573:                exit 1; \
                    574:            fi ; \
                    575:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                    576:            for site in ${PATCH_SITES}; do \
                    577:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
                    578:                (${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${NCFTPTAIL} || true); \
                    579:                if [ -f $$file -o -f `${BASENAME} $$file` ]; then \
                    580:                    continue 2; \
                    581:                fi \
                    582:            done; \
                    583:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\
                    584:            ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \
                    585:            exit 1; \
                    586:        fi \
                    587:     done)
                    588: .endif
                    589: .endif
                    590:
                    591: # Extract
                    592:
                    593: .if !target(do-extract)
                    594: do-extract:
                    595:    @${RM} -rf ${WRKDIR}
                    596:    @${MKDIR} -p ${WRKDIR}
                    597:    @for file in ${EXTRACT_ONLY}; do \
                    598:        if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
                    599:        then \
                    600:            exit 1; \
                    601:        fi \
                    602:    done
                    603: .endif
                    604:
                    605: # Patch
                    606:
                    607: .if !target(do-patch)
                    608: do-patch:
                    609: .if defined(PATCHFILES)
                    610:    @${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
                    611: .if defined(PATCH_DEBUG)
                    612:    @(cd ${DISTDIR}; \
                    613:      for i in ${PATCHFILES}; do \
                    614:        ${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
                    615:        case $$i in \
                    616:            *.Z|*.gz) \
                    617:                ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
                    618:                ;; \
                    619:            *) \
                    620:                ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
                    621:                ;; \
                    622:        esac; \
                    623:      done)
                    624: .else
                    625:    @(cd ${DISTDIR}; \
                    626:      for i in ${PATCHFILES}; do \
                    627:        case $$i in \
                    628:            *.Z|*.gz) \
                    629:                ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
                    630:                ;; \
                    631:            *) \
                    632:                ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
                    633:                ;; \
                    634:        esac; \
                    635:      done)
                    636: .endif
                    637: .endif
                    638: .if defined(PATCH_DEBUG)
                    639:    @if [ -d ${PATCHDIR} ]; then \
                    640:        ${ECHO_MSG} "===>  Applying FreeBSD patches for ${PKGNAME}" ; \
                    641:        for i in ${PATCHDIR}/patch-*; do \
                    642:            case $$i in \
                    643:                *.orig|*~) \
                    644:                    ${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
                    645:                    ;; \
                    646:                *) \
                    647:                    ${ECHO_MSG} "===>   Applying FreeBSD patch $$i" ; \
                    648:                    ${PATCH} ${PATCH_ARGS} < $$i; \
                    649:                    ;; \
                    650:            esac; \
                    651:        done; \
                    652:    fi
                    653: .else
                    654:    @if [ -d ${PATCHDIR} ]; then \
                    655:        ${ECHO_MSG} "===>  Applying FreeBSD patches for ${PKGNAME}" ; \
                    656:        for i in ${PATCHDIR}/patch-*; do \
                    657:            case $$i in \
                    658:                *.orig|*~) \
                    659:                    ${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
                    660:                    ;; \
                    661:                *) \
                    662:                    ${PATCH} ${PATCH_ARGS} < $$i; \
                    663:                    ;; \
                    664:            esac; \
                    665:        done;\
                    666:    fi
                    667: .endif
                    668: .endif
                    669:
                    670: # Configure
                    671:
                    672: .if !target(do-configure)
                    673: do-configure:
                    674:    @if [ -f ${SCRIPTDIR}/configure ]; then \
                    675:        ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
                    676:          WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                    677:          FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                    678:          DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
                    679:        /bin/sh ${SCRIPTDIR}/configure; \
                    680:    fi
                    681: .if defined(HAS_CONFIGURE)
                    682:    @(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
                    683:        INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
                    684:        INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \
                    685:        ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
                    686: .endif
                    687: .if defined(USE_IMAKE)
                    688:    @(cd ${WRKSRC}; ${XMKMF})
                    689: .endif
                    690: .endif
                    691:
                    692: # Build
                    693:
                    694: .if !target(do-build)
                    695: do-build:
                    696: .if defined(USE_GMAKE)
                    697:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                    698: .else defined(USE_GMAKE)
                    699:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                    700: .endif
                    701: .endif
                    702:
                    703: # Install
                    704:
                    705: .if !target(do-install)
                    706: do-install:
                    707: .if defined(USE_GMAKE)
                    708:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
                    709: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
                    710:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
                    711: .endif
                    712: .else defined(USE_GMAKE)
                    713:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
                    714: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
                    715:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
                    716: .endif
                    717: .endif
                    718: .endif
                    719:
                    720: # Package
                    721:
                    722: .if !target(do-package)
                    723: do-package:
                    724:    @if [ -e ${PKGDIR}/PLIST ]; then \
                    725:        ${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
                    726:        if [ -d ${PACKAGES} ]; then \
                    727:            if [ ! -d ${PKGREPOSITORY} ]; then \
                    728:                if ! ${MKDIR} -p ${PKGREPOSITORY}; then \
                    729:                    ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
                    730:                    exit 1; \
                    731:                fi; \
                    732:            fi; \
                    733:        fi; \
                    734:        if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
                    735:            if [ -d ${PACKAGES} ]; then \
                    736:                ${MAKE} ${.MAKEFLAGS} package-links; \
                    737:            fi; \
                    738:        else \
                    739:            ${MAKE} ${.MAKEFLAGS} delete-package; \
                    740:            exit 1; \
                    741:        fi; \
                    742:    fi
                    743: .endif
                    744:
                    745: # Some support rules for do-package
                    746:
                    747: .if !target(package-links)
                    748: package-links:
                    749:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                    750:    @for cat in ${CATEGORIES}; do \
                    751:        if [ ! -d ${PACKAGES}/$$cat ]; then \
                    752:            if ! ${MKDIR} -p ${PACKAGES}/$$cat; then \
                    753:                ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
                    754:                exit 1; \
                    755:            fi; \
                    756:        fi; \
                    757:        ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
                    758:    done;
                    759: .endif
                    760:
                    761: .if !target(delete-package-links)
                    762: delete-package-links:
                    763:    @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
                    764: .endif
                    765:
                    766: .if !target(delete-package)
                    767: delete-package:
                    768:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                    769:    @${RM} -f ${PKGFILE}
                    770: .endif
                    771:
                    772: ################################################################
                    773: # This is the "generic" port target, actually a macro used from the
                    774: # six main targets.  See below for more.
                    775: ################################################################
                    776:
                    777: _PORT_USE: .USE
                    778: .if make(real-fetch)
                    779:    @${MAKE} ${.MAKEFLAGS} fetch-depends
                    780: .endif
                    781: .if make(real-extract)
                    782:    @${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
                    783: .endif
                    784: .if make(real-install)
                    785:    @${MAKE} ${.MAKEFLAGS} run-depends
                    786: .endif
                    787: .if make(real-install)
                    788: .if !defined(NO_MTREE)
                    789:    @if [ `id -u` = 0 ]; then \
                    790:        ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
                    791:    else \
                    792:        ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
                    793:        ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
                    794:    fi
                    795: .endif
                    796: .endif
                    797:    @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
                    798:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
                    799:        ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
                    800:          WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                    801:          FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                    802:          DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
                    803:            /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
                    804:    fi
                    805:    @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
                    806:    @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
                    807:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
                    808:        ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
                    809:          WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                    810:          FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                    811:          DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
                    812:            /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
                    813:    fi
                    814: .if make(real-install)
                    815:    @${MAKE} ${.MAKEFLAGS} fake-pkg
                    816: .endif
                    817: .if !make(real-fetch) \
                    818:    && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
                    819:    && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
                    820:    @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
                    821: .endif
                    822:
                    823: ################################################################
                    824: # Skeleton targets start here
                    825: #
                    826: # You shouldn't have to change these.  Either add the pre-* or
                    827: # post-* targets/scripts or redefine the do-* targets.  These
                    828: # targets don't do anything other than checking for cookies and
                    829: # call the necessary targets/scripts.
                    830: ################################################################
                    831:
                    832: .if !target(fetch)
                    833: fetch:
                    834:    @${MAKE} ${.MAKEFLAGS} real-fetch
                    835: .endif
                    836:
                    837: .if !target(extract)
                    838: extract: checksum ${EXTRACT_COOKIE}
                    839: .endif
                    840:
                    841: .if !target(patch)
                    842: patch: extract ${PATCH_COOKIE}
                    843: .endif
                    844:
                    845: .if !target(configure)
                    846: configure: patch ${CONFIGURE_COOKIE}
                    847: .endif
                    848:
                    849: .if !target(build)
                    850: build: configure ${BUILD_COOKIE}
                    851: .endif
                    852:
                    853: .if !target(install)
                    854: install: build ${INSTALL_COOKIE}
                    855: .endif
                    856:
                    857: .if !target(package)
                    858: package: install ${PACKAGE_COOKIE}
                    859: .endif
                    860:
                    861: ${EXTRACT_COOKIE}:
                    862:    @${MAKE} ${.MAKEFLAGS} real-extract
                    863: ${PATCH_COOKIE}:
                    864:    @${MAKE} ${.MAKEFLAGS} real-patch
                    865: ${CONFIGURE_COOKIE}:
                    866:    @${MAKE} ${.MAKEFLAGS} real-configure
                    867: ${BUILD_COOKIE}:
                    868:    @${MAKE} ${.MAKEFLAGS} real-build
                    869: ${INSTALL_COOKIE}:
                    870:    @${MAKE} ${.MAKEFLAGS} real-install
                    871: ${PACKAGE_COOKIE}:
                    872:    @${MAKE} ${.MAKEFLAGS} real-package
                    873:
                    874: # And call the macros
                    875:
                    876: real-fetch: _PORT_USE
                    877: real-extract: _PORT_USE
                    878:    @${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
                    879: real-patch: _PORT_USE
                    880:    @${ECHO_MSG} "===>  Patching for ${PKGNAME}"
                    881: real-configure: _PORT_USE
                    882:    @${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
                    883: real-build: _PORT_USE
                    884:    @${ECHO_MSG} "===>  Building for ${PKGNAME}"
                    885: real-install: _PORT_USE
                    886:    @${ECHO_MSG} "===>  Installing for ${PKGNAME}"
                    887: real-package: _PORT_USE
                    888:
                    889: # Empty pre-* and post-* targets, note we can't use .if !target()
                    890: # in the _PORT_USE macro
                    891:
                    892: .for name in fetch extract patch configure build install package
                    893:
                    894: .if !target(pre-${name})
                    895: pre-${name}:
                    896:    @${DO_NADA}
                    897: .endif
                    898:
                    899: .if !target(post-${name})
                    900: post-${name}:
                    901:    @${DO_NADA}
                    902: .endif
                    903:
                    904: .endfor
                    905:
                    906: # Checkpatch
                    907: #
                    908: # Special target to verify patches
                    909:
                    910: .if !target(checkpatch)
                    911: checkpatch:
                    912:    @${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
                    913: .endif
                    914:
                    915: # Reinstall
                    916: #
                    917: # Special target to re-run install
                    918:
                    919: .if !target(reinstall)
                    920: reinstall: pre-reinstall install
                    921:
                    922: pre-reinstall:
                    923:    @${RM} -f ${INSTALL_COOKIE}
                    924:    @${RM} -f ${PACKAGE_COOKIE}
                    925: .endif
                    926:
                    927: ################################################################
                    928: # Some more targets supplied for users' convenience
                    929: ################################################################
                    930:
                    931: # Cleaning up
                    932:
                    933: .if !target(pre-clean)
                    934: pre-clean:
                    935:    @${DO_NADA}
                    936: .endif
                    937:
                    938: .if !target(clean)
                    939: clean: pre-clean
                    940:    @${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
                    941:    @${RM} -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \
                    942:        ${BUILD_COOKIE} ${PATCH_COOKIE}
                    943: .if defined(NO_WRKDIR)
                    944:    @${RM} -f ${WRKDIR}/.*_done
                    945: .else
                    946:    @${RM} -rf ${WRKDIR}
                    947: .endif
                    948: .endif
                    949:
                    950: # Prints out a list of files to fetch (useful to do a batch fetch)
                    951:
                    952: .if !target(fetch-list)
                    953: fetch-list:
                    954:    @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi
                    955:    @(cd ${DISTDIR}; \
                    956:     for file in ${DISTFILES}; do \
                    957:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    958:            for site in ${MASTER_SITES}; do \
                    959:                ${ECHO} -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} "${NCFTPTAIL}" '||' ; \
                    960:                    break; \
                    961:            done; \
                    962:            ${ECHO} "echo $${file} not fetched" ; \
                    963:        fi \
                    964:    done)
                    965: .if defined(PATCHFILES)
                    966:    @(cd ${DISTDIR}; \
                    967:     for file in ${PATCHFILES}; do \
                    968:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    969:            for site in ${PATCH_SITES}; do \
                    970:                ${ECHO} -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} "${NCFTPTAIL}" '||' ; \
                    971:                    break; \
                    972:            done; \
                    973:            ${ECHO} "echo $${file} not fetched" ; \
                    974:        fi \
                    975:     done)
                    976: .endif
                    977: .endif
                    978:
                    979: # Checksumming utilities
                    980:
                    981: .if !target(makesum)
                    982: makesum: fetch
                    983:    @if [ ! -d ${FILESDIR} ]; then ${MKDIR} -p ${FILESDIR}; fi
                    984:    @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
                    985:    @(cd ${DISTDIR}; \
                    986:     for file in ${DISTFILES} ${PATCHFILES}; do \
                    987:        ${MD5} $$file >> ${MD5_FILE}; \
                    988:     done)
                    989: .endif
                    990:
                    991: .if !target(checksum)
                    992: checksum: fetch
                    993:    @if [ ! -f ${MD5_FILE} ]; then \
                    994:        ${ECHO_MSG} ">> No MD5 checksum file."; \
                    995:    else \
                    996:        (cd ${DISTDIR}; OK=""; \
                    997:          for file in ${DISTFILES} ${PATCHFILES}; do \
                    998:            CKSUM=`${MD5} $$file | ${AWK} '{print $$4}'`; \
                    999:            CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
                   1000:            if [ "$$CKSUM2" = "" ]; then \
                   1001:                ${ECHO_MSG} ">> No checksum recorded for $$file"; \
                   1002:                OK="false"; \
                   1003:            elif [ "$$CKSUM" != "$$CKSUM2" ]; then \
                   1004:                ${ECHO_MSG} ">> Checksum mismatch for $$file"; \
                   1005:                exit 1; \
                   1006:            fi; \
                   1007:          done; \
                   1008:          if [ "$$OK" = "" ]; then \
                   1009:            ${ECHO_MSG} "Checksums OK."; \
                   1010:          else \
                   1011:            ${ECHO_MSG} "Checksums OK for files that have them."; \
                   1012:          fi) ; \
                   1013:    fi
                   1014: .endif
                   1015:
                   1016: ################################################################
                   1017: # The special package-building targets
                   1018: # You probably won't need to touch these
                   1019: ################################################################
                   1020:
                   1021: # Nobody should want to override this unless PKGNAME is simply bogus.
                   1022:
                   1023: .if !target(package-name)
                   1024: package-name:
                   1025:    @${ECHO} ${PKGNAME}
                   1026: .endif
                   1027:
                   1028: # Show (recursively) all the packages this package depends on.
                   1029:
                   1030: .if !target(package-depends)
                   1031: package-depends:
                   1032:    @for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
                   1033:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1034:        (cd $$dir ; ${MAKE} package-name package-depends); \
                   1035:    done
                   1036: .endif
                   1037:
                   1038: # Build a package but don't check the package cookie
                   1039:
                   1040: .if !target(repackage)
                   1041: repackage: pre-repackage package
                   1042:
                   1043: pre-repackage:
                   1044:    @${RM} -f ${PACKAGE_COOKIE}
                   1045: .endif
                   1046:
                   1047: # Build a package but don't check the cookie for installation, also don't
                   1048: # install package cookie
                   1049:
                   1050: .if !target(package-noinstall)
                   1051: package-noinstall:
                   1052:    @${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
                   1053: .endif
                   1054:
                   1055: ################################################################
                   1056: # Dependency checking
                   1057: ################################################################
                   1058:
                   1059: .if !target(depends)
                   1060: depends: lib-depends misc-depends
                   1061:    @${MAKE} ${.MAKEFLAGS} fetch-depends
                   1062:    @${MAKE} ${.MAKEFLAGS} build-depends
                   1063:    @${MAKE} ${.MAKEFLAGS} run-depends
                   1064:
                   1065: .if make(fetch-depends)
                   1066: DEPENDS_TMP+=  ${FETCH_DEPENDS}
                   1067: .endif
                   1068:
                   1069: .if make(build-depends)
                   1070: DEPENDS_TMP+=  ${BUILD_DEPENDS}
                   1071: .endif
                   1072:
                   1073: .if make(run-depends)
                   1074: DEPENDS_TMP+=  ${RUN_DEPENDS}
                   1075: .endif
                   1076:
                   1077: _DEPENDS_USE:  .USE
                   1078: .if defined(DEPENDS_TMP)
                   1079: .if defined(NO_DEPENDS)
                   1080: # Just print out messages
                   1081:    @for i in ${DEPENDS_TMP}; do \
                   1082:        prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1083:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1084:        if expr "$$prog" : \\/ >/dev/null; then \
                   1085:            ${ECHO_MSG} "===>  ${PKGNAME} depends on file:  $$prog ($$dir)"; \
                   1086:        else \
                   1087:            ${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
                   1088:        fi; \
                   1089:    done
                   1090: .else
                   1091:    @for i in ${DEPENDS_TMP}; do \
                   1092:        prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1093:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1094:        if expr "$$prog" : \\/ >/dev/null; then \
                   1095:            if [ -e "$$prog" ]; then \
                   1096:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - found"; \
                   1097:                notfound=0; \
                   1098:            else \
                   1099:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - not found"; \
                   1100:                notfound=1; \
                   1101:            fi; \
                   1102:        else \
                   1103:            if which -s "$$prog"; then \
                   1104:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
                   1105:                notfound=0; \
                   1106:            else \
                   1107:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
                   1108:                notfound=1; \
                   1109:            fi; \
                   1110:        fi; \
                   1111:        if [ $$notfound != 0 ]; then \
                   1112:            ${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \
                   1113:            if [ ! -d "$$dir" ]; then \
                   1114:                ${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
                   1115:            else \
                   1116:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
                   1117:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1118:            fi; \
                   1119:        fi; \
                   1120:    done
                   1121: .endif
                   1122: .else
                   1123:    @${DO_NADA}
                   1124: .endif
                   1125:
                   1126: fetch-depends: _DEPENDS_USE
                   1127: build-depends: _DEPENDS_USE
                   1128: run-depends:   _DEPENDS_USE
                   1129:
                   1130: lib-depends:
                   1131: .if defined(LIB_DEPENDS)
                   1132: .if defined(NO_DEPENDS)
                   1133: # Just print out messages
                   1134:    @for i in ${LIB_DEPENDS}; do \
                   1135:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1136:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1137:        ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library:  $$lib ($$dir)"; \
                   1138:    done
                   1139: .else
                   1140:    @for i in ${LIB_DEPENDS}; do \
                   1141:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1142:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1143:        if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \
                   1144:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \
                   1145:        else \
                   1146:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \
                   1147:            ${ECHO_MSG} "===>  Verifying build for $$lib in $$dir"; \
                   1148:            if [ ! -d "$$dir" ]; then \
                   1149:                ${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
                   1150:            else \
                   1151:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
                   1152:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1153:            fi; \
                   1154:        fi; \
                   1155:    done
                   1156: .endif
                   1157: .else
                   1158:    @${DO_NADA}
                   1159: .endif
                   1160:
                   1161: misc-depends:
                   1162: .if defined(DEPENDS)
                   1163:    @${ECHO_MSG} "===>  ${PKGNAME} depends on:  ${DEPENDS}"
                   1164: .if !defined(NO_DEPENDS)
                   1165:    @for i in ${DEPENDS}; do \
                   1166:        ${ECHO_MSG} "===>  Verifying build for $$i"; \
                   1167:        if [ ! -d $$i ]; then \
                   1168:            ${ECHO_MSG} ">> No directory for $$i.  Skipping.."; \
                   1169:        else \
                   1170:            (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
                   1171:        fi \
                   1172:    done
                   1173:    @${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
                   1174: .endif
                   1175: .else
                   1176:    @${DO_NADA}
                   1177: .endif
                   1178:
                   1179: .endif
                   1180:
                   1181: .if !target(depends-list)
                   1182: depends-list:
                   1183:    @for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
                   1184:        dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
                   1185:        (cd $$dir ; ${MAKE} package-name depends-list); \
                   1186:    done
                   1187: .endif
                   1188:
                   1189: ################################################################
                   1190: # Everything after here are internal targets and really
                   1191: # shouldn't be touched by anybody but the release engineers.
                   1192: ################################################################
                   1193:
                   1194: # This target generates an index entry suitable for aggregation into
                   1195: # a large index.  Format is:
                   1196: #
                   1197: # distribution-name|port-path|installation-prefix|comment| \
                   1198: #  description-file|maintainer|categories|build deps|run deps
                   1199: #
                   1200: .if !target(describe)
                   1201: describe:
                   1202:    @${ECHO} -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|"
                   1203:    @${ECHO} -n "${PREFIX}|"
                   1204:    @if [ -f ${PKGDIR}/COMMENT ]; then \
                   1205:        ${ECHO} -n "`${CAT} ${PKGDIR}/COMMENT`"; \
                   1206:    else \
                   1207:        ${ECHO} -n "** No Description"; \
                   1208:    fi
                   1209:    @if [ -f ${PKGDIR}/DESCR ]; then \
                   1210:        ${ECHO} -n "|${PKGDIR}/DESCR"; \
                   1211:    else \
                   1212:        ${ECHO} -n "|/dev/null"; \
                   1213:    fi
                   1214:    @${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"
                   1215:    @${ECHO} -n `make depends-list|sort|uniq`
                   1216:    @${ECHO} -n "|"
                   1217:    @${ECHO} -n `make package-depends|sort|uniq`
                   1218:    @${ECHO} ""
                   1219: .endif
                   1220:
                   1221: .if !target(readmes)
                   1222: readmes:   readme
                   1223: .endif
                   1224:
                   1225: .if !target(readme)
                   1226: readme:
                   1227:    @rm -f README.html
                   1228:    @make README.html
                   1229: .endif
                   1230:
                   1231: README.html:
                   1232:    @${ECHO_MSG} "===>  Creating README.html for ${PKGNAME}"
                   1233:    @${CAT} ${TEMPLATES}/README.port | \
                   1234:        ${SED} -e 's&%%PORT%%&'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'&g' \
                   1235:            -e 's&%%PKG%%&${PKGNAME}&g' \
                   1236:            -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
                   1237:            -e '/%%COMMENT%%/d' \
                   1238:            -e 's&%%BUILD_DEPENDS%%&'"`${MAKE} print-depends-list`"'&' \
                   1239:            -e 's&%%RUN_DEPENDS%%&'"`${MAKE} print-package-depends`"'&' \
                   1240:        >> $@
                   1241:
                   1242: .if !target(print-depends-list)
                   1243: print-depends-list:
                   1244: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
                   1245:    defined(LIB_DEPENDS) || defined(DEPENDS)
                   1246:    @${ECHO} -n 'This port requires package(s) "'
                   1247:    @${ECHO} -n `make depends-list | sort | uniq`
                   1248:    @${ECHO} '" to build.'
                   1249: .endif
                   1250: .endif
                   1251:
                   1252: .if !target(print-package-depends)
                   1253: print-package-depends:
                   1254: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
                   1255:    @${ECHO} -n 'This port requires package(s) "'
                   1256:    @${ECHO} -n `make package-depends | sort | uniq`
                   1257:    @${ECHO} '" to run.'
                   1258: .endif
                   1259: .endif
                   1260:
                   1261: # Fake installation of package so that user can pkg_delete it later.
                   1262: # Also, make sure that an installed port is recognized correctly in
                   1263: # accordance to the @pkgdep directive in the packing lists
                   1264:
                   1265: .if !target(fake-pkg)
                   1266: fake-pkg:
                   1267:    @if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
                   1268:    @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} -p ${PKG_DBDIR}; fi
                   1269: .if defined(FORCE_PKG_REGISTER)
                   1270:    @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
                   1271: .endif
                   1272:    @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
                   1273:        ${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \
                   1274:        ${MKDIR} -p ${PKG_DBDIR}/${PKGNAME}; \
                   1275:        ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
                   1276:        ${CP} ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \
                   1277:        ${CP} ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
                   1278:        if [ -f ${PKGDIR}/INSTALL ]; then \
                   1279:            ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
                   1280:        fi; \
                   1281:        if [ -f ${PKGDIR}/DEINSTALL ]; then \
                   1282:            ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
                   1283:        fi; \
                   1284:        if [ -f ${PKGDIR}/REQ ]; then \
                   1285:            ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
                   1286:        fi; \
                   1287:    else \
                   1288:        ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \
                   1289:        ${ECHO_MSG} "     If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
                   1290:        ${ECHO_MSG} "     this port again by \`\`make reinstall'' to upgrade it properly."; \
                   1291:    fi
                   1292: .endif
                   1293:
                   1294: # Depend is generally meaningless for arbitrary ports, but if someone wants
                   1295: # one they can override this.  This is just to catch people who've gotten into
                   1296: # the habit of typing `make depend all install' as a matter of course.
                   1297: #
                   1298: .if !target(depend)
                   1299: depend:
                   1300: .endif
                   1301:
                   1302: # Same goes for tags
                   1303: .if !target(tags)
                   1304: tags:
                   1305: .endif