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

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