# $Id$

PortSystem     1.0

name           bsdmake
version        24
revision       1
categories     devel
platforms      darwin
license        BSD
maintainers    raimue openmaintainer
installs_libs  no

description    BSD make
long_description \
    BSD make is a build tool to create programs and libraries by rules \
    specified in a Makefile. This port is based on the last version from Apple as \
    provided by Xcode 4.2.

homepage       http://opensource.apple.com/
               # see also http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/make/
master_sites   http://opensource.apple.com/tarballs/${name}

checksums      rmd160  ff6d946a8b742b20948f9a48c9cdaa95e9dee2bd \
               sha256  82a948b80c2abfc61c4aa5c1da775986418a8e8eb3dd896288cfadf2e19c4985

patchfiles     patch-Makefile.diff \
               patch-mk.diff \
               patch-pathnames.diff \
               patch-setrlimit.diff

post-patch {
    reinplace "s:@PREFIX@:${prefix}:g" \
        ${worksrcpath}/mk/bsd.README \
        ${worksrcpath}/mk/bsd.cpu.mk \
        ${worksrcpath}/mk/bsd.doc.mk \
        ${worksrcpath}/mk/bsd.obj.mk \
        ${worksrcpath}/mk/bsd.own.mk \
        ${worksrcpath}/mk/bsd.port.mk \
        ${worksrcpath}/mk/bsd.port.subdir.mk \
        ${worksrcpath}/mk/sys.mk \
        ${worksrcpath}/pathnames.h
    reinplace "s:@INSTALL_USER@:${install.user}:g"   ${worksrcpath}/mk/bsd.own.mk
    reinplace "s:@INSTALL_GROUP@:${install.group}:g" ${worksrcpath}/mk/bsd.own.mk
}

use_configure no

build.target
# Using some pseudo MACHINE here, this ends up as ${MACHINE} in Makefiles
build.args -f Makefile.dist \
           CC="${configure.cc}" \
           CFLAGS="-D__FBSDID=__RCSID -mdynamic-no-pic \
                   -DMACHINE=\\\\\\\"MacPorts\\\\\\\" \
                   -DMACHINE_ARCH=\\\\\\\"${configure.build_arch}\\\\\\\"" \
           WARNS=1

destroot {
    xinstall -m 755 ${worksrcpath}/pmake ${destroot}${prefix}/bin/bsdmake
    xinstall -m 444 ${worksrcpath}/make.1 ${destroot}${prefix}/share/man/man1/bsdmake.1
    xinstall -d ${destroot}${prefix}/share/mk/bsdmake
    eval xinstall -m 644 [glob ${worksrcpath}/mk/*] ${destroot}${prefix}/share/mk/bsdmake
}

livecheck.type none