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

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