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

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