bsd.port.mk revision 9564
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.172 1995/07/15 14:07:02 jkh 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/distfiles)
22# PATCH_SITES	- Primary location(s) for distributed patch files
23#				  (see PATCHFILES below) if not found locally (default:
24#				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles)
25#
26# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
27#				  value.
28# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for
29#				  MASTER_SITES.
30# PACKAGES		- A top level directory where all packages go (rather than
31#				  going locally to each port). (default: ${PORTSDIR}/packages).
32# GMAKE			- Set to path of GNU make if not in $PATH (default: gmake).
33# XMKMF			- Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
34# MAINTAINER	- The e-mail address of the contact person for this port
35#				  (default: ports@FreeBSD.ORG).
36# CATEGORIES	- A list of descriptive categories into which this port falls
37#				  (default: orphans).
38# KEYWORDS		- A list of descriptive keywords that might index well for this
39#				  port (default: orphans).
40#
41# Variables that typically apply to an individual port.  Non-Boolean
42# variables without defaults are *mandatory*.
43# 
44#
45# WRKDIR 		- A temporary working directory that gets *clobbered* on clean
46#				  (default: ${.CURDIR}/work).
47# WRKSRC		- A subdirectory of ${WRKDIR} where the distribution actually
48#				  unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
49#				  NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
50# DISTNAME		- Name of port or distribution.
51# DISTFILES		- Name(s) of archive file(s) containing distribution
52#				  (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}).
53# PATCHFILES	- Name(s) of additional files that contain distributed
54#				  patches (default: none).  make will look for them at
55#				  PATCH_SITES (see above).  They will automatically be
56#				  uncompressed before patching if the names end with
57#				  ".gz" or ".Z".
58# PATCH_PRFX	- Filename prefix for distribution patches (default: none)
59#				  typically ${DISTNAME}/ or foo-
60# PKGNAME		- Name of the package file to create if the DISTNAME 
61#				  isn't really relevant for the port/package
62#				  (default: ${DISTNAME}).
63# EXTRACT_ONLY	- If defined, a subset of ${DISTFILES} you want to
64#			  	  actually extract.
65# PATCHDIR 		- A directory containing any additional patches you made
66#				  to port this software to FreeBSD (default:
67#				  ${.CURDIR}/patches)
68# SCRIPTDIR 	- A directory containing any auxiliary scripts
69#				  (default: ${.CURDIR}/scripts)
70# FILESDIR 		- A directory containing any miscellaneous additional files.
71#				  (default: ${.CURDIR}/files)
72# PKGDIR 		- A direction containing any package creation files.
73#				  (default: ${.CURDIR}/pkg)
74# PKG_DBDIR		- Where package installation is recorded (default: /var/db/pkg)
75# FORCE_PKG_REGISTER - If set, it will overwrite any existing package
76#				  registration information in ${PKG_DBDIR}/${PKGNAME}.
77# NO_MTREE		- If set, will not invoke mtree from bsd.port.mk from
78#				  the "install" target.  This is the default if
79#				  USE_IMAKE or USE_X11 is set.
80#
81# NO_EXTRACT	- Use a dummy (do-nothing) extract target.
82# NO_CONFIGURE	- Use a dummy (do-nothing) configure target.
83# NO_BUILD		- Use a dummy (do-nothing) build target.
84# NO_PACKAGE	- Use a dummy (do-nothing) package target.
85# NO_INSTALL	- Use a dummy (do-nothing) install target.
86# NO_WRKSUBDIR	- Assume port unpacks directly into ${WRKDIR}.
87# NO_WRKDIR		- There's no work directory at all; port does this someplace
88#				  else.
89# NO_DEPENDS	- Don't verify build of dependencies.
90# USE_GMAKE		- Says that the port uses gmake.
91# USE_IMAKE		- Says that the port uses imake.
92# USE_X11		- Says that the port uses X11.
93# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
94#						target.
95# HAS_CONFIGURE	- Says that the port has its own configure script.
96# GNU_CONFIGURE	- Set if you are using GNU configure (optional).
97# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
98# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set.
99# IS_INTERACTIVE - Set this if your port needs to interact with the user
100#				  during a build.  User can then decide to skip this port by
101#				  setting ${BATCH}, or compiling only the interactive ports
102#				  by setting ${INTERACTIVE}.
103# EXEC_DEPENDS	- A list of "prog:dir" pairs of other ports this
104#				  package depends on.  "prog" is the name of an
105#				  executable.  make will search your $PATH for it and go
106#				  into "dir" to do a "make all install" if it's not found.
107# LIB_DEPENDS	- A list of "lib:dir" pairs of other ports this package
108#				  depends on.  "lib" is the name of a shared library.
109#				  make will use "ldconfig -r" to search for the
110#				  library.  Note that lib can be any regular expression,
111#				  and you need two backslashes in front of dots (.) to
112#				  supress its special meaning (e.g., use
113#				  "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
114# DEPENDS		- A list of other ports this package depends on being
115#				  made first.  Use this for things that don't fall into
116#				  the above two categories.
117# EXTRACT_CMD	- Command for extracting archive (default: tar).
118# EXTRACT_SUFX	- Suffix for archive names (default: .tar.gz).
119# EXTRACT_BEFORE_ARGS -
120#				  Arguments to ${EXTRACT_CMD} before filename
121#				  (default: -C ${WRKDIR} -xzf).
122# EXTRACT_AFTER_ARGS -
123#				  Arguments to ${EXTRACT_CMD} following filename
124#				  (default: none).
125#
126# NCFTP			- Full path to ncftp command if not in $PATH (default: ncftp).
127# NCFTPFLAGS    - Arguments to ${NCFTP} (default: -N).
128#
129#
130# Variables to change if you want a special behavior:
131#
132# ECHO_MSG		- Used to print all the '===>' style prompts - override this
133#				  to turn them off (default: /bin/echo).
134# IS_DEPENDED_TARGET -
135#				  The target to execute when a port is called as a
136#				  dependency (default: install).  E.g., "make fetch
137#				  IS_DEPENDED_TARGET=fetch" will fetch all the distfiles,
138#				  including those of dependencies, without actually building
139#				  any of them).
140#
141# 
142# Default targets and their behaviors:
143#
144# fetch			- Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
145#				  into ${DISTDIR} as necessary.
146# fetch-list	- Show list of files that would be retrieved by fetch
147# extract		- Unpacks ${DISTFILES} into ${WRKDIR}.
148# patch			- Apply any provided patches to the source.
149# configure		- Runs either GNU configure, one or more local configure
150#				  scripts or nothing, depending on what's available.
151# build			- Actually compile the sources.
152# install		- Install the results of a build.
153# reinstall		- Install the results of a build, ignoring "already installed"
154#				  flag.
155# package		- Create a package from an _installed_ port.
156# describe		- Try to generate a one-line description for each port for
157#				  use in INDEX files and the like.
158# checkpatch	- Do a "patch -C" instead of a "patch".  Note that it may
159#				  give incorrect results if multiple patches deal with
160#				  the same file.
161# checksum		- Use files/md5 to ensure that your distfiles are valid
162# makesum		- Generate files/md5 (only do this for your own ports!)
163#
164# Default sequence for "all" is:  fetch checksum extract patch configure build
165#
166# Please read the comments in the targets section below, you
167# should be able to use the pre-* or post-* targets/scripts
168# (which are available for every stage except checksum) or
169# override the do-* targets to do pretty much anything you want.
170#
171# NEVER override the "regular" targets unless you want to open
172# a major can of worms.
173
174.if exists(${.CURDIR}/../Makefile.inc)
175.include "${.CURDIR}/../Makefile.inc"
176.endif
177
178# These need to be absolute since we don't know how deep in the ports
179# tree we are and thus can't go relative.  They can, of course, be overridden
180# by individual Makefiles.
181PORTSDIR?=		${DESTDIR}/usr/ports
182X11BASE?=		/usr/X11R6
183DISTDIR?=		${PORTSDIR}/distfiles
184PACKAGES?=		${PORTSDIR}/packages
185.if !defined(NO_WRKDIR)
186WRKDIR?=		${.CURDIR}/work
187.else
188WRKDIR?=		${.CURDIR}
189.endif
190.if defined(NO_WRKSUBDIR)
191WRKSRC?=		${WRKDIR}
192.else
193WRKSRC?=		${WRKDIR}/${DISTNAME}
194.endif
195PATCHDIR?=		${.CURDIR}/patches
196SCRIPTDIR?=		${.CURDIR}/scripts
197FILESDIR?=		${.CURDIR}/files
198PKGDIR?=		${.CURDIR}/pkg
199.if defined(USE_IMAKE) || defined(USE_X11)
200PREFIX?=		${X11BASE}
201.else
202PREFIX?=		/usr/local
203.endif
204.if defined(USE_GMAKE)
205EXEC_DEPENDS+=               gmake:${PORTSDIR}/devel/gmake
206.endif
207
208.if exists(${PORTSDIR}/../Makefile.inc)
209.include "${PORTSDIR}/../Makefile.inc"
210.endif
211
212# Change these if you'd prefer to keep the cookies someplace else.
213EXTRACT_COOKIE?=	${WRKDIR}/.extract_done
214CONFIGURE_COOKIE?=	${WRKDIR}/.configure_done
215INSTALL_COOKIE?=	${WRKDIR}/.install_done
216BUILD_COOKIE?=		${WRKDIR}/.build_done
217PATCH_COOKIE?=		${WRKDIR}/.patch_done
218PACKAGE_COOKIE?=	${WRKDIR}/.package_done
219
220# How to do nothing.  Override if you, for some strange reason, would rather
221# do something.
222DO_NADA?=		echo -n
223
224# Miscellaneous overridable commands:
225GMAKE?=			gmake
226XMKMF?=			xmkmf -a
227MD5?=			/sbin/md5
228MD5_FILE?=		${FILESDIR}/md5
229MAKE_FLAGS?=	-f
230MAKEFILE?=		Makefile
231
232NCFTP?=			/usr/bin/ncftp
233NCFTPFLAGS?=	-N
234
235TOUCH?=			/usr/bin/touch
236TOUCH_FLAGS?=	-f
237
238PATCH?=			/usr/bin/patch
239PATCH_STRIP?=	-p0
240PATCH_DIST_STRIP?=	-p0
241.if defined(PATCH_DEBUG)
242PATCH_ARGS?=	-d ${WRKSRC} -E ${PATCH_STRIP}
243PATCH_DIST_ARGS?=	-d ${WRKSRC} -E ${PATCH_DIST_STRIP}
244.else
245PATCH_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
246PATCH_DIST_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
247.endif
248
249.if defined(PATCH_CHECK_ONLY)
250PATCH_ARGS+=	-C
251PATCH_DIST_ARGS+=	-C
252.endif
253
254EXTRACT_CMD?=	/usr/bin/tar
255EXTRACT_SUFX?=	.tar.gz
256# Backwards compatability.
257.if defined(EXTRACT_ARGS)
258EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
259.else
260EXTRACT_BEFORE_ARGS?=   -xzf
261.endif
262
263# Figure out where the local mtree file is
264.if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist)
265MTREE_LOCAL=	/etc/mtree/BSD.local.dist
266.endif
267MTREE_CMD?=	/usr/sbin/mtree
268MTREE_ARGS?=	-U -f ${MTREE_LOCAL} -d -e -p
269.if defined(USE_X11) || defined(USE_IMAKE) || !defined(MTREE_LOCAL)
270NO_MTREE=	yes
271.endif
272
273# The user can override the NO_PACKAGE by specifying this from
274# the make command line
275.if defined(FORCE_PACKAGE)
276.undef NO_PACKAGE
277.endif
278
279PKG_CMD?=		/usr/sbin/pkg_create
280.if !defined(PKG_ARGS)
281PKG_ARGS=		-v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort|uniq`"
282.if exists(${PKGDIR}/INSTALL)
283PKG_ARGS+=		-i ${PKGDIR}/INSTALL
284.endif
285.if exists(${PKGDIR}/DEINSTALL)
286PKG_ARGS+=		-k ${PKGDIR}/DEINSTALL
287.endif
288.if exists(${PKGDIR}/REQ)
289PKG_ARGS+=		-r ${PKGDIR}/REQ
290.endif
291.if !defined(USE_X11) && !defined(USE_IMAKE) && defined(MTREE_LOCAL)
292PKG_ARGS+=		-m ${MTREE_LOCAL}
293.endif
294.endif
295PKG_SUFX?=		.tgz
296# where pkg_add records its dirty deeds.
297PKG_DBDIR?=		/var/db/pkg
298
299# Used to print all the '===>' style prompts - override this to turn them off.
300ECHO_MSG?=		/bin/echo
301
302ALL_TARGET?=		all
303INSTALL_TARGET?=	install
304
305# If the user has this set, go to the FreeBSD respository for everything.
306.if defined(MASTER_SITE_FREEBSD)
307MASTER_SITE_OVERRIDE=  ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/ 
308.endif
309
310# I guess we're in the master distribution business! :)  As we gain mirror
311# sites for distfiles, add them to this list.
312.if !defined(MASTER_SITE_OVERRIDE)
313MASTER_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/
314PATCH_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${PATCH_PRFX}
315.else
316MASTER_SITES=	${MASTER_SITE_OVERRIDE}
317PATCH_SITES=	${MASTER_SITE_OVERRIDE}${PATCH_PRFX}
318.endif
319
320.if defined(PATCH_PRFX)
321PATCHDIST!=	/bin/echo ${PATCH_PRFX} | sed 's|^\(.*\)/$$|/\1|'
322PATCHDIST:=	${DISTDIR}${PATCHDIST}
323.else
324PATCHDIST:=	${DISTDIR}
325.endif
326
327# Derived names so that they're easily overridable.
328DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
329PKGNAME?=		${DISTNAME}
330
331# Documentation
332MAINTAINER?=	ports@FreeBSD.ORG
333CATEGORIES?=	orphans
334KEYWORDS+=		${CATEGORIES}
335
336# Note this has to start with a capital letter (or more accurately, it
337#  shouldn't match "[a-z]*"), see the target "delete-package-links" below.
338PKGREPOSITORYSUBDIR?=	All
339PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
340.if exists(${PACKAGES})
341PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
342.else
343PKGFILE?=		${PKGNAME}${PKG_SUFX}
344.endif
345
346CONFIGURE_SCRIPT?=	configure
347
348.if defined(GNU_CONFIGURE)
349CONFIGURE_ARGS?=	--prefix=${PREFIX}
350HAS_CONFIGURE=		yes
351.endif
352
353.MAIN: all
354
355################################################################
356# If we're in BATCH mode and the port is interactive, or we're
357# in interactive mode and the port is non-interactive, skip all
358# the important targets.  The reason we have two modes is that
359# one might want to leave a build in BATCH mode running
360# overnight, then come back in the morning and do _only_ the
361# interactive ones that required your intervention.
362#
363# This allows you to do both.
364################################################################
365
366.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
367all:
368	@${DO_NADA}
369build:
370	@${DO_NADA}
371install:
372	@${DO_NADA}
373fetch:
374	@${DO_NADA}
375configure:
376	@${DO_NADA}
377package:
378	@${DO_NADA}
379.endif
380
381.if !target(all)
382all: build
383.endif
384
385.if !defined(IS_DEPENDED_TARGET)
386IS_DEPENDED_TARGET=	install
387.endif
388
389.if !target(is_depended)
390is_depended:	${IS_DEPENDED_TARGET}
391.endif
392
393################################################################
394# The following are used to create easy dummy targets for
395# disabling some bit of default target behavior you don't want.
396# They still check to see if the target exists, and if so don't
397# do anything, since you might want to set this globally for a
398# group of ports in a Makefile.inc, but still be able to
399# override from an individual Makefile.
400################################################################
401
402.if defined(NO_EXTRACT) && !target(extract)
403extract: checksum
404	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
405checksum: fetch
406	@${DO_NADA}
407makesum:
408	@${DO_NADA}
409.endif
410.if defined(NO_CONFIGURE) && !target(configure)
411configure: patch
412	@${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
413.endif
414.if defined(NO_BUILD) && !target(build)
415build: configure
416	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
417.endif
418.if defined(NO_PACKAGE) && !target(package)
419package:
420	@${DO_NADA}
421.endif
422.if defined(NO_PACKAGE) && !target(repackage)
423repackage:
424	@${DO_NADA}
425.endif
426.if defined(NO_INSTALL) && !target(install)
427install: build
428	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
429.endif
430.if defined(NO_PATCH) && !target(patch)
431patch: extract
432	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
433.endif
434
435################################################################
436# More standard targets start here.
437#
438# These are the body of the build/install framework.  If you are
439# not happy with the default actions, and you can't solve it by
440# adding pre-* or post-* targets/scripts, override these.
441################################################################
442
443# Fetch
444
445.if !target(do-fetch)
446do-fetch:
447	@if [ ! -d ${DISTDIR} ]; then /bin/mkdir -p ${DISTDIR}; fi
448	@(cd ${DISTDIR}; \
449	 for file in ${DISTFILES}; do \
450		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \
451			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
452			for site in ${MASTER_SITES}; do \
453			    ${ECHO_MSG} ">> Attempting to fetch from $${site}"; \
454				if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \
455					break; \
456				fi \
457			done; \
458			if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \
459				${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\
460				${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \
461				exit 1; \
462			fi; \
463	    fi \
464	 done)
465.if defined(PATCHFILES)
466	@if [ ! -d ${PATCHDIST} ]; then /bin/mkdir -p ${PATCHDIST}; fi
467	@(cd ${PATCHDIST}; \
468	 for file in ${PATCHFILES}; do \
469		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \
470			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
471			for site in ${PATCH_SITES}; do \
472			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
473				if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \
474					break; \
475				fi \
476			done; \
477			if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \
478				${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\
479				${ECHO_MSG} ">> port manually into ${PATCHDIST} and try again."; \
480				exit 1; \
481			fi; \
482	    fi \
483	 done)
484.endif
485.endif
486
487# Extract
488
489.if !target(do-extract)
490do-extract:
491	@/bin/rm -rf ${WRKDIR}
492	@/bin/mkdir -p ${WRKDIR}
493.if defined(EXTRACT_ONLY)
494	@for file in ${EXTRACT_ONLY}; do \
495		if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
496		then \
497			exit 1; \
498		fi \
499	done
500.else
501	@for file in ${DISTFILES}; do \
502		if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
503		then \
504			exit 1; \
505		fi \
506	done
507.endif
508.endif
509
510# Patch
511
512.if !target(do-patch)
513do-patch:
514.if defined(PATCHFILES)
515	@${ECHO_MSG} "===>  Applying distributed patches for ${PKGNAME}"
516.if defined(PATCH_DEBUG)
517	@(cd ${PATCHDIST}; \
518	  for i in ${PATCHFILES}; do \
519		${ECHO_MSG} "===>   Applying distributed patch $$i" ; \
520		case $$i in \
521			*.Z|*.gz) \
522				/usr/bin/gzcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
523				;; \
524			*) \
525				${PATCH} ${PATCH_DIST_ARGS} < $$i; \
526				;; \
527		esac; \
528	  done)
529.else
530	@(cd ${PATCHDIST}; \
531	  for i in ${PATCHFILES}; do \
532		case $$i in \
533			*.Z|*.gz) \
534				/usr/bin/gzcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
535				;; \
536			*) \
537				${PATCH} ${PATCH_DIST_ARGS} < $$i; \
538				;; \
539		esac; \
540	  done)
541.endif
542.endif
543.if defined(PATCH_DEBUG)
544	@if [ -d ${PATCHDIR} ]; then \
545		${ECHO_MSG} "===>  Applying FreeBSD patches for ${PKGNAME}" ; \
546		for i in ${PATCHDIR}/patch-*; do \
547			${ECHO_MSG} "===>   Applying FreeBSD patch $$i" ; \
548			${PATCH} ${PATCH_ARGS} < $$i; \
549		done; \
550	fi
551.else
552	@if [ -d ${PATCHDIR} ]; then \
553		${ECHO_MSG} "===>  Applying FreeBSD patches for ${PKGNAME}" ; \
554		for i in ${PATCHDIR}/patch-*; \
555			do ${PATCH} ${PATCH_ARGS} < $$i; \
556		done;\
557	fi
558.endif
559.endif
560
561# Configure
562
563.if !target(do-configure)
564do-configure:
565	@if [ -f ${SCRIPTDIR}/configure ]; then \
566		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
567		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
568		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
569		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
570		/bin/sh ${SCRIPTDIR}/configure; \
571	fi
572.if defined(HAS_CONFIGURE)
573	@(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
574	    INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
575	    INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \
576	    ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
577.endif
578.if defined(USE_IMAKE)
579	@(cd ${WRKSRC}; ${XMKMF})
580.endif
581.endif
582
583# Build
584
585.if !target(do-build)
586do-build:
587.if defined(USE_GMAKE)
588	@(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
589.else defined(USE_GMAKE)
590	@(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
591.endif
592.endif
593
594# Install
595
596.if !target(do-install)
597do-install:
598.if defined(USE_GMAKE)
599	@(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
600.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
601	@(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
602.endif
603.else defined(USE_GMAKE)
604	@(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
605.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
606	@(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
607.endif
608.endif
609.endif
610
611################################################################
612# Skeleton targets start here
613# 
614# You shouldn't have to change these.  Either add the pre-* or
615# post-* targets/scripts or redefine the do-* targets.  These
616# targets don't do anything other than checking for cookies and
617# call the necessary targets/scripts.
618################################################################
619
620# Fetch
621
622.if !target(fetch)
623fetch: depends
624.if target(pre-fetch)
625	@${MAKE} ${.MAKEFLAGS} pre-fetch
626.endif
627	@if [ -f ${SCRIPTDIR}/pre-fetch ]; then \
628		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
629		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
630		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
631		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
632			/bin/sh ${SCRIPTDIR}/pre-fetch; \
633	fi
634	@${MAKE} ${.MAKEFLAGS} do-fetch
635.if target(post-fetch)
636	@${MAKE} ${.MAKEFLAGS} post-fetch
637.endif
638	@if [ -f ${SCRIPTDIR}/post-fetch ]; then \
639		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
640		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
641		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
642		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
643			/bin/sh ${SCRIPTDIR}/post-fetch; \
644	fi
645.endif
646
647# Extract
648
649.if !target(extract)
650extract: checksum ${EXTRACT_COOKIE}
651
652${EXTRACT_COOKIE}:
653	@${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
654.if target(pre-extract)
655	@${MAKE} ${.MAKEFLAGS} pre-extract
656.endif
657	@if [ -f ${SCRIPTDIR}/pre-extract ]; then \
658		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
659		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
660		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
661		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
662			/bin/sh ${SCRIPTDIR}/pre-extract; \
663	fi
664	@${MAKE} ${.MAKEFLAGS} do-extract
665.if target(post-extract)
666	@${MAKE} ${.MAKEFLAGS} post-extract
667.endif
668	@if [ -f ${SCRIPTDIR}/post-extract ]; then \
669		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
670		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
671		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
672		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
673			/bin/sh ${SCRIPTDIR}/post-extract; \
674	fi
675	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
676.endif
677
678# Patch
679
680.if !target(patch)
681patch: extract ${PATCH_COOKIE}
682
683${PATCH_COOKIE}:
684	@${ECHO_MSG} "===>  Patching for ${PKGNAME}"
685.if target(pre-patch)
686	@${MAKE} ${.MAKEFLAGS} pre-patch
687.endif
688	@if [ -f ${SCRIPTDIR}/pre-patch ]; then \
689		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
690		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
691		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
692		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
693			/bin/sh ${SCRIPTDIR}/pre-patch; \
694	fi
695	@${MAKE} ${.MAKEFLAGS} do-patch
696.if target(post-patch)
697	@${MAKE} ${.MAKEFLAGS} post-patch
698.endif
699	@if [ -f ${SCRIPTDIR}/post-patch ]; then \
700		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
701		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
702		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
703		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
704			/bin/sh ${SCRIPTDIR}/post-patch; \
705	fi
706.if !defined(PATCH_CHECK_ONLY)
707	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
708.endif
709.endif
710
711# Checkpatch
712#
713# Special target to verify patches
714
715.if !target(checkpatch)
716checkpatch:
717	@${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
718.endif
719
720# Configure
721
722.if !target(configure)
723configure: patch ${CONFIGURE_COOKIE}
724
725${CONFIGURE_COOKIE}:
726	@${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
727.if target(pre-configure)
728	@${MAKE} ${.MAKEFLAGS} pre-configure
729.endif
730	@if [ -f ${SCRIPTDIR}/pre-configure ]; then \
731		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
732		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
733		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
734		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
735			/bin/sh ${SCRIPTDIR}/pre-configure; \
736	fi
737	@${MAKE} ${.MAKEFLAGS} do-configure
738.if target(post-configure)
739	@${MAKE} ${.MAKEFLAGS} post-configure
740.endif
741	@if [ -f ${SCRIPTDIR}/post-configure ]; then \
742		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
743		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
744		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
745		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
746			/bin/sh ${SCRIPTDIR}/post-configure; \
747	fi
748	@${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
749.endif
750
751# Build
752
753.if !target(build)
754build: configure ${BUILD_COOKIE}
755
756${BUILD_COOKIE}:
757	@${ECHO_MSG} "===>  Building for ${PKGNAME}"
758.if target(pre-build)
759	@${MAKE} ${.MAKEFLAGS} pre-build
760.endif
761	@if [ -f ${SCRIPTDIR}/pre-build ]; then \
762		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
763		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
764		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
765		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
766			/bin/sh ${SCRIPTDIR}/pre-build; \
767	fi
768	@${MAKE} ${.MAKEFLAGS} do-build
769.if target(post-build)
770	@${MAKE} ${.MAKEFLAGS} post-build
771.endif
772	@if [ -f ${SCRIPTDIR}/post-build ]; then \
773		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
774		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
775		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
776		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
777			/bin/sh ${SCRIPTDIR}/post-build; \
778	fi
779	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
780.endif
781
782# Install
783
784.if !target(install)
785install: build ${INSTALL_COOKIE}
786
787${INSTALL_COOKIE}:
788	@${ECHO_MSG} "===>  Installing for ${PKGNAME}"
789.if !defined(NO_MTREE)
790	@if [ `id -u` = 0 ]; then \
791		${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
792	else \
793		${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
794		${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
795	fi
796.endif
797.if target(pre-install)
798	@${MAKE} ${.MAKEFLAGS} pre-install
799.endif
800	@if [ -f ${SCRIPTDIR}/pre-install ]; then \
801		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
802		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
803		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
804		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
805			/bin/sh ${SCRIPTDIR}/pre-install; \
806	fi
807	@${MAKE} ${.MAKEFLAGS} do-install
808.if target(post-install)
809	@${MAKE} ${.MAKEFLAGS} post-install
810.endif
811	@if [ -f ${SCRIPTDIR}/post-install ]; then \
812		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
813		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
814		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
815		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
816			/bin/sh ${SCRIPTDIR}/post-install; \
817	fi
818	@${MAKE} ${.MAKEFLAGS} fake-pkg
819	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
820.endif
821
822# Reinstall
823#
824# This is a special target to re-run install
825
826.if !target(reinstall)
827reinstall: pre-reinstall install
828
829pre-reinstall:
830	@/bin/rm -f ${INSTALL_COOKIE}
831	@/bin/rm -f ${PACKAGE_COOKIE}
832.endif
833
834################################################################
835# Some more targets supplied for users' convenience
836################################################################
837
838# Cleaning up
839
840.if !target(pre-clean)
841pre-clean:
842	@${DO_NADA}
843.endif
844
845.if !target(clean)
846clean: pre-clean
847	@${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
848	@/bin/rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \
849		${BUILD_COOKIE} ${PATCH_COOKIE}
850.if defined(NO_WRKDIR)
851	@/bin/rm -f ${WRKDIR}/.*_done
852.else
853	@/bin/rm -rf ${WRKDIR}
854.endif
855.endif
856
857# Prints out a list of files to fetch (useful to do a batch fetch)
858
859.if !target(fetch-list)
860fetch-list:
861	@if [ ! -d ${DISTDIR} ]; then /bin/mkdir -p ${DISTDIR}; fi
862	@(cd ${DISTDIR}; \
863	 for file in ${DISTFILES}; do \
864		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \
865			for site in ${MASTER_SITES}; do \
866				/bin/echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \
867					break; \
868			done; \
869			/bin/echo "echo $${file} not fetched" ; \
870		fi \
871	done)
872.if defined(PATCHFILES)
873	@(cd ${DISTDIR}; \
874	 for file in ${PATCHFILES}; do \
875		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \
876			for site in ${PATCH_SITES}; do \
877				/bin/echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${PATCH_PRFX}$${file} '||' ; \
878					break; \
879			done; \
880			/bin/echo "echo $${file} not fetched" ; \
881		fi \
882	 done)
883.endif
884.endif
885
886# Checksumming utilities
887
888.if !target(makesum)
889makesum: fetch
890	@if [ ! -d ${FILESDIR} ]; then /bin/mkdir -p ${FILESDIR}; fi
891	@if [ -f ${MD5_FILE} ]; then /bin/rm -f ${MD5_FILE}; fi
892	@(cd ${DISTDIR}; \
893	 for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \
894		${MD5} $$file >> ${MD5_FILE}; \
895	 done)
896.endif
897
898.if !target(checksum)
899checksum: fetch
900	@if [ ! -f ${MD5_FILE} ]; then \
901		${ECHO_MSG} ">> No MD5 checksum file."; \
902	else \
903		(cd ${DISTDIR}; OK=""; \
904		  for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \
905			CKSUM=`${MD5} $$file | awk '{print $$4}'`; \
906			CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \
907			if [ "$$CKSUM2" = "" ]; then \
908				${ECHO_MSG} ">> No checksum recorded for $$file"; \
909				OK="false"; \
910			elif [ "$$CKSUM" != "$$CKSUM2" ]; then \
911				${ECHO_MSG} ">> Checksum mismatch for $$file"; \
912				exit 1; \
913			fi; \
914		  done; \
915		  if [ "$$OK" = "" ]; then \
916			${ECHO_MSG} "Checksums OK."; \
917		  else \
918			${ECHO_MSG} "Checksums OK for files that have them."; \
919		  fi) ; \
920	fi
921.endif
922
923################################################################
924# The package-building targets
925# You probably won't need to touch these
926################################################################
927
928# Nobody should want to override this unless PKGNAME is simply bogus.
929.if !target(package-name)
930package-name:
931.if !defined(NO_PACKAGE)
932	@/bin/echo ${PKGNAME}
933.endif
934.endif
935
936# Show (recursively) all the packages this package depends on.
937.if !target(package-depends)
938package-depends:
939	@for i in ${EXEC_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
940		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
941		(cd $$dir ; ${MAKE} package-name package-depends); \
942	done
943.endif
944
945# Build a package
946
947.if !target(package)
948package: install ${PACKAGE_COOKIE}
949
950${PACKAGE_COOKIE}:
951.if target(pre-package)
952	@${MAKE} ${.MAKEFLAGS} pre-package
953.endif
954	@${MAKE} ${.MAKEFLAGS} do-package
955	@${TOUCH} ${TOUCH_FLAGS} ${PACKAGE_COOKIE}
956.endif
957
958# Build a package but don't check the package cookie
959
960.if !target(repackage)
961repackage: pre-repackage package
962
963pre-repackage:
964	@/bin/rm -f ${PACKAGE_COOKIE}
965.endif
966
967# Build a package but don't check the cookie for installation, also don't
968# install package cookie
969
970.if !target(package-noinstall)
971package-noinstall:
972.if target(pre-package)
973	@${MAKE} ${.MAKEFLAGS} pre-package
974.endif
975	@${MAKE} ${.MAKEFLAGS} do-package
976.endif
977
978# The body of the package-building target
979
980.if !target(do-package)
981do-package:
982	@if [ -e ${PKGDIR}/PLIST ]; then \
983		${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
984		if [ -d ${PACKAGES} ]; then \
985			if [ ! -d ${PKGREPOSITORY} ]; then \
986				if ! /bin/mkdir -p ${PKGREPOSITORY}; then \
987					${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
988					exit 1; \
989				fi; \
990			fi; \
991		fi; \
992		if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
993			if [ -d ${PACKAGES} ]; then \
994				${MAKE} ${.MAKEFLAGS} package-links; \
995			fi; \
996		else \
997			${MAKE} ${.MAKEFLAGS} delete-package; \
998			exit 1; \
999		fi; \
1000	fi
1001.endif
1002
1003.if !target(package-links)
1004package-links:
1005	@${MAKE} ${.MAKEFLAGS} delete-package-links
1006	@for cat in ${CATEGORIES}; do \
1007		if [ ! -d ${PACKAGES}/$$cat ]; then \
1008			if ! /bin/mkdir -p ${PACKAGES}/$$cat; then \
1009				${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
1010				exit 1; \
1011			fi; \
1012		fi; \
1013		ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
1014	done;
1015.endif
1016
1017.if !target(delete-package-links)
1018delete-package-links:
1019	@/bin/rm -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
1020.endif
1021
1022.if !target(delete-package)
1023delete-package:
1024	@${MAKE} ${.MAKEFLAGS} delete-package-links
1025	@/bin/rm -f ${PKGFILE}
1026.endif
1027
1028################################################################
1029# Dependency checking
1030################################################################
1031
1032.if !target(depends)
1033depends: exec_depends lib_depends misc_depends
1034
1035exec_depends:
1036.if defined(EXEC_DEPENDS)
1037.if defined(NO_DEPENDS)
1038# Just print out messages
1039	@for i in ${EXEC_DEPENDS}; do \
1040		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
1041		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
1042		${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
1043	done
1044.else
1045	@for i in ${EXEC_DEPENDS}; do \
1046		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
1047		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
1048		if which -s "$$prog"; then \
1049			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
1050		else \
1051			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
1052			${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \
1053			if [ ! -d "$$dir" ]; then \
1054				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
1055			else \
1056				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1057				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
1058			fi; \
1059		fi; \
1060	done
1061.endif
1062.else
1063	@${DO_NADA}
1064.endif
1065
1066lib_depends:
1067.if defined(LIB_DEPENDS)
1068.if defined(NO_DEPENDS)
1069# Just print out messages
1070	@for i in ${LIB_DEPENDS}; do \
1071		lib=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
1072		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
1073		${ECHO_MSG} "===>  ${PKGNAME} depends on shared library:  $$lib ($$dir)"; \
1074	done
1075.else
1076	@for i in ${LIB_DEPENDS}; do \
1077		lib=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \
1078		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \
1079		if ldconfig -r | grep -q -e "-l$$lib"; then \
1080			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \
1081		else \
1082			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \
1083			${ECHO_MSG} "===>  Verifying build for $$lib in $$dir"; \
1084			if [ ! -d "$$dir" ]; then \
1085				${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
1086			else \
1087				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1088				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
1089			fi; \
1090		fi; \
1091	done
1092.endif
1093.else
1094	@${DO_NADA}
1095.endif
1096
1097misc_depends:
1098.if defined(DEPENDS)
1099	@${ECHO_MSG} "===>  ${PKGNAME} depends on:  ${DEPENDS}"
1100.if !defined(NO_DEPENDS)
1101	@for i in ${DEPENDS}; do \
1102		${ECHO_MSG} "===>  Verifying build for $$i"; \
1103		if [ ! -d $$i ]; then \
1104			${ECHO_MSG} ">> No directory for $$i.  Skipping.."; \
1105		else \
1106			(cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1107		fi \
1108	done
1109	@${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
1110.endif
1111.else
1112	@${DO_NADA}
1113.endif
1114
1115.endif
1116
1117################################################################
1118# Everything after here are internal targets and really
1119# shouldn't be touched by anybody but the release engineers.
1120################################################################
1121
1122# This target generates an index entry suitable for aggregation into
1123# a large index.  Format is:
1124#
1125# distribution-name|port-path|installation-prefix|comment| \
1126#  description-file|maintainer|categories|keywords
1127#
1128.if !target(describe)
1129describe:
1130	@/bin/echo -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|"
1131	@/bin/echo -n "${PREFIX}|"
1132	@if [ -f ${PKGDIR}/COMMENT ]; then \
1133		/bin/echo -n "`/bin/cat ${PKGDIR}/COMMENT`"; \
1134	else \
1135		/bin/echo -n "** No Description"; \
1136	fi
1137	@if [ -f ${PKGDIR}/DESCR ]; then \
1138		/bin/echo -n "|${PKGDIR}/DESCR"; \
1139	else \
1140		/bin/echo -n "|/dev/null"; \
1141	fi
1142	@/bin/echo -n "|${MAINTAINER}|${CATEGORIES}|${KEYWORDS}"
1143	@/bin/echo ""
1144.endif
1145
1146# Fake installation of package so that user can pkg_delete it later.
1147# Also, make sure that an installed port is recognized correctly in
1148# accordance to the @pkgdep directive in the packing lists
1149
1150.if !target(fake-pkg)
1151fake-pkg:
1152	@if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then /bin/echo "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
1153	@if [ ! -d ${PKG_DBDIR} ]; then /bin/rm -f ${PKG_DBDIR}; /bin/mkdir -p ${PKG_DBDIR}; fi
1154.if defined(FORCE_PKG_REGISTER)
1155	@/bin/rm -rf ${PKG_DBDIR}/${PKGNAME}
1156.endif
1157	@if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1158		${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \
1159		/bin/mkdir -p ${PKG_DBDIR}/${PKGNAME}; \
1160		${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1161		/bin/cp ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \
1162		/bin/cp ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1163		if [ -f ${PKGDIR}/INSTALL ]; then \
1164			/bin/cp ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
1165		fi; \
1166		if [ -f ${PKGDIR}/DEINSTALL ]; then \
1167			/bin/cp ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
1168		fi; \
1169		if [ -f ${PKGDIR}/REQ ]; then \
1170			/bin/cp ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
1171		fi; \
1172	else \
1173		${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \
1174		${ECHO_MSG} "     If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
1175		${ECHO_MSG} "     this port again to upgrade it properly."; \
1176	fi
1177.endif
1178
1179# Depend is generally meaningless for arbitrary ports, but if someone wants
1180# one they can override this.  This is just to catch people who've gotten into
1181# the habit of typing `make depend all install' as a matter of course.
1182#
1183.if !target(depend)
1184depend:
1185.endif
1186
1187# Same goes for tags
1188.if !target(tags)
1189tags:
1190.endif
1191