bsd.port.mk revision 7987
11573Srgrimes#-*- mode: Fundamental; tab-width: 4; -*-
21573Srgrimes#
31573Srgrimes#	bsd.port.mk - 940820 Jordan K. Hubbard.
41573Srgrimes#	This file is in the public domain.
51573Srgrimes#
61573Srgrimes# $Id: bsd.port.mk,v 1.145 1995/04/22 00:01:26 jkh Exp $
71573Srgrimes#
81573Srgrimes# Please view me with 4 column tabs!
91573Srgrimes
101573Srgrimes
111573Srgrimes# Supported Variables and their behaviors:
121573Srgrimes#
131573Srgrimes# Variables that typically apply to all ports:
141573Srgrimes# 
151573Srgrimes# PORTSDIR		- The root of the ports tree (default: /usr/ports).
161573Srgrimes# DISTDIR 		- Where to get gzip'd, tarballed copies of original sources
171573Srgrimes#				  (default: ${PORTSDIR}/distfiles).
181573Srgrimes# PREFIX		- Where to install things in general (default: /usr/local).
191573Srgrimes# MASTER_SITES	- Primary location(s) for distribution files if not found
201573Srgrimes#				  locally (default:
211573Srgrimes#				   ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles)
221573Srgrimes# PATCH_SITES	- Primary location(s) for distributed patch files
231573Srgrimes#				  (see PATCHFILES below) if not found locally (default:
241573Srgrimes#				   ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles)
251573Srgrimes#
261573Srgrimes# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
271573Srgrimes#				  value.
281573Srgrimes# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for
291573Srgrimes#				  MASTER_SITES.
301573Srgrimes# PACKAGES		- A top level directory where all packages go (rather than
311573Srgrimes#				  going locally to each port). (default: ${PORTSDIR}/packages).
321573Srgrimes# GMAKE			- Set to path of GNU make if not in $PATH (default: gmake).
331573Srgrimes# XMKMF			- Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
341573Srgrimes# MAINTAINER	- The e-mail address of the contact person for this port
351573Srgrimes#				  (default: ports@FreeBSD.ORG).
361573Srgrimes# CATEGORIES	- A list of descriptive categories into which this port falls
371573Srgrimes#				  (default: orphans).
381573Srgrimes# KEYWORDS		- A list of descriptive keywords that might index well for this
3911677Sbde#				  port (default: orphans).
401573Srgrimes#
411573Srgrimes# Variables that typically apply to an individual port.  Non-Boolean
421573Srgrimes# variables without defaults are *mandatory*.
431573Srgrimes# 
441573Srgrimes#
451573Srgrimes# WRKDIR 		- A temporary working directory that gets *clobbered* on clean
461573Srgrimes#				  (default: ${.CURDIR}/work).
471573Srgrimes# WRKSRC		- A subdirectory of ${WRKDIR} where the distribution actually
481573Srgrimes#				  unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
491573Srgrimes#				  NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
501573Srgrimes# DISTNAME		- Name of port or distribution.
511573Srgrimes# DISTFILES		- Name(s) of archive file(s) containing distribution
521573Srgrimes#				  (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}).
531573Srgrimes# PATCHFILES	- Name(s) of additional files that contain distributed
541573Srgrimes#				  patches (default: none).  make will look for them at
551573Srgrimes#				  PATCH_SITES (see above).  They will automatically be
561573Srgrimes#				  uncompressed before patching if the names end with
571573Srgrimes#				  ".gz" or ".Z".
581573Srgrimes# PKGNAME		- Name of the package file to create if the DISTNAME 
591573Srgrimes#				  isn't really relevant for the port/package
601573Srgrimes#				  (default: ${DISTNAME}).
611573Srgrimes# EXTRACT_ONLY	- If defined, a subset of ${DISTFILES} you want to
621573Srgrimes#			  	  actually extract.
631573Srgrimes# PATCHDIR 		- A directory containing any additional patches you made
641573Srgrimes#				  to port this software to FreeBSD (default:
651573Srgrimes#				  ${.CURDIR}/patches)
661573Srgrimes# SCRIPTDIR 	- A directory containing any auxiliary scripts
671573Srgrimes#				  (default: ${.CURDIR}/scripts)
681573Srgrimes# FILESDIR 		- A directory containing any miscellaneous additional files.
691573Srgrimes#				  (default: ${.CURDIR}/files)
701573Srgrimes# PKGDIR 		- A direction containing any package creation files.
711573Srgrimes#				  (default: ${.CURDIR}/pkg)
721573Srgrimes# PKG_DBDIR		- Where package installation is recorded (default: /var/db/pkg)
731573Srgrimes#
741573Srgrimes# NO_EXTRACT	- Use a dummy (do-nothing) extract target.
751573Srgrimes# NO_CONFIGURE	- Use a dummy (do-nothing) configure target.
761573Srgrimes# NO_BUILD		- Use a dummy (do-nothing) build target.
771573Srgrimes# NO_PACKAGE	- Use a dummy (do-nothing) package target.
781573Srgrimes# NO_INSTALL	- Use a dummy (do-nothing) install target.
791573Srgrimes# NO_WRKSUBDIR	- Assume port unpacks directly into ${WRKDIR}.
801573Srgrimes# NO_WRKDIR		- There's no work directory at all; port does this someplace
811573Srgrimes#				  else.
821573Srgrimes# NO_DEPENDS	- Don't verify build of dependencies.
831573Srgrimes# USE_GMAKE		- Says that the port uses gmake.
841573Srgrimes# USE_IMAKE		- Says that the port uses imake.
851573Srgrimes# USE_X11		- Says that the port uses X11.
861573Srgrimes# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
871573Srgrimes#						target.
881573Srgrimes# HAS_CONFIGURE	- Says that the port has its own configure script.
891573Srgrimes# GNU_CONFIGURE	- Set if you are using GNU configure (optional).
901573Srgrimes# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
911573Srgrimes# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set.
921573Srgrimes# IS_INTERACTIVE - Set this if your port needs to interact with the user
931573Srgrimes#				  during a build.  User can then decide to skip this port by
941573Srgrimes#				  setting ${BATCH}, or compiling only the interactive ports
951573Srgrimes#				  by setting ${INTERACTIVE}.
961573Srgrimes# EXEC_DEPENDS	- A list of "prog:dir" pairs of other ports this
971573Srgrimes#				  package depends on.  "prog" is the name of an
9811677Sbde#				  executable.  make will search your $PATH for it and go
991573Srgrimes#				  into "dir" to do a "make all install" if it's not found.
1001573Srgrimes# LIB_DEPENDS	- A list of "lib:dir" pairs of other ports this package
1011573Srgrimes#				  depends on.  "lib" is the name of a shared library.
1021573Srgrimes#				  make will use "ldconfig -r" to search for the
1031573Srgrimes#				  library.  Note that lib can be any regular expression,
1041573Srgrimes#				  and you need two backslashes in front of dots (.) to
1051573Srgrimes#				  supress its special meaning (e.g., use
1061573Srgrimes#				  "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
1071573Srgrimes# DEPENDS		- A list of other ports this package depends on being
1081573Srgrimes#				  made first.  Use this for things that don't fall into
1091573Srgrimes#				  the above two categories.
1101573Srgrimes# EXTRACT_CMD	- Command for extracting archive (default: tar).
1111573Srgrimes# EXTRACT_SUFX	- Suffix for archive names (default: .tar.gz).
1121573Srgrimes# EXTRACT_BEFORE_ARGS -
1131573Srgrimes#				  Arguments to ${EXTRACT_CMD} before filename
1141573Srgrimes#				  (default: -C ${WRKDIR} -xzf).
1151573Srgrimes# EXTRACT_AFTER_ARGS -
1161573Srgrimes#				  Arguments to ${EXTRACT_CMD} following filename
1171573Srgrimes#				  (default: none).
1181573Srgrimes#
1191573Srgrimes# NCFTP			- Full path to ncftp command if not in $PATH (default: ncftp).
1201573Srgrimes# NCFTPFLAGS    - Arguments to ${NCFTP} (default: -N).
1211573Srgrimes#
1221573Srgrimes#
1231573Srgrimes# Default targets and their behaviors:
1241573Srgrimes#
1251573Srgrimes# fetch			- Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
1261573Srgrimes#				  into ${DISTDIR} as necessary.
1271573Srgrimes# fetch-list	- Show list of files that would be retrieved by fetch
1281573Srgrimes# extract		- Unpacks ${DISTFILES} into ${WRKDIR}.
1291573Srgrimes# patch			- Apply any provided patches to the source.
1301573Srgrimes# configure		- Runs either GNU configure, one or more local configure
1311573Srgrimes#				  scripts or nothing, depending on what's available.
1321573Srgrimes# build			- Actually compile the sources.
1331573Srgrimes# install		- Install the results of a build.
1341573Srgrimes# reinstall		- Install the results of a build, ignoring "already installed"
1351573Srgrimes#				  flag.
1361573Srgrimes# package		- Create a package from an _installed_ port.
1371573Srgrimes# describe		- Try to generate a one-line description for each port for
1381573Srgrimes#				  use in INDEX files and the like.
1391573Srgrimes# checksum		- Use files/md5 to ensure that your distfiles are valid
1401573Srgrimes# makesum		- Generate files/md5 (only do this for your own ports!)
1411573Srgrimes#
1421573Srgrimes# Default sequence for "all" is:  fetch checksum extract patch configure build
1431573Srgrimes#
1441573Srgrimes# Please read the comments in the targets section below, you
1451573Srgrimes# should be able to use the pre-* or post-* targets/scripts
1461573Srgrimes# (which are available for every stage except checksum) or
1471573Srgrimes# override the do-* targets to do pretty much anything you want.
1481573Srgrimes#
1491573Srgrimes# NEVER override the "regular" targets unless you want to open
1501573Srgrimes# a major can of worms.
1511573Srgrimes
1521573Srgrimes.if exists(${.CURDIR}/../Makefile.inc)
1531573Srgrimes.include "${.CURDIR}/../Makefile.inc"
1541573Srgrimes.endif
1551573Srgrimes
1561573Srgrimes# These need to be absolute since we don't know how deep in the ports
1571573Srgrimes# tree we are and thus can't go relative.  They can, of course, be overridden
1581573Srgrimes# by individual Makefiles.
1591573SrgrimesPORTSDIR?=		${DESTDIR}/usr/ports
1601573SrgrimesX11BASE?=		/usr/X11R6
1611573SrgrimesDISTDIR?=		${PORTSDIR}/distfiles
1621573SrgrimesPACKAGES?=		${PORTSDIR}/packages
1637471Sache.if !defined(NO_WRKDIR)
1647471SacheWRKDIR?=		${.CURDIR}/work
1651573Srgrimes.else
1663799SacheWRKDIR?=		${.CURDIR}
16714858Sache.endif
16814858Sache.if defined(NO_WRKSUBDIR)
1693760SacheWRKSRC?=		${WRKDIR}
1703760Sache.else
1711573SrgrimesWRKSRC?=		${WRKDIR}/${DISTNAME}
1721573Srgrimes.endif
17311677SbdePATCHDIR?=		${.CURDIR}/patches
1741573SrgrimesSCRIPTDIR?=		${.CURDIR}/scripts
1751573SrgrimesFILESDIR?=		${.CURDIR}/files
1761573SrgrimesPKGDIR?=		${.CURDIR}/pkg
1771573Srgrimes.if defined(USE_IMAKE) || defined(USE_X11)
1781573SrgrimesPREFIX?=		${X11BASE}
1791573Srgrimes.else
1801573SrgrimesPREFIX?=		/usr/local
1811573Srgrimes.endif
1821573Srgrimes.if defined(USE_GMAKE)
1831573SrgrimesEXEC_DEPENDS+=               gmake:${PORTSDIR}/devel/gmake
1841573Srgrimes.endif
1851573Srgrimes
1861573Srgrimes.if exists(${PORTSDIR}/../Makefile.inc)
1871573Srgrimes.include "${PORTSDIR}/../Makefile.inc"
1881573Srgrimes.endif
18911677Sbde
1901573Srgrimes# Change these if you'd prefer to keep the cookies someplace else.
1911573SrgrimesEXTRACT_COOKIE?=	${WRKDIR}/.extract_done
1921573SrgrimesCONFIGURE_COOKIE?=	${WRKDIR}/.configure_done
1931573SrgrimesINSTALL_COOKIE?=	${WRKDIR}/.install_done
1941573SrgrimesBUILD_COOKIE?=		${WRKDIR}/.build_done
1951573SrgrimesPATCH_COOKIE?=		${WRKDIR}/.patch_done
1961573Srgrimes
19711677Sbde# How to do nothing.  Override if you, for some strange reason, would rather
1981573Srgrimes# do something.
1991573SrgrimesDO_NADA?=		echo -n
2001573Srgrimes
2011573Srgrimes# Miscellaneous overridable commands:
2021573SrgrimesGMAKE?=			gmake
2031573SrgrimesXMKMF?=			xmkmf -a
2041573SrgrimesMD5?=			/sbin/md5
2051573SrgrimesMD5_FILE?=		${FILESDIR}/md5
2061573SrgrimesMAKE_FLAGS?=	-f
2071573SrgrimesMAKEFILE?=		Makefile
2081573Srgrimes
2091573SrgrimesNCFTP?=			ncftp
2101573SrgrimesNCFTPFLAGS?=	-N
2111573Srgrimes
2121573SrgrimesTOUCH?=			touch
2131573SrgrimesTOUCH_FLAGS?=	-f
2141573Srgrimes
2151573SrgrimesPATCH?=			patch
2161573SrgrimesPATCH_STRIP?=	-p0
2171573SrgrimesPATCH_DIST_STRIP?=	-p0
2181573Srgrimes.if defined(PATCH_DEBUG)
2191573SrgrimesPATCH_ARGS?=	-d ${WRKSRC} -E ${PATCH_STRIP}
22011677SbdePATCH_DIST_ARGS?=	-d ${WRKSRC} -E ${PATCH_DIST_STRIP}
2211573Srgrimes.else
2221573SrgrimesPATCH_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
2231573SrgrimesPATCH_DIST_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
2241573Srgrimes.endif
2251573Srgrimes
2261573SrgrimesEXTRACT_CMD?=	tar
2271573SrgrimesEXTRACT_SUFX?=	.tar.gz
2281573Srgrimes# Backwards compatability.
2291573Srgrimes.if defined(EXTRACT_ARGS)
2301573SrgrimesEXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
2311573Srgrimes.else
2321573SrgrimesEXTRACT_BEFORE_ARGS?=   -xzf
2331573Srgrimes.endif
2341573Srgrimes
2351573Srgrimes# Figure out where the local mtree file is
2361573Srgrimes.if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist)
2371573SrgrimesMTREE_LOCAL=	/etc/mtree/BSD.local.dist
2381573Srgrimes.endif
2391573Srgrimes
2401573SrgrimesPKG_CMD?=		pkg_create
2411573Srgrimes.if !defined(PKG_ARGS)
2421573SrgrimesPKG_ARGS=		-v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort|uniq`"
2431573Srgrimes.if exists(${PKGDIR}/INSTALL)
2441573SrgrimesPKG_ARGS+=		-i ${PKGDIR}/INSTALL
2451573Srgrimes.endif
246.if exists(${PKGDIR}/DEINSTALL)
247PKG_ARGS+=		-k ${PKGDIR}/DEINSTALL
248.endif
249.if exists(${PKGDIR}/REQ)
250PKG_ARGS+=		-r ${PKGDIR}/REQ
251.endif
252.if !defined(USE_X11) && !defined(USE_IMAKE) && defined(MTREE_LOCAL)
253PKG_ARGS+=		-m ${MTREE_LOCAL}
254.endif
255.endif
256PKG_SUFX?=		.tgz
257# where pkg_add records its dirty deeds.
258PKG_DBDIR?=		/var/db/pkg
259
260# Used to print all the '===>' style prompts - override this to turn them off.
261ECHO_MSG?=		echo
262
263ALL_TARGET?=		all
264INSTALL_TARGET?=	install
265
266# If the user has this set, go to the FreeBSD respository for everything.
267.if defined(MASTER_SITE_FREEBSD)
268MASTER_SITE_OVERRIDE=  ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 
269.endif
270
271# I guess we're in the master distribution business! :)  As we gain mirror
272# sites for distfiles, add them to this list.
273.if !defined(MASTER_SITE_OVERRIDE)
274MASTER_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/
275PATCH_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/
276.else
277MASTER_SITES=	${MASTER_SITE_OVERRIDE}
278PATCH_SITES=	${MASTER_SITE_OVERRIDE}
279.endif
280
281# Derived names so that they're easily overridable.
282DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
283PKGNAME?=		${DISTNAME}
284
285# Documentation
286MAINTAINER?=	ports@FreeBSD.ORG
287CATEGORIES?=	orphans
288CATEGORIES+=	all
289KEYWORDS+=		${CATEGORIES}
290
291PKGREPOSITORYSUBDIR?=	.packages
292PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
293.if exists(${PACKAGES})
294PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
295.else
296PKGFILE?=		${PKGNAME}${PKG_SUFX}
297.endif
298
299CONFIGURE_SCRIPT?=	configure
300
301.if defined(GNU_CONFIGURE)
302CONFIGURE_ARGS?=	--prefix=${PREFIX}
303HAS_CONFIGURE=		yes
304.endif
305
306.MAIN: all
307
308################################################################
309# If we're in BATCH mode and the port is interactive, or we're
310# in interactive mode and the port is non-interactive, skip all
311# the important targets.  The reason we have two modes is that
312# one might want to leave a build in BATCH mode running
313# overnight, then come back in the morning and do _only_ the
314# interactive ones that required your intervention.
315#
316# This allows you to do both.
317################################################################
318
319.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
320all:
321	@${DO_NADA}
322build:
323	@${DO_NADA}
324install:
325	@${DO_NADA}
326fetch:
327	@${DO_NADA}
328configure:
329	@${DO_NADA}
330package:
331	@${DO_NADA}
332.endif
333
334.if !target(all)
335all: build
336.endif
337
338.if !target(is_depended)
339is_depended:	install
340.endif
341
342################################################################
343# The following are used to create easy dummy targets for
344# disabling some bit of default target behavior you don't want.
345# They still check to see if the target exists, and if so don't
346# do anything, since you might want to set this globally for a
347# group of ports in a Makefile.inc, but still be able to
348# override from an individual Makefile (since you can't _
349# undefine_ a variable in make!).
350################################################################
351
352.if defined(NO_EXTRACT) && !target(extract)
353extract:
354	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
355checksum:
356	@${DO_NADA}
357makesum:
358	@${DO_NADA}
359.endif
360.if defined(NO_CONFIGURE) && !target(configure)
361configure:
362	@${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
363.endif
364.if defined(NO_BUILD) && !target(build)
365build:
366	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
367.endif
368.if defined(NO_PACKAGE) && !target(package)
369package:
370	@${DO_NADA}
371.endif
372.if defined(NO_PACKAGE) && !target(repackage)
373repackage:
374	@${DO_NADA}
375.endif
376.if defined(NO_INSTALL) && !target(install)
377install:
378	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
379.endif
380.if defined(NO_PATCH) && !target(patch)
381patch:
382	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
383.endif
384
385################################################################
386# More standard targets start here.
387#
388# These are the body of the build/install framework.  If you are
389# not happy with the default actions, and you can't solve it by
390# adding pre-* or post-* targets/scripts, override these.
391################################################################
392
393# Fetch
394
395.if !target(do-fetch)
396do-fetch:
397	@if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi
398	@(cd ${DISTDIR}; \
399	 for file in ${DISTFILES}; do \
400		if [ ! -f $$file -a ! -f `basename $$file` ]; then \
401			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
402			for site in ${MASTER_SITES}; do \
403			    ${ECHO_MSG} ">> Attempting to fetch from $${site}"; \
404				if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \
405					break; \
406				fi \
407			done; \
408			if [ ! -f $$file -a ! -f `basename $$file` ]; then \
409				${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\
410				${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \
411				exit 1; \
412			fi; \
413	    fi \
414	 done)
415.if defined(PATCHFILES)
416	@(cd ${DISTDIR}; \
417	 for file in ${PATCHFILES}; do \
418		if [ ! -f $$file -a ! -f `basename $$file` ]; then \
419			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
420			for site in ${PATCH_SITES}; do \
421			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
422				if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \
423					break; \
424				fi \
425			done; \
426			if [ ! -f $$file -a ! -f `basename $$file` ]; then \
427				${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\
428				${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \
429				exit 1; \
430			fi; \
431	    fi \
432	 done)
433.endif
434.endif
435
436# Extract
437
438.if !target(do-extract)
439do-extract:
440	@rm -rf ${WRKDIR}
441	@mkdir -p ${WRKDIR}
442.if defined(EXTRACT_ONLY)
443	@for file in ${EXTRACT_ONLY}; do \
444		if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
445		then \
446			exit 1; \
447		fi \
448	done
449.else
450	@for file in ${DISTFILES}; do \
451		if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
452		then \
453			exit 1; \
454		fi \
455	done
456.endif
457.endif
458
459# Patch
460
461.if !target(do-patch)
462do-patch:
463.if defined(PATCHFILES)
464	@${ECHO_MSG} "===>  Applying distributed patches for ${PKGNAME}"
465.if defined(PATCH_DEBUG)
466	@(cd ${DISTDIR}; \
467	  for i in ${PATCHFILES}; do \
468		${ECHO_MSG} "===>   Applying distributed patch $$i" ; \
469		case $$i in \
470			*.Z|*.gz) \
471				zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
472				;; \
473			*) \
474				${PATCH} ${PATCH_DIST_ARGS} < $$i; \
475				;; \
476		esac; \
477	  done)
478.else
479	@(cd ${DISTDIR}; \
480	  for i in ${PATCHFILES}; do \
481		case $$i in \
482			*.Z|*.gz) \
483				zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
484				;; \
485			*) \
486				${PATCH} ${PATCH_DIST_ARGS} < $$i; \
487				;; \
488		esac; \
489	  done)
490.endif
491.endif
492.if defined(PATCH_DEBUG)
493	@if [ -d ${PATCHDIR} ]; then \
494		${ECHO_MSG} "===>  Applying FreeBSD patches for ${PKGNAME}" ; \
495		for i in ${PATCHDIR}/patch-*; do \
496			${ECHO_MSG} "===>   Applying FreeBSD patch $$i" ; \
497			${PATCH} ${PATCH_ARGS} < $$i; \
498		done; \
499	fi
500	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
501.else
502	@if [ -d ${PATCHDIR} ]; then \
503		${ECHO_MSG} "===>  Applying FreeBSD patches for ${PKGNAME}" ; \
504		for i in ${PATCHDIR}/patch-*; \
505			do ${PATCH} ${PATCH_ARGS} < $$i; \
506		done;\
507	fi
508	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
509.endif
510.endif
511
512# Configure
513
514.if !target(do-configure)
515do-configure:
516	@if [ -f ${SCRIPTDIR}/configure ]; then \
517		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
518		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
519		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
520		  DEPENDS="${DEPENDS}" \
521		sh ${SCRIPTDIR}/configure; \
522	fi
523.if defined(HAS_CONFIGURE)
524	@(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
525	    INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
526	    INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \
527	    ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
528.endif
529.if defined(USE_IMAKE)
530.if defined(USE_GMAKE)
531	@(cd ${WRKSRC}; ${XMKMF} && ${GMAKE} Makefiles)
532.else
533	@(cd ${WRKSRC}; ${XMKMF} && ${MAKE} Makefiles)
534.endif
535.endif
536.endif
537
538# Build
539
540.if !target(do-build)
541do-build:
542.if defined(USE_GMAKE)
543	@(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
544.else defined(USE_GMAKE)
545	@(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
546.endif
547.endif
548
549# Install
550
551.if !target(do-install)
552do-install:
553.if defined(USE_GMAKE)
554	@(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
555.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
556	@(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
557.endif
558.else defined(USE_GMAKE)
559	@(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
560.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
561	@(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
562.endif
563.endif
564	@${MAKE} ${.MAKEFLAGS} fake-pkg
565.endif
566
567################################################################
568# Skeleton targets start here
569# 
570# You shouldn't have to change these.  Either add the pre-* or
571# post-* targets/scripts or redefine the do-* targets.  These
572# targets don't do anything other than checking for cookies and
573# call the necessary targets/scripts.
574################################################################
575
576# Fetch
577
578.if !target(fetch)
579fetch: depends
580.if target(pre-fetch)
581	@${MAKE} ${.MAKEFLAGS} pre-fetch
582.endif
583	@if [ -f ${SCRIPTDIR}/pre-fetch ]; then \
584		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
585		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
586		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
587		  DEPENDS="${DEPENDS}" \
588			sh ${SCRIPTDIR}/pre-fetch; \
589	fi
590	@${MAKE} ${.MAKEFLAGS} do-fetch
591.if target(post-fetch)
592	@${MAKE} ${.MAKEFLAGS} post-fetch
593.endif
594	@if [ -f ${SCRIPTDIR}/post-fetch ]; then \
595		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
596		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
597		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
598		  DEPENDS="${DEPENDS}" \
599			sh ${SCRIPTDIR}/post-fetch; \
600	fi
601.endif
602
603# Extract
604
605.if !target(extract)
606extract: checksum ${EXTRACT_COOKIE}
607
608${EXTRACT_COOKIE}:
609	@${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
610.if target(pre-extract)
611	@${MAKE} ${.MAKEFLAGS} pre-extract
612.endif
613	@if [ -f ${SCRIPTDIR}/pre-extract ]; then \
614		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
615		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
616		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
617		  DEPENDS="${DEPENDS}" \
618			sh ${SCRIPTDIR}/pre-extract; \
619	fi
620	@${MAKE} ${.MAKEFLAGS} do-extract
621.if target(post-extract)
622	@${MAKE} ${.MAKEFLAGS} post-extract
623.endif
624	@if [ -f ${SCRIPTDIR}/post-extract ]; then \
625		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
626		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
627		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
628		  DEPENDS="${DEPENDS}" \
629			sh ${SCRIPTDIR}/post-extract; \
630	fi
631	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
632.endif
633
634# Patch
635
636.if !target(patch)
637patch: extract ${PATCH_COOKIE}
638
639${PATCH_COOKIE}:
640	@${ECHO_MSG} "===>  Patching for ${PKGNAME}"
641.if target(pre-patch)
642	@${MAKE} ${.MAKEFLAGS} pre-patch
643.endif
644	@if [ -f ${SCRIPTDIR}/pre-patch ]; then \
645		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
646		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
647		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
648		  DEPENDS="${DEPENDS}" \
649			sh ${SCRIPTDIR}/pre-patch; \
650	fi
651	@${MAKE} ${.MAKEFLAGS} do-patch
652.if target(post-patch)
653	@${MAKE} ${.MAKEFLAGS} post-patch
654.endif
655	@if [ -f ${SCRIPTDIR}/post-patch ]; then \
656		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
657		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
658		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
659		  DEPENDS="${DEPENDS}" \
660			sh ${SCRIPTDIR}/post-patch; \
661	fi
662	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
663.endif
664
665# Configure
666
667.if !target(configure)
668configure: patch ${CONFIGURE_COOKIE}
669
670${CONFIGURE_COOKIE}:
671	@${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
672.if target(pre-configure)
673	@${MAKE} ${.MAKEFLAGS} pre-configure
674.endif
675	@if [ -f ${SCRIPTDIR}/pre-configure ]; then \
676		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
677		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
678		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
679		  DEPENDS="${DEPENDS}" \
680			sh ${SCRIPTDIR}/pre-configure; \
681	fi
682	@${MAKE} ${.MAKEFLAGS} do-configure
683.if target(post-configure)
684	@${MAKE} ${.MAKEFLAGS} post-configure
685.endif
686	@if [ -f ${SCRIPTDIR}/post-configure ]; then \
687		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
688		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
689		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
690		  DEPENDS="${DEPENDS}" \
691			sh ${SCRIPTDIR}/post-configure; \
692	fi
693	@${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
694.endif
695
696# Build
697
698.if !target(build)
699build: configure ${BUILD_COOKIE}
700
701${BUILD_COOKIE}:
702	@${ECHO_MSG} "===>  Building for ${PKGNAME}"
703.if target(pre-build)
704	@${MAKE} ${.MAKEFLAGS} pre-build
705.endif
706	@if [ -f ${SCRIPTDIR}/pre-build ]; then \
707		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
708		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
709		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
710		  DEPENDS="${DEPENDS}" \
711			sh ${SCRIPTDIR}/pre-build; \
712	fi
713	@${MAKE} ${.MAKEFLAGS} do-build
714.if target(post-build)
715	@${MAKE} ${.MAKEFLAGS} post-build
716.endif
717	@if [ -f ${SCRIPTDIR}/post-build ]; then \
718		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
719		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
720		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
721		  DEPENDS="${DEPENDS}" \
722			sh ${SCRIPTDIR}/post-build; \
723	fi
724	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
725.endif
726
727# Install
728
729.if !target(install)
730install: build ${INSTALL_COOKIE}
731
732${INSTALL_COOKIE}:
733	@${ECHO_MSG} "===>  Installing for ${PKGNAME}"
734.if target(pre-install)
735	@${MAKE} ${.MAKEFLAGS} pre-install
736.endif
737	@if [ -f ${SCRIPTDIR}/pre-install ]; then \
738		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
739		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
740		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
741		  DEPENDS="${DEPENDS}" \
742			sh ${SCRIPTDIR}/pre-install; \
743	fi
744	@${MAKE} ${.MAKEFLAGS} do-install
745.if target(post-install)
746	@${MAKE} ${.MAKEFLAGS} post-install
747.endif
748	@if [ -f ${SCRIPTDIR}/post-install ]; then \
749		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
750		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
751		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
752		  DEPENDS="${DEPENDS}" \
753			sh ${SCRIPTDIR}/post-install; \
754	fi
755	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
756.endif
757
758# Reinstall
759#
760# This is a special target to re-run install
761
762.if !target(reinstall)
763reinstall: pre-reinstall install
764
765pre-reinstall:
766	@rm -f ${INSTALL_COOKIE}
767.endif
768
769################################################################
770# Some more targets supplied for users' convenience
771################################################################
772
773# Cleaning up
774
775.if !target(pre-clean)
776pre-clean:
777	@${DO_NADA}
778.endif
779
780.if !target(clean)
781clean: pre-clean
782	@${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
783	@rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \
784		${BUILD_COOKIE} ${PATCH_COOKIE}
785.if !defined(NO_WRKDIR)
786	@rm -rf ${WRKDIR}
787.endif
788.endif
789
790# Prints out a list of files to fetch (useful to do a batch fetch)
791
792.if !target(fetch-list)
793fetch-list:
794	@if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi
795	@(cd ${DISTDIR}; \
796	 for file in ${DISTFILES}; do \
797		if [ ! -f $$file -a ! -f `basename $$file` ]; then \
798			for site in ${MASTER_SITES}; do \
799				echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \
800					break; \
801			done; \
802			echo "echo $${file} not fetched" ; \
803		fi \
804	done)
805.if defined(PATCHFILES)
806	@(cd ${DISTDIR}; \
807	 for file in ${PATCHFILES}; do \
808		if [ ! -f $$file -a ! -f `basename $$file` ]; then \
809			for site in ${PATCH_SITES}; do \
810				echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \
811					break; \
812			done; \
813			echo "echo $${file} not fetched" ; \
814		fi \
815	done)
816.endif
817.endif
818
819# Checksumming utilities
820
821.if !target(makesum)
822makesum: fetch
823	@if [ ! -d ${FILESDIR} ]; then mkdir -p ${FILESDIR}; fi
824	@if [ -f ${MD5_FILE} ]; then rm -f ${MD5_FILE}; fi
825	@(cd ${DISTDIR}; \
826	for file in ${DISTFILES} ${PATCHFILES}; do \
827		${MD5} $$file >> ${MD5_FILE}; \
828	done)
829.endif
830
831.if !target(checksum)
832checksum: fetch
833	@if [ ! -f ${MD5_FILE} ]; then \
834		${ECHO_MSG} ">> No MD5 checksum file."; \
835	else \
836		(cd ${DISTDIR}; OK=""; \
837		for file in ${DISTFILES} ${PATCHFILES}; do \
838			CKSUM=`${MD5} $$file | awk '{print $$4}'`; \
839			CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \
840			if [ "$$CKSUM2" = "" ]; then \
841				${ECHO_MSG} ">> No checksum recorded for $$file"; \
842				OK="false"; \
843			elif [ "$$CKSUM" != "$$CKSUM2" ]; then \
844				${ECHO_MSG} ">> Checksum mismatch for $$file"; \
845				exit 1; \
846			fi; \
847			done; \
848			if [ "$$OK" = "" ]; then \
849				${ECHO_MSG} "Checksums OK."; \
850			else \
851				${ECHO_MSG} "Checksums OK for files that have them."; \
852   	     fi) ; \
853	fi
854.endif
855
856################################################################
857# The package-building targets
858# You probably won't need to touch these
859################################################################
860
861# Nobody should want to override this unless PKGNAME is simply bogus.
862.if !target(package-name)
863package-name:
864.if !defined(NO_PACKAGE)
865	@echo ${PKGNAME}
866.endif
867.endif
868
869# Show (recursively) all the packages this package depends on.
870.if !target(package-depends)
871package-depends:
872	@for i in ${EXEC_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
873		dir=`echo $$i | sed -e 's/.*://'`; \
874		(cd $$dir ; ${MAKE} package-name package-depends); \
875	done
876.endif
877
878# Build a package
879
880.if !target(package)
881package: install
882.if target(pre-package)
883	@${MAKE} ${.MAKEFLAGS} pre-package
884.endif
885	@${MAKE} ${.MAKEFLAGS} do-package
886.endif
887
888# Build a package but don't check the cookie for installation
889
890.if !target(repackage)
891repackage:
892.if target(pre-package)
893	@${MAKE} ${.MAKEFLAGS} pre-package
894.endif
895	@${MAKE} ${.MAKEFLAGS} do-package
896.endif
897
898# The body of the package-building target
899
900.if !target(do-package)
901do-package:
902	@if [ -e ${PKGDIR}/PLIST ]; then \
903		${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
904		if [ -d ${PACKAGES} ]; then \
905			if [ ! -d ${PKGREPOSITORY} ]; then \
906				if ! mkdir -p ${PKGREPOSITORY}; then \
907					${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
908					exit 1; \
909				fi; \
910			fi; \
911		fi; \
912		${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \
913		if [ -d ${PACKAGES} ]; then \
914			rm -f ${PACKAGES}/*/${PKGNAME}${PKG_SUFX}; \
915			for cat in ${CATEGORIES}; do \
916				if [ ! -d ${PACKAGES}/$$cat ]; then \
917					if ! mkdir -p ${PACKAGES}/$$cat; then \
918						${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
919						exit 1; \
920					fi; \
921				fi; \
922				ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
923			done; \
924		fi; \
925	fi
926.endif
927
928################################################################
929# Dependency checking
930################################################################
931
932.if !target(depends)
933depends: exec_depends lib_depends misc_depends
934
935exec_depends:
936.if defined(EXEC_DEPENDS)
937.if defined(NO_DEPENDS)
938# Just print out messages
939	@for i in ${EXEC_DEPENDS}; do \
940		prog=`echo $$i | sed -e 's/:.*//'`; \
941		dir=`echo $$i | sed -e 's/.*://'`; \
942		${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
943	done
944.else
945	@for i in ${EXEC_DEPENDS}; do \
946		prog=`echo $$i | sed -e 's/:.*//'`; \
947		dir=`echo $$i | sed -e 's/.*://'`; \
948		if which -s "$$prog"; then \
949			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
950		else \
951			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
952			${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \
953			if [ ! -d "$$dir" ]; then \
954				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
955			else \
956				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
957				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
958			fi; \
959		fi; \
960	done
961.endif
962.else
963	@${DO_NADA}
964.endif
965
966lib_depends:
967.if defined(LIB_DEPENDS)
968.if defined(NO_DEPENDS)
969# Just print out messages
970	@for i in ${LIB_DEPENDS}; do \
971		lib=`echo $$i | sed -e 's/:.*//'`; \
972		dir=`echo $$i | sed -e 's/.*://'`; \
973		${ECHO_MSG} "===>  ${PKGNAME} depends on shared library:  $$lib ($$dir)"; \
974	done
975.else
976	@for i in ${LIB_DEPENDS}; do \
977		lib=`echo $$i | sed -e 's/:.*//'`; \
978		dir=`echo $$i | sed -e 's/.*://'`; \
979		if ldconfig -r | grep -q -e "-l$$lib"; then \
980			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \
981		else \
982			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \
983			${ECHO_MSG} "===>  Verifying build for $$lib in $$dir"; \
984			if [ ! -d "$$dir" ]; then \
985				${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
986			else \
987				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
988				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
989			fi; \
990		fi; \
991	done
992.endif
993.else
994	@${DO_NADA}
995.endif
996
997misc_depends:
998.if defined(DEPENDS)
999	@${ECHO_MSG} "===>  ${PKGNAME} depends on:  ${DEPENDS}"
1000.if !defined(NO_DEPENDS)
1001	@for i in ${DEPENDS}; do \
1002		${ECHO_MSG} "===>  Verifying build for $$i"; \
1003		if [ ! -d $$i ]; then \
1004			${ECHO_MSG} ">> No directory for $$i.  Skipping.."; \
1005		else \
1006			(cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1007		fi \
1008	done
1009	@${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
1010.endif
1011.else
1012	@${DO_NADA}
1013.endif
1014
1015.endif
1016
1017################################################################
1018# Everything after here are internal targets and really
1019# shouldn't be touched by anybody but the release engineers.
1020################################################################
1021
1022# This target generates an index entry suitable for aggregation into
1023# a large index.  Format is:
1024#
1025# distribution-name|port-path|installation-prefix|comment| \
1026#  description-file|maintainer|categories|keywords
1027#
1028.if !target(describe)
1029describe:
1030	@echo -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|"
1031	@echo -n "${PREFIX}|"
1032	@if [ -f ${PKGDIR}/COMMENT ]; then \
1033		echo -n "`cat ${PKGDIR}/COMMENT`"; \
1034	else \
1035		echo -n "** No Description"; \
1036	fi
1037	@if [ -f ${PKGDIR}/DESCR ]; then \
1038		echo -n "|${PKGDIR}/DESCR"; \
1039	else \
1040		echo -n "|/dev/null"; \
1041	fi
1042	@echo -n "|${MAINTAINER}|${CATEGORIES}|${KEYWORDS}"
1043	@echo ""
1044.endif
1045
1046# Fake installation of package so that user can pkg_delete it later.
1047# Also, make sure that an installed port is recognized correctly in
1048# accordance to the @pkgdep directive in the packing lists
1049
1050.if !target(fake-pkg)
1051.if !defined(NO_PACKAGE)
1052fake-pkg:
1053	@if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then echo "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
1054	@if [ ! -d ${PKG_DBDIR} ]; then rm -f ${PKG_DBDIR}; mkdir -p ${PKG_DBDIR}; fi
1055	@if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1056		${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \
1057		mkdir -p ${PKG_DBDIR}/${PKGNAME}; \
1058		${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1059		cp ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \
1060		cp ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1061	else \
1062		${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \
1063		${ECHO_MSG} "     If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
1064		${ECHO_MSG} "     this port again to upgrade it properly."; \
1065	fi
1066.endif
1067.endif
1068
1069# Depend is generally meaningless for arbitrary ports, but if someone wants
1070# one they can override this.  This is just to catch people who've gotten into
1071# the habit of typing `make depend all install' as a matter of course.
1072#
1073.if !target(depend)
1074depend:
1075.endif
1076
1077# Same goes for tags
1078.if !target(tags)
1079tags:
1080.endif
1081