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

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