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

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