xref: /freebsd/share/mk/bsd.port.mk (revision b5b2a90624d3d900a42e99758eb95293d04f37fa)
1#-*- mode: Fundamental; tab-width: 4; -*-
2# ex:ts=4
3#
4#	$Id: bsd.port.mk,v 1.252 1997/02/17 08:20:36 obrien Exp $
5#	$NetBSD: $
6#
7#	bsd.port.mk - 940820 Jordan K. Hubbard.
8#	This file is in the public domain.
9#
10# Please view me with 4 column tabs!
11
12# This is for this file, not for the ports that includes it, so it's
13# not called MAINTAINER -- the person to contact if you have questions/
14# suggestions about bsd.port.mk.
15#
16# If you are not him, you are not allowed to commit to this file without
17# his permission. :)
18#
19
20FreeBSD_MAINTAINER=	asami@FreeBSD.ORG
21OpenBSD_MAINTAINER=	imp@OpenBSD.ORG
22
23# Supported Variables and their behaviors:
24#
25# Variables that typically apply to all ports:
26#
27# OPSYS			- Portability clause.  This is the operating system the
28#				  makefile is being used on.  Automatically set to
29#				  "FreeBSD," "NetBSD," or "OpenBSD" as appropriate.
30# PORTSDIR		- The root of the ports tree.  Defaults:
31#					FreeBSD/OpenBSD: /usr/ports
32#					NetBSD:          /usr/opt
33# DISTDIR 		- Where to get gzip'd, tarballed copies of original sources
34#				  (default: ${PORTSDIR}/distfiles).
35# PREFIX		- Where to install things in general (default: /usr/local).
36# MASTER_SITES	- Primary location(s) for distribution files if not found
37#				  locally.
38# PATCH_SITES	- Primary location(s) for distribution patch files
39#				  (see PATCHFILES below) if not found locally.
40#
41# MASTER_SITE_BACKUP - Backup location(s) for distribution files and patch
42#				  files if not found locally and ${MASTER_SITES}/${PATCH_SITES}
43#				  (default:
44#				  ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
45# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
46#				  value.
47# MASTER_SITE_FREEBSD - If set, only use ${MASTER_SITE_BACKUP} for
48#				  MASTER_SITES.
49# PACKAGES		- A top level directory where all packages go (rather than
50#				  going locally to each port). (default: ${PORTSDIR}/packages).
51# GMAKE			- Set to path of GNU make if not in $PATH (default: gmake).
52# XMKMF			- Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
53# MAINTAINER	- The e-mail address of the contact person for this port
54#				  (default: ports@FreeBSD.ORG).
55# CATEGORIES	- A list of descriptive categories into which this port falls.
56#
57# Variables that typically apply to an individual port.  Non-Boolean
58# variables without defaults are *mandatory*.
59#
60# WRKDIR 		- A temporary working directory that gets *clobbered* on clean
61#				  (default: ${.CURDIR}/work).
62# WRKSRC		- A subdirectory of ${WRKDIR} where the distribution actually
63#				  unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
64#				  NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
65# DISTNAME		- Name of port or distribution.
66# DISTFILES		- Name(s) of archive file(s) containing distribution
67#				  (default: ${DISTNAME}${EXTRACT_SUFX}).
68# PATCHFILES	- Name(s) of additional files that contain distribution
69#				  patches (default: none).  make will look for them at
70#				  PATCH_SITES (see above).  They will automatically be
71#				  uncompressed before patching if the names end with
72#				  ".gz" or ".Z".
73# DIST_SUBDIR	- Suffix to ${DISTDIR}.  If set, all ${DISTFILES}
74#				  and ${PATCHFILES} will be put in this subdirectory of
75#				  ${DISTDIR}.  Also they will be fetched in this subdirectory
76#				  from FreeBSD mirror sites.
77# ALLFILES		- All of ${DISTFILES} and ${PATCHFILES}.
78# IGNOREFILES	- If some of the ${ALLFILES} are not checksum-able, set
79#				  this variable to their names.
80# PKGNAME		- Name of the package file to create if the DISTNAME
81#				  isn't really relevant for the port/package
82#				  (default: ${DISTNAME}).
83# EXTRACT_ONLY	- If defined, a subset of ${DISTFILES} you want to
84#			  	  actually extract.
85# PATCHDIR 		- A directory containing any additional patches you made
86#				  to port this software to FreeBSD (default:
87#				  ${.CURDIR}/patches)
88# SCRIPTDIR 	- A directory containing any auxiliary scripts
89#				  (default: ${.CURDIR}/scripts)
90# FILESDIR 		- A directory containing any miscellaneous additional files.
91#				  (default: ${.CURDIR}/files)
92# PKGDIR 		- A direction containing any package creation files.
93#				  (default: ${.CURDIR}/pkg)
94# PKG_DBDIR		- Where package installation is recorded (default: /var/db/pkg)
95# FORCE_PKG_REGISTER - If set, it will overwrite any existing package
96#				  registration information in ${PKG_DBDIR}/${PKGNAME}.
97# NO_MTREE		- If set, will not invoke mtree from bsd.port.mk from
98#				  the "install" target.  This is the default if
99#				  USE_IMAKE or USE_X11 is set.
100#
101# NO_BUILD		- Use a dummy (do-nothing) build target.
102# NO_CONFIGURE	- Use a dummy (do-nothing) configure target.
103# NO_CDROM		- Port may not go on CDROM.  Set this string to reason.
104# NO_DESCRIBE	- Use a dummy (do-nothing) describe target.
105# NO_EXTRACT	- Use a dummy (do-nothing) extract target.
106# NO_INSTALL	- Use a dummy (do-nothing) install target.
107# NO_PACKAGE	- Use a dummy (do-nothing) package target.
108# NO_PKG_REGISTER - Don't register a port install as a package.
109# NO_WRKSUBDIR	- Assume port unpacks directly into ${WRKDIR}.
110# NO_WRKDIR		- There's no work directory at all; port does this someplace
111#				  else.
112# NO_DEPENDS	- Don't verify build of dependencies.
113# BROKEN		- Port is broken.  Set this string to the reason why.
114# RESTRICTED	- Port is restricted.  Set this string to the reason why.
115# USE_GMAKE		- Says that the port uses gmake.
116# USE_IMAKE		- Says that the port uses imake.
117# USE_X11		- Says that the port uses X11.
118# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
119#						target.
120# HAS_CONFIGURE	- Says that the port has its own configure script.
121# GNU_CONFIGURE	- Set if you are using GNU configure (optional).
122# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
123# CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set.
124# CONFIGURE_ENV - Pass these env (shell-like) to configure if
125#				  ${HAS_CONFIGURE} is set.
126# SCRIPTS_ENV	- Additional environment vars passed to scripts in
127#                 ${SCRIPTDIR} executed by bsd.port.mk.
128# MAKE_ENV		- Additional environment vars passed to sub-make in build
129#				  stage.
130# IS_INTERACTIVE - Set this if your port needs to interact with the user
131#				  during a build.  User can then decide to skip this port by
132#				  setting ${BATCH}, or compiling only the interactive ports
133#				  by setting ${INTERACTIVE}.
134# FETCH_DEPENDS - A list of "path:dir" pairs of other ports this
135#				  package depends in the "fetch" stage.  "path" is the
136#				  name of a file if it starts with a slash (/), an
137#				  executable otherwise.  make will test for the
138#				  existence (if it is a full pathname) or search for
139#				  it in your $PATH (if it is an executable) and go
140#				  into "dir" to do a "make all install" if it's not
141#				  found.
142# BUILD_DEPENDS - A list of "path:dir" pairs of other ports this
143#				  package depends to build (between the "extract" and
144#				  "build" stages, inclusive).  The test done to
145#				  determine the existence of the dependency is the
146#				  same as FETCH_DEPENDS.
147# RUN_DEPENDS	- A list of "path:dir" pairs of other ports this
148#				  package depends to run.  The test done to determine
149#				  the existence of the dependency is the same as
150#				  FETCH_DEPENDS.  This will be checked during the
151#				  "install" stage and the name of the dependency will
152#				  be put into the package as well.
153# LIB_DEPENDS	- A list of "lib:dir" pairs of other ports this package
154#				  depends on.  "lib" is the name of a shared library.
155#				  make will use "ldconfig -r" to search for the
156#				  library.  Note that lib can be any regular expression,
157#				  and you need two backslashes in front of dots (.) to
158#				  supress its special meaning (e.g., use
159#				  "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
160# DEPENDS		- A list of other ports this package depends on being
161#				  made first.  Use this for things that don't fall into
162#				  the above two categories.
163# EXTRACT_CMD	- Command for extracting archive (default: tar).
164# EXTRACT_SUFX	- Suffix for archive names (default: .tar.gz).
165# EXTRACT_BEFORE_ARGS -
166#				  Arguments to ${EXTRACT_CMD} before filename
167#				  (default: -C ${WRKDIR} -xzf).
168# EXTRACT_AFTER_ARGS -
169#				  Arguments to ${EXTRACT_CMD} following filename
170#				  (default: none).
171#
172# FETCH_CMD		  - Full path to ftp/http fetch command if not in $PATH
173#				  (default: /usr/bin/fetch).
174# FETCH_BEFORE_ARGS -
175#				  Arguments to ${FETCH_CMD} before filename (default: none).
176# FETCH_AFTER_ARGS -
177#				  Arguments to ${FETCH_CMD} following filename (default: none).
178#
179# Motif support:
180#
181# REQUIRES_MOTIF - Set this in your port if it requires Motif.  It will  be
182#				  built only if HAVE_MOTIF is set.
183# HAVE_MOTIF	- If set, means system has Motif.  Typically set in
184#				  /etc/make.conf.
185# MOTIF_STATIC	- If set, link libXm statically; otherwise, link it
186#				  dynamically.  Typically set in /etc/make.conf.
187# MOTIFLIB		- Set automatically to appropriate value depending on
188#				  ${MOTIF_STATIC}.  Substitute references to -lXm with
189#				  patches to make your port conform to our standards.
190# MOTIF_ONLY	- If set, build Motif ports only.  (Not much use except for
191#				  building packages.)
192#
193# Variables to change if you want a special behavior:
194#
195# ECHO_MSG		- Used to print all the '===>' style prompts - override this
196#				  to turn them off (default: /bin/echo).
197# IS_DEPENDED_TARGET -
198#				  The target to execute when a port is called as a
199#				  dependency (default: install).  E.g., "make fetch
200#				  IS_DEPENDED_TARGET=fetch" will fetch all the distfiles,
201#				  including those of dependencies, without actually building
202#				  any of them).
203# PATCH_DEBUG	- If set, print out more information about the patches as
204#				  it attempts to apply them.
205#
206# Variables that serve as convenient "aliases" for your *-install targets.
207# Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".
208#
209# INSTALL_PROGRAM - A command to install binary executables.
210# INSTALL_SCRIPT - A command to install executable scripts.
211# INSTALL_DATA	- A command to install sharable data.
212# INSTALL_MAN	- A command to install manpages (doesn't compress).
213#
214# If your port doesn't automatically compress manpages, set the following.
215# Depending on the setting of NOMANCOMPRESS, the make rules will compress
216# the manpages for you.
217#
218# MAN<sect>		- A list of manpages, categorized by section.  For
219#				  example, if your port has "man/man1/foo.1" and
220#				  "man/mann/bar.n", set "MAN1=foo.1" and "MANN=bar.n".
221#				  The available sections chars are "123456789LN".
222# MANPREFIX		- The directory prefix for ${MAN<sect>} (default: ${PREFIX}).
223#
224# Default targets and their behaviors:
225#
226# fetch			- Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
227#				  into ${DISTDIR} as necessary.
228# fetch-list	- Show list of files that would be retrieved by fetch
229# extract		- Unpacks ${DISTFILES} into ${WRKDIR}.
230# patch			- Apply any provided patches to the source.
231# configure		- Runs either GNU configure, one or more local configure
232#				  scripts or nothing, depending on what's available.
233# build			- Actually compile the sources.
234# install		- Install the results of a build.
235# reinstall		- Install the results of a build, ignoring "already installed"
236#				  flag.
237# package		- Create a package from an _installed_ port.
238# describe		- Try to generate a one-line description for each port for
239#				  use in INDEX files and the like.
240# checkpatch	- Do a "patch -C" instead of a "patch".  Note that it may
241#				  give incorrect results if multiple patches deal with
242#				  the same file.
243# checksum		- Use files/md5 to ensure that your distfiles are valid.
244# makesum		- Generate files/md5 (only do this for your own ports!).
245#
246# Default sequence for "all" is:  fetch checksum extract patch configure build
247#
248# Please read the comments in the targets section below, you
249# should be able to use the pre-* or post-* targets/scripts
250# (which are available for every stage except checksum) or
251# override the do-* targets to do pretty much anything you want.
252#
253# NEVER override the "regular" targets unless you want to open
254# a major can of worms.
255
256# Get the operating system type
257OPSYS!=	uname -s
258
259.if exists(${.CURDIR}/../Makefile.inc)
260.include "${.CURDIR}/../Makefile.inc"
261.endif
262
263
264# These need to be absolute since we don't know how deep in the ports
265# tree we are and thus can't go relative.  They can, of course, be overridden
266# by individual Makefiles or local system make configuration.
267.if (${OPSYS} == "NetBSD")
268PORTSDIR?=		/usr/opt
269.else
270PORTSDIR?=		/usr/ports
271.endif
272LOCALBASE?=		${DESTDIR}/usr/local
273X11BASE?=		${DESTDIR}/usr/X11R6
274DISTDIR?=		${PORTSDIR}/distfiles
275_DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
276PACKAGES?=		${PORTSDIR}/packages
277TEMPLATES?=		${PORTSDIR}/templates
278.if !defined(NO_WRKDIR)
279WRKDIR?=		${.CURDIR}/work
280.else
281WRKDIR?=		${.CURDIR}
282.endif
283.if defined(NO_WRKSUBDIR)
284WRKSRC?=		${WRKDIR}
285.else
286WRKSRC?=		${WRKDIR}/${DISTNAME}
287.endif
288PATCHDIR?=		${.CURDIR}/patches
289SCRIPTDIR?=		${.CURDIR}/scripts
290FILESDIR?=		${.CURDIR}/files
291PKGDIR?=		${.CURDIR}/pkg
292.if defined(USE_IMAKE) || defined(USE_X11)
293PREFIX?=		${X11BASE}
294.else
295PREFIX?=		${LOCALBASE}
296.endif
297# The following 4 lines should go away as soon as the ports are all updated
298.if defined(EXEC_DEPENDS)
299BUILD_DEPENDS+=	${EXEC_DEPENDS}
300RUN_DEPENDS+=	${EXEC_DEPENDS}
301.endif
302.if defined(USE_GMAKE)
303BUILD_DEPENDS+=               gmake:${PORTSDIR}/devel/gmake
304.endif
305
306.if exists(${PORTSDIR}/../Makefile.inc)
307.include "${PORTSDIR}/../Makefile.inc"
308.endif
309
310# Don't change these!!!  These names are built into the _TARGET_USE macro,
311# there is no way to refer to them cleanly from within the macro AFAIK.
312EXTRACT_COOKIE?=	${WRKDIR}/.extract_done
313CONFIGURE_COOKIE?=	${WRKDIR}/.configure_done
314INSTALL_COOKIE?=	${WRKDIR}/.install_done
315BUILD_COOKIE?=		${WRKDIR}/.build_done
316PATCH_COOKIE?=		${WRKDIR}/.patch_done
317PACKAGE_COOKIE?=	${WRKDIR}/.package_done
318
319# How to do nothing.  Override if you, for some strange reason, would rather
320# do something.
321DO_NADA?=		/usr/bin/true
322
323# Miscellaneous overridable commands:
324GMAKE?=			gmake
325XMKMF?=			xmkmf -a
326.if exists(/sbin/md5)
327MD5?=			/sbin/md5
328.elif exists(/bin/md5)
329MD5?=			/bin/md5
330.elif exists(/usr/bin/md5)
331MD5?=			/usr/bin/md5
332.else
333MD5?=			md5
334.endif
335MD5_FILE?=		${FILESDIR}/md5
336
337MAKE_FLAGS?=	-f
338MAKEFILE?=		Makefile
339MAKE_ENV+=		PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
340
341.if exists(/usr/bin/fetch)
342FETCH_CMD?=		/usr/bin/fetch
343.else
344FETCH_CMD?=		/usr/bin/ftp
345.endif
346
347TOUCH?=			/usr/bin/touch
348TOUCH_FLAGS?=	-f
349
350PATCH?=			/usr/bin/patch
351PATCH_STRIP?=	-p0
352PATCH_DIST_STRIP?=	-p0
353.if defined(PATCH_DEBUG)
354PATCH_DEBUG_TMP=	yes
355PATCH_ARGS?=	-d ${WRKSRC} -E ${PATCH_STRIP}
356PATCH_DIST_ARGS?=	-d ${WRKSRC} -E ${PATCH_DIST_STRIP}
357.else
358PATCH_DEBUG_TMP=	no
359PATCH_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
360PATCH_DIST_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
361.endif
362.if defined(BATCH)
363PATCH_ARGS+=		--batch
364PATCH_DIST_ARGS+=	--batch
365.endif
366
367.if defined(PATCH_CHECK_ONLY)
368PATCH_ARGS+=	-C
369PATCH_DIST_ARGS+=	-C
370.endif
371
372.if exists(/bin/tar)
373EXTRACT_CMD?=	/bin/tar
374.else
375EXTRACT_CMD?=	/usr/bin/tar
376.endif
377EXTRACT_SUFX?=	.tar.gz
378# Backwards compatability.
379.if defined(EXTRACT_ARGS)
380EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
381.else
382EXTRACT_BEFORE_ARGS?=   -xzf
383.endif
384
385# Figure out where the local mtree file is
386.if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist)
387MTREE_LOCAL=	/etc/mtree/BSD.local.dist
388.endif
389MTREE_CMD?=	/usr/sbin/mtree
390MTREE_ARGS?=	-U -f ${MTREE_LOCAL} -d -e -p
391.if defined(USE_X11) || defined(USE_IMAKE) || !defined(MTREE_LOCAL)
392NO_MTREE=	yes
393.endif
394
395# A few aliases for *-install targets
396INSTALL_PROGRAM= \
397	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
398INSTALL_SCRIPT= \
399	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
400INSTALL_DATA= \
401	${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
402INSTALL_MAN= \
403	${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
404
405INSTALL_MACROS=	BSD_INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
406			BSD_INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
407			BSD_INSTALL_DATA="${INSTALL_DATA}" \
408			BSD_INSTALL_MAN="${INSTALL_MAN}"
409MAKE_ENV+=	${INSTALL_MACROS}
410SCRIPTS_ENV+=	${INSTALL_MACROS}
411
412# The user can override the NO_PACKAGE by specifying this from
413# the make command line
414.if defined(FORCE_PACKAGE)
415.undef NO_PACKAGE
416.endif
417
418PLIST?=		${PKGDIR}/PLIST
419
420PKG_CMD?=		/usr/sbin/pkg_create
421.if !defined(PKG_ARGS)
422PKG_ARGS=		-v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PLIST} -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
423.if exists(${PKGDIR}/INSTALL)
424PKG_ARGS+=		-i ${PKGDIR}/INSTALL
425.endif
426.if exists(${PKGDIR}/DEINSTALL)
427PKG_ARGS+=		-k ${PKGDIR}/DEINSTALL
428.endif
429.if exists(${PKGDIR}/REQ)
430PKG_ARGS+=		-r ${PKGDIR}/REQ
431.endif
432.if exists(${PKGDIR}/MESSAGE)
433PKG_ARGS+=		-D ${PKGDIR}/MESSAGE
434.endif
435.if !defined(NO_MTREE) && defined(MTREE_LOCAL)
436PKG_ARGS+=		-m ${MTREE_LOCAL}
437.endif
438.endif
439PKG_SUFX?=		.tgz
440# where pkg_add records its dirty deeds.
441PKG_DBDIR?=		/var/db/pkg
442
443# shared/dynamic motif libs
444.if defined(HAVE_MOTIF)
445.if defined(MOTIF_STATIC)
446MOTIFLIB?=	${X11BASE}/lib/libXm.a
447.else
448MOTIFLIB?=	-L${X11BASE}/lib -lXm
449.endif
450.endif
451
452AWK?=		/usr/bin/awk
453BASENAME?=	/usr/bin/basename
454CAT?=		/bin/cat
455CP?=		/bin/cp
456ECHO?=		/bin/echo
457FALSE?=		/usr/bin/false
458GREP?=		/usr/bin/grep
459GUNZIP_CMD?=	/usr/bin/gunzip -f
460GZCAT?=		/usr/bin/gzcat
461GZIP?=		-9
462GZIP_CMD?=	/usr/bin/gzip -nf ${GZIP}
463LDCONFIG?=	/sbin/ldconfig
464MKDIR?=		/bin/mkdir -p
465MV?=		/bin/mv
466RM?=		/bin/rm
467RMDIR?=		/bin/rmdir
468SED?=		/usr/bin/sed
469SETENV?=	/usr/bin/env
470TR?=		/usr/bin/tr
471
472# Used to print all the '===>' style prompts - override this to turn them off.
473ECHO_MSG?=		${ECHO}
474
475ALL_TARGET?=		all
476INSTALL_TARGET?=	install
477
478# Popular master sites
479MASTER_SITE_XCONTRIB?=	\
480	ftp://ftp.x.org/contrib/${MASTER_SITE_SUBDIR}/ \
481	ftp://crl.dec.com/pub/X11/contrib/${MASTER_SITE_SUBDIR}/
482
483MASTER_SITE_GNU?=	\
484	ftp://prep.ai.mit.edu/pub/gnu/${MASTER_SITE_SUBDIR}/ \
485	ftp://wuarchive.wustl.edu/systems/gnu/${MASTER_SITE_SUBDIR}/
486
487MASTER_SITE_PERL_CPAN?=	\
488	ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/${MASTER_SITE_SUBDIR}/ \
489	ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/${MASTER_SITE_SUBDIR}/
490
491MASTER_SITE_TEX_CTAN?=  \
492        ftp://ftp.cdrom.com/pub/tex/ctan/${MASTER_SITE_SUBDIR}/  \
493        ftp://wuarchive.wustl.edu/packages/TeX/${MASTER_SITE_SUBDIR}/  \
494        ftp://ftp.funet.fi/pub/TeX/CTAN/${MASTER_SITE_SUBDIR}/  \
495        ftp://ftp.tex.ac.uk/public/ctan/tex-archive/${MASTER_SITE_SUBDIR}/  \
496        ftp://ftp.dante.de/tex-archive/${MASTER_SITE_SUBDIR}/
497
498MASTER_SITE_SUNSITE?=	\
499	ftp://sunsite.unc.edu/pub/Linux/${MASTER_SITE_SUBDIR}/ \
500	ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/${MASTER_SITE_SUBDIR}/ \
501	ftp://ftp.funet.fi/pub/mirrors/sunsite.unc.edu/pub/Linux/${MASTER_SITE_SUBDIR}/
502
503# The primary backup site.
504MASTER_SITE_BACKUP?=	\
505	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
506
507# If the user has this set, go to the FreeBSD repository for everything.
508.if defined(MASTER_SITE_FREEBSD)
509MASTER_SITE_OVERRIDE=  ${MASTER_SITE_BACKUP}
510.endif
511
512# Empty declaration to avoid "variable MASTER_SITES recursive" error
513MASTER_SITES?=
514PATCH_SITES?=
515# I guess we're in the master distribution business! :)  As we gain mirror
516# sites for distfiles, add them to this list.
517.if !defined(MASTER_SITE_OVERRIDE)
518MASTER_SITES+=	${MASTER_SITE_BACKUP}
519PATCH_SITES+=	${MASTER_SITE_BACKUP}
520.else
521MASTER_SITES:=	${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
522PATCH_SITES:=	${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
523.endif
524
525# Search CDROM first if mounted, symlink instead of copy if
526# FETCH_SYMLINK_DISTFILES is set
527.if exists(/cdrom/ports/distfiles)
528MASTER_SITES:=	file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
529PATCH_SITES:=	file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
530.if defined(FETCH_SYMLINK_DISTFILES)
531FETCH_BEFORE_ARGS+=	-l
532.endif
533.endif
534
535# Derived names so that they're easily overridable.
536DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
537PKGNAME?=		${DISTNAME}
538
539ALLFILES?=	${DISTFILES} ${PATCHFILES}
540
541.if defined(IGNOREFILES)
542CKSUMFILES!=	\
543	for file in ${ALLFILES}; do \
544		ignore=0; \
545		for tmp in ${IGNOREFILES}; do \
546			if [ "$$file" = "$$tmp" ]; then \
547				ignore=1; \
548			fi; \
549		done; \
550		if [ "$$ignore" = 0 ]; then \
551			echo "$$file"; \
552		fi; \
553	done
554.else
555CKSUMFILES=		${ALLFILES}
556.endif
557
558# List of all files, with ${DIST_SUBDIR} in front.  Used for checksum.
559.if defined(DIST_SUBDIR)
560_CKSUMFILES?=	${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
561_IGNOREFILES?=	${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
562.else
563_CKSUMFILES?=	${CKSUMFILES}
564_IGNOREFILES?=	${IGNOREFILES}
565.endif
566
567# This is what is actually going to be extracted, and is overridable
568#  by user.
569EXTRACT_ONLY?=	${DISTFILES}
570
571# Documentation
572MAINTAINER?=	ports@FreeBSD.ORG
573
574.if !defined(CATEGORIES)
575.BEGIN:
576	@${ECHO_MSG} "CATEGORIES is mandatory."
577	@${FALSE}
578.endif
579
580# Note this has to start with a capital letter (or more accurately, it
581#  shouldn't match "[a-z]*"), see the target "delete-package-links" below.
582PKGREPOSITORYSUBDIR?=	All
583PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
584.if exists(${PACKAGES})
585PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
586.else
587PKGFILE?=		${PKGNAME}${PKG_SUFX}
588.endif
589
590CONFIGURE_SCRIPT?=	configure
591
592.if defined(GNU_CONFIGURE)
593CONFIGURE_ARGS+=	--prefix=${PREFIX}
594HAS_CONFIGURE=		yes
595.endif
596
597# Passed to most of script invocations
598SCRIPTS_ENV+=	CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
599		  WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
600		  SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
601		  PORTSDIR=${PORTSDIR} DEPENDS="${DEPENDS}" \
602		  PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
603
604.if defined(BATCH)
605SCRIPTS_ENV+=	BATCH=yes
606.endif
607
608MANPREFIX?=	${PREFIX}
609
610.for sect in 1 2 3 4 5 6 7 8 9
611MAN${sect}PREFIX?=	${MANPREFIX}
612.endfor
613MANLPREFIX?=	${MANPREFIX}
614MANNPREFIX?=	${MANPREFIX}
615
616MANLANG?=	""	# english only by default
617
618.for lang in ${MANLANG}
619
620.for sect in 1 2 3 4 5 6 7 8 9
621.if defined(MAN${sect})
622_MANPAGES+=	${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%}
623.endif
624.endfor
625
626.if defined(MANL)
627_MANPAGES+=	${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%}
628.endif
629
630.if defined(MANN)
631_MANPAGES+=	${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
632.endif
633
634.endfor
635
636.if defined(_MANPAGES) && defined(MANCOMPRESSED)
637_MANPAGES:=	${_MANPAGES:S/$/.gz/}
638.endif
639
640.MAIN: all
641
642################################################################
643# Many ways to disable a port.
644#
645# If we're in BATCH mode and the port is interactive, or we're
646# in interactive mode and the port is non-interactive, skip all
647# the important targets.  The reason we have two modes is that
648# one might want to leave a build in BATCH mode running
649# overnight, then come back in the morning and do _only_ the
650# interactive ones that required your intervention.
651#
652# Don't attempt to build ports that require Motif if you don't
653# have Motif.
654#
655# Ignore ports that can't be resold if building for a CDROM.
656#
657# Don't build a port if it's restricted and we don't want to get
658# into that.
659#
660# Don't build a port if it's broken.
661################################################################
662
663.if !defined(NO_IGNORE)
664.if (defined(IS_INTERACTIVE) && defined(BATCH))
665IGNORE=	"is an interactive port"
666.elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
667IGNORE=	"is not an interactive port"
668.elif (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF))
669IGNORE=	"requires Motif"
670.elif (defined(MOTIF_ONLY) && !defined(REQUIRES_MOTIF))
671IGNORE=	"does not require Motif"
672.elif (defined(NO_CDROM) && defined(FOR_CDROM))
673IGNORE=	"may not be placed on a CDROM: ${NO_CDROM}"
674.elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
675IGNORE=	"is restricted: ${RESTRICTED}"
676.elif defined(BROKEN)
677IGNORE=	"is marked as broken: ${BROKEN}"
678.endif
679
680.if defined(IGNORE)
681.if defined(IGNORE_SILENT)
682IGNORECMD=	${DO_NADA}
683.else
684IGNORECMD=	${ECHO_MSG} "===>  ${PKGNAME} ${IGNORE}."
685.endif
686fetch:
687	@${IGNORECMD}
688checksum:
689	@${IGNORECMD}
690extract:
691	@${IGNORECMD}
692patch:
693	@${IGNORECMD}
694configure:
695	@${IGNORECMD}
696all:
697	@${IGNORECMD}
698build:
699	@${IGNORECMD}
700install:
701	@${IGNORECMD}
702package:
703	@${IGNORECMD}
704.endif
705.endif
706
707.if defined(ALL_HOOK)
708all:
709	@cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
710	  DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
711	  PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
712	  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
713	  DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
714	  RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
715	${ALL_HOOK}
716.endif
717
718.if !target(all)
719all: build
720.endif
721
722.if !defined(IS_DEPENDED_TARGET)
723IS_DEPENDED_TARGET=	install
724.endif
725
726.if !target(is_depended)
727is_depended:	${IS_DEPENDED_TARGET}
728.endif
729
730################################################################
731# The following are used to create easy dummy targets for
732# disabling some bit of default target behavior you don't want.
733# They still check to see if the target exists, and if so don't
734# do anything, since you might want to set this globally for a
735# group of ports in a Makefile.inc, but still be able to
736# override from an individual Makefile.
737################################################################
738
739# Disable checksum
740.if defined(NO_CHECKSUM) && !target(checksum)
741checksum: fetch
742	@${DO_NADA}
743.endif
744
745# Disable extract
746.if defined(NO_EXTRACT) && !target(extract)
747extract: checksum
748	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
749checksum: fetch
750	@${DO_NADA}
751makesum:
752	@${DO_NADA}
753.endif
754
755# Disable patch
756.if defined(NO_PATCH) && !target(patch)
757patch: extract
758	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
759.endif
760
761# Disable configure
762.if defined(NO_CONFIGURE) && !target(configure)
763configure: patch
764	@${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
765.endif
766
767# Disable build
768.if defined(NO_BUILD) && !target(build)
769build: configure
770	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
771.endif
772
773# Disable install
774.if defined(NO_INSTALL) && !target(install)
775install: build
776	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
777.endif
778
779# Disable package
780.if defined(NO_PACKAGE) && !target(package)
781package:
782.if defined(IGNORE_SILENT)
783	@${DO_NADA}
784.else
785	@${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
786.endif
787.endif
788
789# Disable describe
790.if defined(NO_DESCRIBE) && !target(describe)
791describe:
792	@${DO_NADA}
793.endif
794
795################################################################
796# More standard targets start here.
797#
798# These are the body of the build/install framework.  If you are
799# not happy with the default actions, and you can't solve it by
800# adding pre-* or post-* targets/scripts, override these.
801################################################################
802
803# Fetch
804
805.if !target(do-fetch)
806do-fetch:
807	@${MKDIR} ${_DISTDIR}
808	@(cd ${_DISTDIR}; \
809	 for file in ${DISTFILES}; do \
810		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
811			if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
812				${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
813				${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
814				${ECHO_MSG} ">> Please correct this problem and try again."; \
815				exit 1; \
816			fi ; \
817			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
818			for site in ${MASTER_SITES}; do \
819			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
820				if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
821					continue 2; \
822				fi \
823			done; \
824			${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
825			${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
826			exit 1; \
827	    fi \
828	 done)
829.if defined(PATCHFILES)
830	@(cd ${_DISTDIR}; \
831	 for file in ${PATCHFILES}; do \
832		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
833			if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
834				${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
835				${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
836				${ECHO_MSG} ">> Please correct this problem and try again."; \
837				exit 1; \
838			fi ; \
839			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
840			for site in ${PATCH_SITES}; do \
841			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
842				if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
843					continue 2; \
844				fi \
845			done; \
846			${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
847			${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
848			exit 1; \
849	    fi \
850	 done)
851.endif
852.endif
853
854# Extract
855
856.if !target(do-extract)
857do-extract:
858.if !defined(NO_WRKDIR)
859	@${RM} -rf ${WRKDIR}
860	@${MKDIR} ${WRKDIR}
861.endif
862	@for file in ${EXTRACT_ONLY}; do \
863		if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
864		then \
865			exit 1; \
866		fi \
867	done
868.endif
869
870# Patch
871
872.if !target(do-patch)
873do-patch:
874.if defined(PATCHFILES)
875	@${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
876	@(cd ${_DISTDIR}; \
877	  for i in ${PATCHFILES}; do \
878		if [ ${PATCH_DEBUG_TMP} = yes ]; then \
879			${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
880		fi; \
881		case $$i in \
882			*.Z|*.gz) \
883				${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
884				;; \
885			*) \
886				${PATCH} ${PATCH_DIST_ARGS} < $$i; \
887				;; \
888		esac; \
889	  done)
890.endif
891	@if [ -d ${PATCHDIR} ]; then \
892		if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
893			${ECHO_MSG} "===>   Ignoring empty patch directory"; \
894			if [ -d ${PATCHDIR}/CVS ]; then \
895				${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
896			fi; \
897		else \
898			${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
899			for i in ${PATCHDIR}/patch-*; do \
900				case $$i in \
901					*.orig|*.rej|*~) \
902						${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
903						;; \
904					*) \
905						if [ ${PATCH_DEBUG_TMP} = yes ]; then \
906							${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
907						fi; \
908						${PATCH} ${PATCH_ARGS} < $$i; \
909						;; \
910				esac; \
911			done; \
912		fi; \
913	fi
914.endif
915
916# Configure
917
918.if !target(do-configure)
919do-configure:
920	@if [ -f ${SCRIPTDIR}/configure ]; then \
921		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} /bin/sh \
922		  ${SCRIPTDIR}/configure; \
923	fi
924.if defined(HAS_CONFIGURE)
925	@(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
926	    INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
927	    INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
928	    ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
929.endif
930.if defined(USE_IMAKE)
931	@(cd ${WRKSRC} && ${XMKMF})
932.endif
933.endif
934
935# Build
936
937.if !target(do-build)
938do-build:
939.if defined(USE_GMAKE)
940	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
941.else defined(USE_GMAKE)
942	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
943.endif
944.endif
945
946# Install
947
948.if !target(do-install)
949do-install:
950	@if [ `/bin/sh -c umask` != 0022 ]; then \
951		${ECHO_MSG} "===>  Warning: your umask is \"`/bin/sh -c umask`"\".; \
952		${ECHO_MSG} "      If this is not desired, set it to an appropriate value"; \
953		${ECHO_MSG} "      and install this port again by \`\`make reinstall''."; \
954	fi
955.if defined(USE_GMAKE)
956	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
957.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
958	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
959.endif
960.else defined(USE_GMAKE)
961	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
962.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
963	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
964.endif
965.endif
966.endif
967
968# Package
969
970.if !target(do-package)
971do-package:
972	@if [ -e ${PLIST} ]; then \
973		${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
974		if [ -d ${PACKAGES} ]; then \
975			if [ ! -d ${PKGREPOSITORY} ]; then \
976				if ! ${MKDIR} ${PKGREPOSITORY}; then \
977					${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
978					exit 1; \
979				fi; \
980			fi; \
981		fi; \
982		if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
983			if [ -d ${PACKAGES} ]; then \
984				${MAKE} ${.MAKEFLAGS} package-links; \
985			fi; \
986		else \
987			${MAKE} ${.MAKEFLAGS} delete-package; \
988			exit 1; \
989		fi; \
990	fi
991.endif
992
993# Some support rules for do-package
994
995.if !target(package-links)
996package-links:
997	@${MAKE} ${.MAKEFLAGS} delete-package-links
998	@for cat in ${CATEGORIES}; do \
999		if [ ! -d ${PACKAGES}/$$cat ]; then \
1000			if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1001				${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
1002				exit 1; \
1003			fi; \
1004		fi; \
1005		ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
1006	done;
1007.endif
1008
1009.if !target(delete-package-links)
1010delete-package-links:
1011	@${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
1012.endif
1013
1014.if !target(delete-package)
1015delete-package:
1016	@${MAKE} ${.MAKEFLAGS} delete-package-links
1017	@${RM} -f ${PKGFILE}
1018.endif
1019
1020################################################################
1021# This is the "generic" port target, actually a macro used from the
1022# six main targets.  See below for more.
1023################################################################
1024
1025_PORT_USE: .USE
1026.if make(real-fetch)
1027	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1028.endif
1029.if make(real-extract)
1030	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1031.endif
1032.if make(real-install)
1033.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
1034	@if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1035		${ECHO_MSG} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
1036		${ECHO_MSG} "      If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
1037		${ECHO_MSG} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
1038		${ECHO_MSG} "      If you really wish to overwrite the old port of ${PKGNAME}"; \
1039		${ECHO_MSG} "      without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
1040		${ECHO_MSG} "      in your environment or the \"make install\" command line."; \
1041		exit 1; \
1042	fi
1043.endif
1044	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1045.endif
1046.if make(real-install)
1047.if !defined(NO_MTREE)
1048	@if [ `id -u` = 0 ]; then \
1049		${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
1050	else \
1051		${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
1052		${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
1053	fi
1054.endif
1055.endif
1056	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1057	@if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1058		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} /bin/sh \
1059			${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
1060	fi
1061	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
1062	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1063	@if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1064		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} /bin/sh \
1065			${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
1066	fi
1067.if make(real-install) && defined(_MANPAGES)
1068.if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS)
1069	@${ECHO_MSG} "===>   Uncompressing manual pages for ${PKGNAME}"
1070.for manpage in ${_MANPAGES}
1071	@${GUNZIP_CMD} ${manpage}
1072.endfor
1073.elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS)
1074	@${ECHO_MSG} "===>   Compressing manual pages for ${PKGNAME}"
1075.for manpage in ${_MANPAGES}
1076	@${GZIP_CMD} ${manpage}
1077.endfor
1078.endif
1079.endif
1080.if make(real-install) && !defined(NO_PKG_REGISTER)
1081	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1082.endif
1083.if !make(real-fetch) \
1084	&& (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
1085	&& (!make(real-package) || !defined(PACKAGE_NOINSTALL))
1086	@${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
1087.endif
1088
1089################################################################
1090# Skeleton targets start here
1091#
1092# You shouldn't have to change these.  Either add the pre-* or
1093# post-* targets/scripts or redefine the do-* targets.  These
1094# targets don't do anything other than checking for cookies and
1095# call the necessary targets/scripts.
1096################################################################
1097
1098.if !target(fetch)
1099fetch:
1100	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1101.endif
1102
1103.if !target(extract)
1104extract: checksum ${EXTRACT_COOKIE}
1105.endif
1106
1107.if !target(patch)
1108patch: extract ${PATCH_COOKIE}
1109.endif
1110
1111.if !target(configure)
1112configure: patch ${CONFIGURE_COOKIE}
1113.endif
1114
1115.if !target(build)
1116build: configure ${BUILD_COOKIE}
1117.endif
1118
1119.if !target(install)
1120install: build ${INSTALL_COOKIE}
1121.endif
1122
1123.if !target(package)
1124package: install ${PACKAGE_COOKIE}
1125.endif
1126
1127${EXTRACT_COOKIE}:
1128	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1129${PATCH_COOKIE}:
1130	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1131${CONFIGURE_COOKIE}:
1132	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1133${BUILD_COOKIE}:
1134	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1135${INSTALL_COOKIE}:
1136	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1137${PACKAGE_COOKIE}:
1138	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1139
1140# And call the macros
1141
1142real-fetch: _PORT_USE
1143real-extract: _PORT_USE
1144	@${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
1145real-patch: _PORT_USE
1146	@${ECHO_MSG} "===>  Patching for ${PKGNAME}"
1147real-configure: _PORT_USE
1148	@${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
1149real-build: _PORT_USE
1150	@${ECHO_MSG} "===>  Building for ${PKGNAME}"
1151real-install: _PORT_USE
1152	@${ECHO_MSG} "===>  Installing for ${PKGNAME}"
1153real-package: _PORT_USE
1154
1155# Empty pre-* and post-* targets, note we can't use .if !target()
1156# in the _PORT_USE macro
1157
1158.for name in fetch extract patch configure build install package
1159
1160.if !target(pre-${name})
1161pre-${name}:
1162	@${DO_NADA}
1163.endif
1164
1165.if !target(post-${name})
1166post-${name}:
1167	@${DO_NADA}
1168.endif
1169
1170.endfor
1171
1172# Checkpatch
1173#
1174# Special target to verify patches
1175
1176.if !target(checkpatch)
1177checkpatch:
1178	@cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1179.endif
1180
1181# Reinstall
1182#
1183# Special target to re-run install
1184
1185.if !target(reinstall)
1186reinstall: pre-reinstall install
1187
1188pre-reinstall:
1189	@${RM} -f ${INSTALL_COOKIE}
1190	@${RM} -f ${PACKAGE_COOKIE}
1191.endif
1192
1193################################################################
1194# Some more targets supplied for users' convenience
1195################################################################
1196
1197# Cleaning up
1198
1199.if !target(pre-clean)
1200pre-clean:
1201	@${DO_NADA}
1202.endif
1203
1204.if !target(clean)
1205clean: pre-clean
1206.if !defined(NOCLEANDEPENDS)
1207	@${MAKE} clean-depends
1208.endif
1209	@${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
1210.if !defined(NO_WRKDIR)
1211	@if [ -d ${WRKDIR} ]; then \
1212		if [ -w ${WRKDIR} ]; then \
1213			${RM} -rf ${WRKDIR}; \
1214		else \
1215			${ECHO_MSG} "===>   ${WRKDIR} not writable, skipping"; \
1216		fi; \
1217	fi
1218.else
1219	@${RM} -f ${WRKDIR}/.*_done
1220.endif
1221.endif
1222
1223.if !target(pre-distclean)
1224pre-distclean:
1225	@${DO_NADA}
1226.endif
1227
1228.if !target(distclean)
1229distclean: pre-distclean clean
1230	@${ECHO_MSG} "===>  Dist cleaning for ${PKGNAME}"
1231	@(if [ -d ${_DISTDIR} ]; then \
1232		cd ${_DISTDIR}; \
1233		${RM} -f ${DISTFILES} ${PATCHFILES}; \
1234	fi)
1235.if defined(DIST_SUBDIR)
1236	@${RMDIR} ${_DISTDIR}
1237.endif
1238.endif
1239
1240# Prints out a list of files to fetch (useful to do a batch fetch)
1241
1242.if !target(fetch-list)
1243fetch-list:
1244	@${MKDIR} ${_DISTDIR}
1245	@(cd ${_DISTDIR}; \
1246	 for file in ${DISTFILES}; do \
1247		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1248			for site in ${MASTER_SITES}; do \
1249				${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1250					break; \
1251			done; \
1252			${ECHO} "echo $${file} not fetched" ; \
1253		fi \
1254	done)
1255.if defined(PATCHFILES)
1256	@(cd ${_DISTDIR}; \
1257	 for file in ${PATCHFILES}; do \
1258		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1259			for site in ${PATCH_SITES}; do \
1260				${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1261					break; \
1262			done; \
1263			${ECHO} "echo $${file} not fetched" ; \
1264		fi \
1265	 done)
1266.endif
1267.endif
1268
1269# Checksumming utilities
1270
1271.if !target(makesum)
1272makesum: fetch
1273	@${MKDIR} ${FILESDIR}
1274	@if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
1275	@(cd ${DISTDIR}; \
1276	 for file in ${_CKSUMFILES}; do \
1277		${MD5} $$file >> ${MD5_FILE}; \
1278	 done)
1279	@for file in ${_IGNOREFILES}; do \
1280		${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
1281	done
1282.endif
1283
1284.if !target(checksum)
1285checksum: fetch
1286	@if [ ! -f ${MD5_FILE} ]; then \
1287		${ECHO_MSG} ">> No MD5 checksum file."; \
1288	else \
1289		(cd ${DISTDIR}; OK="true"; \
1290		  for file in ${_CKSUMFILES}; do \
1291			CKSUM=`${MD5} < $$file`; \
1292			CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1293			if [ "$$CKSUM2" = "" ]; then \
1294				${ECHO_MSG} ">> No checksum recorded for $$file."; \
1295				OK="false"; \
1296			elif [ "$$CKSUM2" = "IGNORE" ]; then \
1297				${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
1298				${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
1299				OK="false"; \
1300			elif [ "$$CKSUM" = "$$CKSUM2" ]; then \
1301				${ECHO_MSG} ">> Checksum OK for $$file."; \
1302			else \
1303				${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1304				OK="false"; \
1305			fi; \
1306		  done; \
1307		  for file in ${_IGNOREFILES}; do \
1308			CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1309			if [ "$$CKSUM2" = "" ]; then \
1310				${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
1311				OK="false"; \
1312			elif [ "$$CKSUM2" != "IGNORE" ]; then \
1313				${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
1314				${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
1315				OK="false"; \
1316			fi; \
1317		  done; \
1318		  if [ "$$OK" != "true" ]; then \
1319			${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
1320			${ECHO_MSG} "are up to date.  If you want to override this check, type"; \
1321			${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \
1322			exit 1; \
1323		  fi) ; \
1324	fi
1325.endif
1326
1327################################################################
1328# The special package-building targets
1329# You probably won't need to touch these
1330################################################################
1331
1332# Nobody should want to override this unless PKGNAME is simply bogus.
1333
1334.if !target(package-name)
1335package-name:
1336	@${ECHO} ${PKGNAME}
1337.endif
1338
1339# Show (recursively) all the packages this package depends on.
1340
1341.if !target(package-depends)
1342package-depends:
1343	@for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
1344		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1345		if [ -d $$dir ]; then \
1346			(cd $$dir ; ${MAKE} package-name package-depends); \
1347		else \
1348			${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
1349		fi; \
1350	done
1351.endif
1352
1353# Build a package but don't check the package cookie
1354
1355.if !target(repackage)
1356repackage: pre-repackage package
1357
1358pre-repackage:
1359	@${RM} -f ${PACKAGE_COOKIE}
1360.endif
1361
1362# Build a package but don't check the cookie for installation, also don't
1363# install package cookie
1364
1365.if !target(package-noinstall)
1366package-noinstall:
1367	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1368.endif
1369
1370################################################################
1371# Dependency checking
1372################################################################
1373
1374.if !target(depends)
1375depends: lib-depends misc-depends
1376	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1377	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
1378	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1379
1380.if make(fetch-depends)
1381DEPENDS_TMP+=	${FETCH_DEPENDS}
1382.endif
1383
1384.if make(build-depends)
1385DEPENDS_TMP+=	${BUILD_DEPENDS}
1386.endif
1387
1388.if make(run-depends)
1389DEPENDS_TMP+=	${RUN_DEPENDS}
1390.endif
1391
1392_DEPENDS_USE:	.USE
1393.if defined(DEPENDS_TMP)
1394.if defined(NO_DEPENDS)
1395# Just print out messages
1396	@for i in ${DEPENDS_TMP}; do \
1397		prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1398		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1399		if expr "$$prog" : \\/ >/dev/null; then \
1400			${ECHO_MSG} "===>  ${PKGNAME} depends on file:  $$prog ($$dir)"; \
1401		else \
1402			${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
1403		fi; \
1404	done
1405.else
1406	@for i in ${DEPENDS_TMP}; do \
1407		prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1408		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1409		if expr "$$prog" : \\/ >/dev/null; then \
1410			if [ -e "$$prog" ]; then \
1411				${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - found"; \
1412				notfound=0; \
1413			else \
1414				${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - not found"; \
1415				notfound=1; \
1416			fi; \
1417		else \
1418			if which "$$prog" > /dev/null 2>&1 ; then \
1419				${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
1420				notfound=0; \
1421			else \
1422				${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
1423				notfound=1; \
1424			fi; \
1425		fi; \
1426		if [ $$notfound != 0 ]; then \
1427			${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \
1428			if [ ! -d "$$dir" ]; then \
1429				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
1430			else \
1431				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1432				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
1433			fi; \
1434		fi; \
1435	done
1436.endif
1437.else
1438	@${DO_NADA}
1439.endif
1440
1441fetch-depends:	_DEPENDS_USE
1442build-depends:	_DEPENDS_USE
1443run-depends:	_DEPENDS_USE
1444
1445lib-depends:
1446.if defined(LIB_DEPENDS)
1447.if defined(NO_DEPENDS)
1448# Just print out messages
1449	@for i in ${LIB_DEPENDS}; do \
1450		lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1451		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1452		${ECHO_MSG} "===>  ${PKGNAME} depends on shared library:  $$lib ($$dir)"; \
1453	done
1454.else
1455	@for i in ${LIB_DEPENDS}; do \
1456		lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1457		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1458		if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \
1459			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \
1460		else \
1461			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \
1462			${ECHO_MSG} "===>  Verifying build for $$lib in $$dir"; \
1463			if [ ! -d "$$dir" ]; then \
1464				${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
1465			else \
1466				(cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1467				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
1468			fi; \
1469		fi; \
1470	done
1471.endif
1472.else
1473	@${DO_NADA}
1474.endif
1475
1476misc-depends:
1477.if defined(DEPENDS)
1478	@${ECHO_MSG} "===>  ${PKGNAME} depends on:  ${DEPENDS}"
1479.if !defined(NO_DEPENDS)
1480	@for i in ${DEPENDS}; do \
1481		${ECHO_MSG} "===>  Verifying build for $$i"; \
1482		if [ ! -d $$i ]; then \
1483			${ECHO_MSG} ">> No directory for $$i.  Skipping.."; \
1484		else \
1485			(cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1486		fi \
1487	done
1488	@${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
1489.endif
1490.else
1491	@${DO_NADA}
1492.endif
1493
1494.endif
1495
1496.if !target(clean-depends)
1497clean-depends:
1498.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
1499	|| defined(RUN_DEPENDS)
1500	@for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/.*://' | sort -u`; do \
1501		if [ -d $$dir ] ; then \
1502			(cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1503		fi \
1504	done
1505.endif
1506.if defined(DEPENDS)
1507	@for dir in ${DEPENDS}; do \
1508		if [ -d $$dir ] ; then \
1509			(cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1510		fi \
1511	done
1512.endif
1513.endif
1514
1515.if !target(depends-list)
1516depends-list:
1517	@for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}; do \
1518		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1519		(cd $$dir; ${MAKE} package-name depends-list); \
1520	done
1521	@for dir in ${DEPENDS}; do \
1522		(cd $$dir; ${MAKE} package-name depends-list); \
1523	done
1524.endif
1525
1526################################################################
1527# Everything after here are internal targets and really
1528# shouldn't be touched by anybody but the release engineers.
1529################################################################
1530
1531# This target generates an index entry suitable for aggregation into
1532# a large index.  Format is:
1533#
1534# distribution-name|port-path|installation-prefix|comment| \
1535#  description-file|maintainer|categories|build deps|run deps
1536#
1537.if !target(describe)
1538describe:
1539	@${ECHO} -n "${PKGNAME}|${.CURDIR}|"
1540	@${ECHO} -n "${PREFIX}|"
1541	@if [ -f ${PKGDIR}/COMMENT ]; then \
1542		${ECHO} -n "`${CAT} ${PKGDIR}/COMMENT`"; \
1543	else \
1544		${ECHO} -n "** No Description"; \
1545	fi
1546	@if [ -f ${PKGDIR}/DESCR ]; then \
1547		${ECHO} -n "|${PKGDIR}/DESCR"; \
1548	else \
1549		${ECHO} -n "|/dev/null"; \
1550	fi
1551	@${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"
1552	@cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`
1553	@${ECHO} -n "|"
1554	@cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`
1555	@${ECHO} ""
1556.endif
1557
1558.if !target(readmes)
1559readmes:	readme
1560.endif
1561
1562.if !target(readme)
1563readme:
1564	@rm -f README.html
1565	@cd ${.CURDIR} && make README.html
1566.endif
1567
1568README.html:
1569	@${ECHO_MSG} "===>  Creating README.html for ${PKGNAME}"
1570	@${CAT} ${TEMPLATES}/README.port | \
1571		${SED} -e 's%%PORT%%'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'g' \
1572			-e 's%%PKG%%${PKGNAME}g' \
1573			-e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
1574			-e '/%%COMMENT%%/d' \
1575			-e 's%%BUILD_DEPENDS%%'"`${MAKE} print-depends-list`"'' \
1576			-e 's%%RUN_DEPENDS%%'"`${MAKE} print-package-depends`"'' \
1577		>> $@
1578
1579.if !target(print-depends-list)
1580print-depends-list:
1581.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
1582	defined(LIB_DEPENDS) || defined(DEPENDS)
1583	@${ECHO} -n 'This port requires package(s) "'
1584	@${ECHO} -n `make depends-list | sort -u`
1585	@${ECHO} '" to build.'
1586.endif
1587.endif
1588
1589.if !target(print-package-depends)
1590print-package-depends:
1591.if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
1592	@${ECHO} -n 'This port requires package(s) "'
1593	@${ECHO} -n `make package-depends | sort -u`
1594	@${ECHO} '" to run.'
1595.endif
1596.endif
1597
1598# Fake installation of package so that user can pkg_delete it later.
1599# Also, make sure that an installed port is recognized correctly in
1600# accordance to the @pkgdep directive in the packing lists
1601
1602.if !target(fake-pkg)
1603fake-pkg:
1604	@if [ ! -f ${PLIST} -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
1605	@if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
1606.if defined(FORCE_PKG_REGISTER)
1607	@${RM} -rf ${PKG_DBDIR}/${PKGNAME}
1608.endif
1609	@if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1610		${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \
1611		${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
1612		${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1613		${CP} ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \
1614		${CP} ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1615		if [ -f ${PKGDIR}/INSTALL ]; then \
1616			${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
1617		fi; \
1618		if [ -f ${PKGDIR}/DEINSTALL ]; then \
1619			${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
1620		fi; \
1621		if [ -f ${PKGDIR}/REQ ]; then \
1622			${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
1623		fi; \
1624		for dep in `make package-depends ECHO_MSG=/usr/bin/true | sort -u`; do \
1625			if [ -d ${PKG_DBDIR}/$$dep ]; then \
1626				if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
1627					>/dev/null 2>&1; then \
1628					${ECHO} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \
1629				fi; \
1630			fi; \
1631		done; \
1632	fi
1633.endif
1634
1635# Depend is generally meaningless for arbitrary ports, but if someone wants
1636# one they can override this.  This is just to catch people who've gotten into
1637# the habit of typing `make depend all install' as a matter of course.
1638#
1639.if !target(depend)
1640depend:
1641.endif
1642
1643# Same goes for tags
1644.if !target(tags)
1645tags:
1646.endif
1647