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

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