1# -*- mode: Fundamental; tab-width: 4; -*- 2# 3# bsd.port.mk - 940820 Jordan K. Hubbard. 4# This file is in the public domain. 5# 6# $Id: bsd.port.mk,v 1.112 1995/02/06 08:52:19 hsu Exp $ 7# 8# Please view me with 4 column tabs! 9 10 11# Supported Variables and their behaviors: 12# 13# Variables that typically apply to all ports: 14# 15# PORTSDIR - The root of the ports tree (default: /usr/ports). 16# DISTDIR - Where to get gzip'd, tarballed copies of original sources 17# (default: ${PORTSDIR}/distfiles). 18# PREFIX - Where to install things in general (default: /usr/local). 19# MASTER_SITES - Primary location(s) for distribution files if not found 20# locally (default: 21# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 22# 23# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this 24# value. 25# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for 26# MASTER_SITES. 27# PACKAGES - A top level directory where all packages go (rather than 28# going locally to each port). (default: ${PORTSDIR}/packages). 29# GMAKE - Set to path of GNU make if not in $PATH (default: gmake). 30# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf). 31# 32# Variables that typically apply to an individual port. Non-Boolean 33# variables without defaults are *mandatory*. 34# 35# 36# WRKDIR - A temporary working directory that gets *clobbered* on clean 37# (default: ${.CURDIR}/work). 38# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually 39# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless 40# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}). 41# DISTNAME - Name of port or distribution. 42# DISTFILES - Name(s) of archive file(s) containing distribution 43# (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}). 44# PKGNAME - Name of the package file to create if the DISTNAME 45# isn't really relevant for the port/package 46# (default: ${DISTNAME}). 47# EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to 48# actually extract. 49# PATCHDIR - A directory containing any required patches 50# (default: ${.CURDIR}/patches) 51# SCRIPTDIR - A directory containing any auxiliary scripts 52# (default: ${.CURDIR}/scripts) 53# FILESDIR - A directory containing any miscellaneous additional files. 54# (default: ${.CURDIR}/files) 55# PKGDIR - A direction containing any package creation files. 56# (default: ${.CURDIR}/pkg) 57# 58# NO_EXTRACT - Use a dummy (do-nothing) extract target. 59# NO_CONFIGURE - Use a dummy (do-nothing) configure target. 60# NO_BUILD - Use a dummy (do-nothing) build target. 61# NO_PACKAGE - Use a dummy (do-nothing) package target. 62# NO_INSTALL - Use a dummy (do-nothing) install target. 63# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. 64# NO_WRKDIR - There's no work directory at all; port does this someplace 65# else. 66# NO_DEPENDS - Don't verify build of dependencies. 67# USE_GMAKE - Says that the port uses gmake. 68# USE_IMAKE - Says that the port uses imake. 69# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man 70# target. 71# HAS_CONFIGURE - Says that the port has its own configure script. 72# GNU_CONFIGURE - Set if you are using GNU configure (optional). 73# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. 74# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set. 75# IS_INTERACTIVE - Set this if your port needs to interact with the user 76# during a build. User can then decide to skip this port by 77# setting ${BATCH}, or compiling only the interactive ports 78# by setting ${INTERACTIVE}. 79# EXEC_DEPENDS - A list of "prog:dir" pairs of other ports this 80# package depends on. "prog" is the name of an 81# executable. make will search your $PATH for it and go 82# into "dir" to do a "make all install" if it's not found. 83# LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package 84# depends on. "lib" is the name of a shared library. 85# make will use "ldconfig -r" to search for the 86# library. Note that lib can be any regular expression, 87# and you need two backslashes in front of dots (.) to 88# supress its special meaning (e.g., use 89# "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*"). 90# DEPENDS - A list of other ports this package depends on being 91# made first. Use this for things that don't fall into 92# the above two categories. 93# EXTRACT_CMD - Command for extracting archive (default: tar). 94# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz). 95# EXTRACT_ARGS - Arguments to ${EXTRACT_CMD} (default: -C ${WRKDIR} -xzf). 96# 97# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp). 98# NCFTPFLAGS - Arguments to ${NCFTP} (default: -N). 99# 100# 101# Default targets and their behaviors: 102# 103# fetch - Retrieves ${DISTFILES} into ${DISTDIR} as necessary. 104# extract - Unpacks ${DISTFILES} into ${WRKDIR}. 105# configure - Applies patches, if any, and runs either GNU configure, one 106# or more local configure scripts or nothing, depending on 107# what's available. 108# patch - Apply any provided patches to the source. 109# build - Actually compile the sources. 110# install - Install the results of a build. 111# reinstall - Install the results of a build, ignoring "already installed" 112# flag. 113# package - Create a package from an _installed_ port. 114# describe - Try to generate a one-line description for each port for 115# use in INDEX files and the like. 116# checksum - Use files/md5 to ensure that your distfiles are valid 117# makesum - Generate files/md5 (only do this for your own ports!) 118# 119# Default sequence for "all" is: fetch extract configure build 120 121.if exists(${.CURDIR}/../Makefile.inc) 122.include "${.CURDIR}/../Makefile.inc" 123.endif 124 125# These need to be absolute since we don't know how deep in the ports 126# tree we are and thus can't go relative. They can, of course, be overridden 127# by individual Makefiles. 128PORTSDIR?= ${DESTDIR}/usr/ports 129X11BASE?= /usr/X11R6 130DISTDIR?= ${PORTSDIR}/distfiles 131PACKAGES?= ${PORTSDIR}/packages 132.if !defined(NO_WRKDIR) 133WRKDIR?= ${.CURDIR}/work 134.else 135WRKDIR?= ${.CURDIR} 136.endif 137.if defined(NO_WRKSUBDIR) 138WRKSRC?= ${WRKDIR} 139.else 140WRKSRC?= ${WRKDIR}/${DISTNAME} 141.endif 142PATCHDIR?= ${.CURDIR}/patches 143SCRIPTDIR?= ${.CURDIR}/scripts 144FILESDIR?= ${.CURDIR}/files 145PKGDIR?= ${.CURDIR}/pkg 146.if defined(USE_IMAKE) 147PREFIX?= ${X11BASE} 148.else 149PREFIX?= /usr/local 150.endif 151.if defined(USE_GMAKE) 152EXEC_DEPENDS+= gmake:${PORTSDIR}/devel/gmake 153.endif 154 155.if exists(${PORTSDIR}/../Makefile.inc) 156.include "${PORTSDIR}/../Makefile.inc" 157.endif 158 159 160# Change these if you'd prefer to keep the cookies someplace else. 161EXTRACT_COOKIE?= ${WRKDIR}/.extract_done 162CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done 163INSTALL_COOKIE?= ${WRKDIR}/.install_done 164BUILD_COOKIE?= ${WRKDIR}/.build_done 165PATCH_COOKIE?= ${WRKDIR}/.patch_done 166 167# How to do nothing. Override if you, for some strange reason, would rather 168# do something. 169DO_NADA?= echo -n 170 171# Miscellaneous overridable commands: 172GMAKE?= gmake 173XMKMF?= xmkmf 174MD5?= /sbin/md5 175MD5_FILE?= ${FILESDIR}/md5 176MAKE_FLAGS?= -f 177MAKEFILE?= Makefile 178 179NCFTP?= ncftp 180NCFTPFLAGS?= -N 181 182TOUCH?= touch 183TOUCH_FLAGS?= -f 184 185PATCH?= patch 186PATCH_STRIP?= -p0 187.if defined(PATCH_DEBUG) 188PATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP} 189.else 190PATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP} 191.endif 192 193EXTRACT_CMD?= tar 194EXTRACT_SUFX?= .tar.gz 195EXTRACT_ARGS?= -xzf 196 197PKG_CMD?= pkg_create 198PKG_ARGS?= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} 199PKG_SUFX?= .tgz 200 201ALL_TARGET?= all 202INSTALL_TARGET?= install 203 204.if defined(MASTER_SITE_FREEBSD) 205MASTER_SITE_OVERRIDE= ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 206.endif 207 208# I guess we're in the master distribution business! :) As we gain mirror 209# sites for distfiles, add them to this list. 210.if !defined(MASTER_SITE_OVERRIDE) 211MASTER_SITES+= ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 212.else 213MASTER_SITES= ${MASTER_SITE_OVERRIDE} 214.endif 215 216# Derived names so that they're easily overridable. 217DISTFILES?= ${DISTNAME}${EXTRACT_SUFX} 218PKGNAME?= ${DISTNAME} 219MAINTAINER?= FreeBSD-Ports@FreeBSD.ORG 220 221.if exists(${PACKAGES}) 222PKGFILE?= ${PACKAGES}/${PKGNAME}${PKG_SUFX} 223.else 224PKGFILE?= ${PKGNAME}${PKG_SUFX} 225.endif 226 227CONFIGURE_SCRIPT?= configure 228 229.if defined(GNU_CONFIGURE) 230CONFIGURE_ARGS?= --prefix=${PREFIX} 231HAS_CONFIGURE= yes 232.endif 233 234.MAIN: all 235 236# If we're in BATCH mode and the port is interactive, or we're in 237# interactive mode and the port is non-interactive, skip all the important 238# targets. The reason we have two modes is that one might want to leave 239# a build in BATCH mode running overnight, then come back in the morning 240# and do _only_ the interactive ones that required your intervention. 241# This allows you to do both. 242# 243.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) 244all: 245 @${DO_NADA} 246pre-build: 247 @${DO_NADA} 248build: 249 @${DO_NADA} 250pre-install: 251 @${DO_NADA} 252install: 253 @${DO_NADA} 254pre-fetch: 255 @${DO_NADA} 256fetch: 257 @${DO_NADA} 258pre-configure: 259 @${DO_NADA} 260configure: 261 @${DO_NADA} 262.endif 263 264.if !target(all) 265all: extract configure build 266.endif 267 268.if !target(is_depended) 269is_depended: all install 270.endif 271 272# The following are used to create easy dummy targets for disabling some 273# bit of default target behavior you don't want. They still check to see 274# if the target exists, and if so don't do anything, since you might want 275# to set this globally for a group of ports in a Makefile.inc, but still 276# be able to override from an individual Makefile (since you can't _undefine_ 277# a variable in make!). 278.if defined(NO_EXTRACT) && !target(extract) 279extract: 280 @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 281checksum: 282 @${DO_NADA} 283makesum: 284 @${DO_NADA} 285.endif 286.if defined(NO_CONFIGURE) && !target(configure) 287configure: 288 @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 289.endif 290.if defined(NO_BUILD) && !target(build) 291build: 292 @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 293.endif 294.if defined(NO_PACKAGE) && !target(package) 295package: 296 @${DO_NADA} 297.endif 298.if defined(NO_INSTALL) && !target(install) 299install: 300 @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 301.endif 302.if defined(NO_PATCH) && !target(patch) 303patch: 304 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 305.endif 306 307# More standard targets start here. 308 309.if !target(describe) 310describe: 311.if defined(NO_PACKAGE) 312 @echo "${.CURDIR}/${DISTNAME}: ** Not packageable"; 313.else 314 @if [ -f ${PKGDIR}/COMMENT ]; then \ 315 echo "${.CURDIR}/${DISTNAME}: `cat ${PKGDIR}/COMMENT`"; \ 316 else \ 317 echo "${.CURDIR}/${DISTNAME}: ** No Description"; \ 318 fi 319.endif 320.endif 321 322.if !target(reinstall) 323reinstall: pre-reinstall install 324 325pre-reinstall: 326 @rm -f ${INSTALL_COOKIE} 327.endif 328 329.if !target(pre-install) 330pre-install: 331 @${DO_NADA} 332.endif 333 334.if !target(install) 335install: build ${INSTALL_COOKIE} 336 337${INSTALL_COOKIE}: 338 @echo "===> Installing for ${DISTNAME}" 339 @${MAKE} ${.MAKEFLAGS} pre-install 340.if defined(USE_GMAKE) 341 @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 342.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 343 @(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 344.endif 345.else defined(USE_GMAKE) 346 @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 347.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 348 @(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 349.endif 350.endif 351 @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 352.endif 353 354.if !target(pre-package) 355pre-package: 356 @${DO_NADA} 357.endif 358 359.if !target(package) 360package: pre-package 361# Makes some gross assumptions about a fairly simple package with no 362# install, require or deinstall scripts. Override the arguments with 363# PKG_ARGS if your package is anything but run-of-the-mill. 364 @if [ -d ${PKGDIR} ]; then \ 365 echo "===> Building package for ${DISTNAME}"; \ 366 ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \ 367 fi 368.endif 369 370.if !target(depends) 371depends: exec_depends lib_depends misc_depends 372 373exec_depends: 374.if defined(EXEC_DEPENDS) 375.if defined(NO_DEPENDS) 376# Just print out messages 377 @for i in ${EXEC_DEPENDS}; do \ 378 prog=`echo $$i | sed -e 's/:.*//'`; \ 379 dir=`echo $$i | sed -e 's/.*://'`; \ 380 echo "===> ${DISTNAME} depends on executable: $$prog ($$dir)"; \ 381 done 382.else 383 @for i in ${EXEC_DEPENDS}; do \ 384 prog=`echo $$i | sed -e 's/:.*//'`; \ 385 dir=`echo $$i | sed -e 's/.*://'`; \ 386 if which -s "$$prog"; then \ 387 echo "===> ${DISTNAME} depends on executable: $$prog - found"; \ 388 else \ 389 echo "===> ${DISTNAME} depends on executable: $$prog - not found"; \ 390 echo "===> Verifying build for $$prog in $$dir"; \ 391 if [ ! -d "$$dir" ]; then \ 392 echo ">> No directory for $$prog. Skipping.."; \ 393 else \ 394 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 395 echo "===> Returning to build of ${DISTNAME}"; \ 396 fi; \ 397 fi; \ 398 done 399.endif 400.else 401 @${DO_NADA} 402.endif 403 404lib_depends: 405.if defined(LIB_DEPENDS) 406.if defined(NO_DEPENDS) 407# Just print out messages 408 @for i in ${LIB_DEPENDS}; do \ 409 lib=`echo $$i | sed -e 's/:.*//'`; \ 410 dir=`echo $$i | sed -e 's/.*://'`; \ 411 echo "===> ${DISTNAME} depends on shared library: $$lib ($$dir)"; \ 412 done 413.else 414 @for i in ${LIB_DEPENDS}; do \ 415 lib=`echo $$i | sed -e 's/:.*//'`; \ 416 dir=`echo $$i | sed -e 's/.*://'`; \ 417 if ldconfig -r | grep -q -e "-l$$lib"; then \ 418 echo "===> ${DISTNAME} depends on shared library: $$lib - found"; \ 419 else \ 420 echo "===> ${DISTNAME} depends on shared library: $$lib - not found"; \ 421 echo "===> Verifying build for $$lib in $$dir"; \ 422 if [ ! -d "$$dir" ]; then \ 423 echo ">> No directory for $$lib. Skipping.."; \ 424 else \ 425 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 426 echo "===> Returning to build of ${DISTNAME}"; \ 427 fi; \ 428 fi; \ 429 done 430.endif 431.else 432 @${DO_NADA} 433.endif 434 435misc_depends: 436.if defined(DEPENDS) 437 @echo "===> ${DISTNAME} depends on: ${DEPENDS}" 438.if !defined(NO_DEPENDS) 439 @for i in ${DEPENDS}; do \ 440 echo "===> Verifying build for $$i"; \ 441 if [ ! -d $$i ]; then \ 442 echo ">> No directory for $$i. Skipping.."; \ 443 else \ 444 (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 445 fi \ 446 done 447 @echo "===> Returning to build of ${DISTNAME}" 448.endif 449.else 450 @${DO_NADA} 451.endif 452 453.endif 454 455.if !target(pre-build) 456pre-build: 457 @${DO_NADA} 458.endif 459 460.if !target(build) 461build: configure ${BUILD_COOKIE} 462 463${BUILD_COOKIE}: 464 @echo "===> Building for ${DISTNAME}" 465 @${MAKE} ${.MAKEFLAGS} pre-build 466.if defined(USE_GMAKE) 467 @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 468.else defined(USE_GMAKE) 469 @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 470.endif 471 @if [ -f ${SCRIPTDIR}/post-build ]; then \ 472 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 473 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 474 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 475 DEPENDS="${DEPENDS}" \ 476 sh ${SCRIPTDIR}/post-build; \ 477 fi 478 @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 479.endif 480 481.if !target(pre-patch) 482pre-patch: 483 @${DO_NADA} 484.endif 485 486.if !target(patch) 487patch: extract ${PATCH_COOKIE} 488 489${PATCH_COOKIE}: 490 @${MAKE} ${.MAKEFLAGS} pre-patch 491.if defined(PATCH_DEBUG) 492 @if [ -d ${PATCHDIR} ]; then \ 493 echo "===> Applying patches for ${DISTNAME}" ; \ 494 for i in ${PATCHDIR}/patch-*; do \ 495 echo "===> Applying patch $$i" ; \ 496 ${PATCH} ${PATCH_ARGS} < $$i; \ 497 done; \ 498 fi 499 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 500.else 501 @if [ -d ${PATCHDIR} ]; then \ 502 echo "===> Applying patches for ${DISTNAME}" ; \ 503 for i in ${PATCHDIR}/patch-*; \ 504 do ${PATCH} ${PATCH_ARGS} < $$i; \ 505 done;\ 506 fi 507 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 508.endif 509.endif 510 511.if !target(pre-configure) 512pre-configure: 513 @${DO_NADA} 514.endif 515 516.if !target(configure) 517configure: depends patch ${CONFIGURE_COOKIE} 518 519${CONFIGURE_COOKIE}: 520 @echo "===> Configuring for ${DISTNAME}" 521 @${MAKE} ${.MAKEFLAGS} pre-configure 522 @if [ -f ${SCRIPTDIR}/pre-configure ]; then \ 523 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 524 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 525 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 526 DEPENDS="${DEPENDS}" \ 527 sh ${SCRIPTDIR}/pre-configure; \ 528 fi 529 @if [ -f ${SCRIPTDIR}/configure ]; then \ 530 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 531 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 532 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 533 DEPENDS="${DEPENDS}" \ 534 sh ${SCRIPTDIR}/configure; \ 535 fi 536.if defined(HAS_CONFIGURE) 537 @(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \ 538 INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \ 539 INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \ 540 ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}) 541.endif 542.if defined(USE_IMAKE) 543.if defined(USE_GMAKE) 544 @(cd ${WRKSRC}; ${XMKMF} && ${GMAKE} Makefiles) 545.else 546 @(cd ${WRKSRC}; ${XMKMF} && ${MAKE} Makefiles) 547.endif 548.endif 549 @if [ -f ${SCRIPTDIR}/post-configure ]; then \ 550 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 551 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 552 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 553 DEPENDS="${DEPENDS}" \ 554 sh ${SCRIPTDIR}/post-configure; \ 555 fi 556 @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 557.endif 558 559.if !target(pre-fetch) 560pre-fetch: 561 @${DO_NADA} 562.endif 563 564.if !target(fetch) 565fetch: pre-fetch 566 @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi 567 @(cd ${DISTDIR}; \ 568 for file in ${DISTFILES}; do \ 569 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 570 echo ">> $$file doesn't seem to exist on this system."; \ 571 echo ">> Attempting to fetch it from a master site."; \ 572 for site in ${MASTER_SITES}; do \ 573 if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \ 574 break; \ 575 fi \ 576 done; \ 577 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 578 echo ">> Couldn't fetch it - please try to retreive this";\ 579 echo ">> port manually into ${DISTDIR} and try again."; \ 580 exit 1; \ 581 fi; \ 582 fi \ 583 done) 584.endif 585 586.if !target(makesum) 587makesum: fetch 588 @if [ ! -d ${FILESDIR} ]; then mkdir -p ${FILESDIR}; fi 589 @if [ -f ${MD5_FILE} ]; then rm -f ${MD5_FILE}; fi 590 @(cd ${DISTDIR}; \ 591 for file in ${DISTFILES}; do \ 592 ${MD5} $$file >> ${MD5_FILE}; \ 593 done) 594.endif 595 596.if !target(checksum) 597checksum: fetch 598 @if [ ! -f ${MD5_FILE} ]; then \ 599 echo ">> No MD5 checksum file."; \ 600 else \ 601 (cd ${DISTDIR}; OK=""; \ 602 for file in ${DISTFILES}; do \ 603 CKSUM=`${MD5} $$file | awk '{print $$4}'`; \ 604 CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \ 605 if [ "$$CKSUM2" = "" ]; then \ 606 echo ">> No checksum recorded for $$file"; \ 607 OK="false"; \ 608 elif [ "$$CKSUM" != "$$CKSUM2" ]; then \ 609 echo ">> Checksum mismatch for $$file"; \ 610 exit 1; \ 611 fi; \ 612 done; \ 613 if [ "$$OK" = "" ]; then \ 614 echo "Checksums OK."; \ 615 else \ 616 echo "Checksums OK for files that have them."; \ 617 fi) ; \ 618 fi 619.endif 620 621.if !target(pre-extract) 622pre-extract: 623 @${DO_NADA} 624.endif 625 626.if !target(extract) 627# We need to depend on .extract_done rather than the presence of ${WRKDIR} 628# because if the user interrupts the extract in the middle (and it's often 629# a long procedure), we get tricked into thinking that we've got a good dist 630# in ${WRKDIR}. 631extract: fetch ${EXTRACT_COOKIE} 632 633${EXTRACT_COOKIE}: 634 @${MAKE} ${.MAKEFLAGS} checksum pre-extract 635 @echo "===> Extracting for ${DISTNAME}" 636 @rm -rf ${WRKDIR} 637 @mkdir -p ${WRKDIR} 638.if defined(EXTRACT_ONLY) 639 @for file in ${EXTRACT_ONLY}; do \ 640 if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTDIR}/$$file);\ 641 then \ 642 exit 1; \ 643 fi \ 644 done 645.else 646 @for file in ${DISTFILES}; do \ 647 if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTDIR}/$$file);\ 648 then \ 649 exit 1; \ 650 fi \ 651 done 652.endif 653 @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 654.endif 655 656.if !target(pre-clean) 657pre-clean: 658 @${DO_NADA} 659.endif 660 661.if !target(clean) 662clean: pre-clean 663 @echo "===> Cleaning for ${DISTNAME}" 664 @rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \ 665 ${BUILD_COOKIE} ${PATCH_COOKIE} 666.if !defined(NO_WRKDIR) 667 @rm -rf ${WRKDIR} 668.endif 669.endif 670 671# No pre-targets for depend or tags. It would be silly. 672 673# Depend is generally meaningless for arbitrary ports, but if someone wants 674# one they can override this. This is just to catch people who've gotten into 675# the habit of typing `make depend all install' as a matter of course. 676# 677.if !target(depend) 678depend: 679.endif 680 681# Same goes for tags 682.if !target(tags) 683tags: 684.endif 685