xref: /freebsd/share/mk/bsd.port.mk (revision 218515c5f87bb92f680fdf3324356f598d9eb69c)
1#-*- mode: Fundamental; tab-width: 4; -*-
2# ex:ts=4
3#
4#	$Id: bsd.port.mk,v 1.295 1998/11/08 10:29:52 asami 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# There are two different types of "maintainers" in the whole ports
13# framework concept.  Maintainers of the bsd.port*.mk files
14# are listed below in the ${OPSYS}_MAINTAINER entries (this file
15# is used by multiple *BSD flavors).  You should consult them directly
16# if you have any questions/suggestions regarding this file since only
17# they are allowed to modify the master copies in the CVS repository!
18
19FreeBSD_MAINTAINER=	asami@FreeBSD.ORG
20OpenBSD_MAINTAINER=	imp@OpenBSD.ORG
21
22# For each port, the MAINTAINER variable is what you should consult for
23# contact information on the person(s) to contact if you have questions/
24# suggestions about that specific port.  By default (if no MAINTAINER
25# is listed), a port is maintained by the subscribers of the ports@freebsd.org
26# mailing list, and any correspondece should be directed there.
27#
28# MAINTAINER	- The e-mail address of the contact person for this port
29#				  (default: ports@FreeBSD.ORG).
30#
31# These are meta-variables that are automatically set to the system
32# you are running on.
33#
34# ARCH			- The architecture, as returned by "uname -m".
35# OPSYS			- Portability clause.  This is the operating system the
36#				  makefile is being used on.  Automatically set to
37#				  "FreeBSD," "NetBSD," or "OpenBSD" as appropriate.
38# OSREL			- The release version (numeric) of the operating system.
39# OSVERSION		- The value of __FreeBSD_version.
40# PORTOBJFORMAT	- The object format ("aout" or "elf").
41#
42# These variables are used to identify your port.
43#
44# DISTNAME		- Name of port or distribution.
45# PKGNAME		- Name of the package file to create if the DISTNAME
46#				  isn't really relevant for the port/package
47#				  (default: ${DISTNAME}).
48# CATEGORIES	- A list of descriptive categories into which this port falls.
49#
50# These variable describe how to fetch files required for building the port.
51#
52# DISTFILES		- Name(s) of archive file(s) containing distribution
53#				  (default: ${DISTNAME}${EXTRACT_SUFX}).  Set this to
54#				  an empty string if the port doesn't require it.
55# EXTRACT_SUFX	- Suffix for archive names (default: .tar.gz).  You
56#				  never have to set both DISTFILES and EXTRACT_SUFX.
57# MASTER_SITES	- Primary location(s) for distribution files if not found
58#				  locally.
59# PATCHFILES	- Name(s) of additional files that contain distribution
60#				  patches (default: none).  make will look for them at
61#				  PATCH_SITES (see below).  They will automatically be
62#				  uncompressed before patching if the names end with
63#				  ".gz" or ".Z".
64# PATCH_SITES	- Primary location(s) for distribution patch files
65#				  if not found locally.
66# DIST_SUBDIR	- Suffix to ${DISTDIR}.  If set, all ${DISTFILES}
67#				  and ${PATCHFILES} will be put in this subdirectory of
68#				  ${DISTDIR} (see below).  Also they will be fetched in
69#				  this subdirectory from FreeBSD mirror sites.
70# ALLFILES		- All of ${DISTFILES} and ${PATCHFILES}.
71# IGNOREFILES	- If some of the ${ALLFILES} are not checksum-able, set
72#				  this variable to their names.
73# EXTRACT_ONLY	- If defined, a subset of ${DISTFILES} you want to
74#			  	  actually extract.
75#
76# These three variables are typically set in /etc/make.conf to indicate
77# the user's preferred location to fetch files from.
78#
79# MASTER_SITE_BACKUP - Backup location(s) for distribution files and patch
80#				  files if not found locally and ${MASTER_SITES}/${PATCH_SITES}
81#				  (default:
82#				  ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
83# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
84#				  value.
85# MASTER_SITE_FREEBSD - If set, only use ${MASTER_SITE_BACKUP} for
86#				  MASTER_SITES.
87#
88# Set these if your port should not be built under certain circumstances.
89# These are string variables; you should set them to the reason why
90# they are necessary.
91#
92# RESTRICTED	- Port is restricted (e.g., contains cryptography, etc.).
93# NO_CDROM		- Port may not go on CDROM.
94# NO_PACKAGE	- Port should not be packaged but distfiles can be put on
95#				  ftp sites and CDROMs.
96# BROKEN_ELF	- Port doesn't build on ELF machines.
97# BROKEN		- Port is broken.
98#
99# This variable is a boolean, so you don't need to set it to the reason.
100#
101# IS_INTERACTIVE - Set this if your port needs to interact with the user
102#				  during a build.  User can then decide to skip this port by
103#				  setting ${BATCH}, or compiling only the interactive ports
104#				  by setting ${INTERACTIVE}.
105#
106# Use these if your port uses some of the common software packages.
107#
108# USE_GMAKE		- Says that the port uses gmake.
109# GMAKE			- Set to path of GNU make if not in $PATH (default: gmake).
110# USE_AUTOCONF	- Says that the port uses autoconf.  Implies GNU_CONFIGURE.
111# AUTOCONF		- Set to path of GNU autoconf if not in $PATH (default:
112#				  autoconf).
113# USE_PERL5		- Says that the port uses perl5 for building and running.
114# PERL5			- Set to full path of perl5, either in the system or
115#				  installed from a port.
116# PERL			- Set to full path of perl5, either in the system or
117#				  installed from a port, but without the version number.
118#				  Use this if you need to replace "#!" lines in scripts.
119# PERL_VERSION	- Full version of perl5 (see below for current value).
120# PERL_VER		- Short version of perl5 (see below for current value).
121# USE_IMAKE		- Says that the port uses imake.  Implies USE_X_PREFIX.
122# XMKMF			- Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
123# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
124#						target.
125# USE_X_PREFIX	- Says that the port installs in ${X11BASE}.  Implies USE_XLIB.
126# USE_XLIB		- Says that the port uses X libraries.
127# USE_QT		- Says that the port uses the latest version of qt toolkit.
128#
129# Dependency checking.  Use these if your port requires another port
130# not in the list above.
131#
132# FETCH_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
133#				  package depends in the "fetch" stage.  "path" is the
134#				  name of a file if it starts with a slash (/), an
135#				  executable otherwise.  make will test for the
136#				  existence (if it is a full pathname) or search for
137#				  it in your $PATH (if it is an executable) and go
138#				  into "dir" to do a "make all install" if it's not
139#				  found.  If the third field ("target") exists, it will
140#				  be used instead of ${DEPENDS_TARGET}.
141# BUILD_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
142#				  package depends to build (between the "extract" and
143#				  "build" stages, inclusive).  The test done to
144#				  determine the existence of the dependency is the
145#				  same as FETCH_DEPENDS.  If the third field ("target")
146#				  exists, it will be used instead of ${DEPENDS_TARGET}.
147# RUN_DEPENDS	- A list of "path:dir[:target]" tuples 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.  If the third field
153#				  ("target") exists, it will be used instead of
154#				  ${DEPENDS_TARGET}.
155# LIB_DEPENDS	- A list of "lib:dir[:target]" tuples of other ports this
156#				  package depends on.  "lib" is the name of a shared library.
157#				  make will use "ldconfig -r" to search for the
158#				  library.  Note that lib can not contain regular expressions.
159# DEPENDS		- A list of "dir[:target]" tuples of other ports this
160#				  package depends on being made first.  Use this only for
161#				  things that don't fall into the above four categories.
162#				  If the second field ("target") exists, it will be used
163#				  instead of ${DEPENDS_TARGET}.
164# DEPENDS_TARGET - The default target to execute when a port is calling a
165#				  dependency (default: "install").
166#
167# Various directory definitions and variables to control them.
168# You rarely need to redefine any of these except WRKSRC and NO_WRKSUBDIR.
169#
170# X11BASE		- Where X11 ports install things (default: /usr/X11R6).
171# LOCALBASE		- Where non-X11 ports install things (default: /usr/local).
172# PREFIX		- Where *this* port installs its files (default: ${X11BASE}
173#				  if USE_X_PREFIX is set, otherwise ${LOCALBASE}).
174# PORTSDIR		- The root of the ports tree.  Defaults:
175#					FreeBSD/OpenBSD: /usr/ports
176#					NetBSD:          /usr/opt
177# DISTDIR 		- Where to get gzip'd, tarballed copies of original sources
178#				  (default: ${PORTSDIR}/distfiles).
179# PACKAGES		- A top level directory where all packages go (rather than
180#				  going locally to each port). (default: ${PORTSDIR}/packages).
181# WRKDIRPREFIX	- The place to root the temporary working directory
182#				  hierarchy (default: none).
183# WRKDIR 		- A temporary working directory that gets *clobbered* on clean
184#				  (default: ${WRKDIRPREFIX}${.CURDIR}/work).
185# WRKSRC		- A subdirectory of ${WRKDIR} where the distribution actually
186#				  unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
187#				  NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
188# NO_WRKSUBDIR	- Assume port unpacks directly into ${WRKDIR}.
189# NO_WRKDIR		- There's no work directory at all; port does this someplace
190#				  else.
191# PATCHDIR 		- A directory containing any additional patches you made
192#				  to port this software to FreeBSD (default:
193#				  ${.CURDIR}/patches)
194# SCRIPTDIR 	- A directory containing any auxiliary scripts
195#				  (default: ${.CURDIR}/scripts)
196# FILESDIR 		- A directory containing any miscellaneous additional files.
197#				  (default: ${.CURDIR}/files)
198# PKGDIR 		- A direction containing any package creation files.
199#				  (default: ${.CURDIR}/pkg)
200#
201# Motif support:
202#
203# REQUIRES_MOTIF - Set this in your port if it requires Motif.  It will  be
204#				  built only if HAVE_MOTIF is set.
205# HAVE_MOTIF	- If set, means system has Motif.  Typically set in
206#				  /etc/make.conf.
207# MOTIF_STATIC	- If set, link libXm statically; otherwise, link it
208#				  dynamically.  Typically set in /etc/make.conf.
209# MOTIFLIB		- Set automatically to appropriate value depending on
210#				  ${MOTIF_STATIC}.  Substitute references to -lXm with
211#				  patches to make your port conform to our standards.
212# MOTIF_ONLY	- If set, build Motif ports only.  (Not much use except for
213#				  building packages.)
214#
215# Variables that serve as convenient "aliases" for your *-install targets.
216# Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".
217#
218# INSTALL_PROGRAM - A command to install binary executables.
219# INSTALL_SCRIPT - A command to install executable scripts.
220# INSTALL_DATA	- A command to install sharable data.
221# INSTALL_MAN	- A command to install manpages (doesn't compress).
222#
223# Set the following to specify all manpages that your port installs.
224# These manpages will be automatically listed in ${PLIST}.  Depending
225# on the setting of NOMANCOMPRESS, the make rules will compress the
226# manpages for you.
227#
228# MAN<sect>		- A list of manpages, categorized by section.  For
229#				  example, if your port has "man/man1/foo.1" and
230#				  "man/mann/bar.n", set "MAN1=foo.1" and "MANN=bar.n".
231#				  The available sections chars are "123456789LN".
232# MLINKS		- A list of <target, source> tuples for creating links
233#				  for manpages.  For example, "MLINKS= a.1 b.1 c.3 d.3"
234#				  will do an "ln -sf a.1 b.1" and "ln -sf c.3 and d.3" in
235#				  appropriate directories.  (Use this even if the port
236#				  installs its own manpage links so they will show up
237#				  correctly in ${PLIST}.)
238# MANPREFIX		- The directory prefix for ${MAN<sect>} and ${MLINKS}
239#				  (default: ${PREFIX}).
240# MAN<sect>PREFIX - If manual pages of some sections install in different
241#				  locations than others, use these (default: ${MANPREFIX}).
242# MANCOMPRESSED - This variable can take values "yes", "no" or
243#				  "maybe".  "yes" means manpages are installed
244#				  compressed; "no" means they are not; "maybe" means
245#				  it changes depending on the value of
246#				  NOMANCOMPRESS.  The default is "yes" if USE_IMAKE
247#				  is set and NO_INSTALL_MANPAGES is not set, and
248#				  "no" otherwise.
249#
250# If your port wants the package to be built with several options,
251# set the following variables.
252#
253# LOOP_VAR		- The name of the variable.
254# LOOP_OPTIONS	- The value of the options.
255#
256# If they are set, there will be a target "package-loop" which will
257# iterate several times, each time cleaning up afterwards, with the
258# value of ${LOOP_VAR} set to one of ${LOOP_OPTIONS}.  In addition,
259# the "describe" target will print out multiple lines with the variable
260# set accordingly.
261#
262# Default targets and their behaviors:
263#
264# fetch			- Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
265#				  into ${DISTDIR} as necessary.
266# fetch-list	- Show list of files that would be retrieved by fetch
267# extract		- Unpacks ${DISTFILES} into ${WRKDIR}.
268# patch			- Apply any provided patches to the source.
269# configure		- Runs either GNU configure, one or more local configure
270#				  scripts or nothing, depending on what's available.
271# build			- Actually compile the sources.
272# install		- Install the results of a build.
273# reinstall		- Install the results of a build, ignoring "already installed"
274#				  flag.
275# deinstall		- Remove the installation.
276# package		- Create a package from an _installed_ port.
277# describe		- Try to generate a one-line description for each port for
278#				  use in INDEX files and the like.
279# checkpatch	- Do a "patch -C" instead of a "patch".  Note that it may
280#				  give incorrect results if multiple patches deal with
281#				  the same file.
282# checksum		- Use files/md5 to ensure that your distfiles are valid.
283# makesum		- Generate files/md5 (only do this for your own ports!).
284#
285# Default sequence for "all" is:  fetch checksum extract patch configure build
286#
287# Please read the comments in the targets section below, you
288# should be able to use the pre-* or post-* targets/scripts
289# (which are available for every stage except checksum) or
290# override the do-* targets to do pretty much anything you want.
291#
292# NEVER override the "regular" targets unless you want to open
293# a major can of worms.
294#
295# Set these variables if your port doesn't need some of the steps.
296# Note that there are no NO_PATCH or NO_CONFIGURE variables becuase
297# those steps are empty by default.  Also, NO_CHECKSUM is a user variable
298# and is not to be set in a port's Makefile.  See above for NO_PACKAGE.
299#
300# NO_EXTRACT	- Use a dummy (do-nothing) extract target.
301# NO_BUILD		- Use a dummy (do-nothing) build target.
302# NO_INSTALL	- Use a dummy (do-nothing) install target.
303#
304# Here are some variables used in various stages.
305#
306# For fetch:
307#
308# FETCH_CMD		  - Full path to ftp/http fetch command if not in $PATH
309#				  (default: /usr/bin/fetch).
310# FETCH_BEFORE_ARGS -
311#				  Arguments to ${FETCH_CMD} before filename (default: none).
312# FETCH_AFTER_ARGS -
313#				  Arguments to ${FETCH_CMD} following filename (default: none).
314#
315# For extract:
316#
317# EXTRACT_CMD	- Command for extracting archive (default: tar).
318# EXTRACT_BEFORE_ARGS -
319#				  Arguments to ${EXTRACT_CMD} before filename
320#				  (default: -xzf).
321# EXTRACT_AFTER_ARGS -
322#				  Arguments to ${EXTRACT_CMD} following filename
323#				  (default: none).
324#
325# For configure:
326#
327# HAS_CONFIGURE	- Says that the port has its own configure script.  The
328#				  configure stage will not do anything if this is not set.
329# GNU_CONFIGURE	- Set if you are using GNU configure (optional).  Implies
330#				  HAS_CONFIGURE.
331# CONFIGURE_SCRIPT - Name of configure script (defaults: configure).
332# CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set.
333# CONFIGURE_ENV - Pass these env (shell-like) to configure if
334#				  ${HAS_CONFIGURE} is set.
335#
336# For build and install:
337#
338# MAKE_ENV		- Additional environment vars passed to sub-make in build
339#				  and install stages (default: see below).
340# MAKE_ARGS		- Any extra arguments to sub-make in build and install
341#				  stages (default: none).
342#
343# For install:
344#
345# NO_MTREE		- If set, will not invoke mtree from bsd.port.mk from
346#				  the "install" target.
347# MTREE_FILE	- The name of the mtree file (default: /etc/mtree/BSD.x11.dist
348#				  if USE_X_PREFIX is set, /etc/mtree/BSD.local.dist
349#				  otherwise.)
350# PLIST			- Name of the `packing list' file (default: ${PKGDIR}/PLIST).
351#				  Change this to ${WRKDIR}/PLIST or something if you
352#				  need to write to it.  (It is not a good idea for a port
353#				  to write to any file outside ${WRKDIR} during a normal
354#				  build.)
355# TMPPLIST		- Name of the `packing list' file after processing
356#				  (default: ${WRKDIR}/.PLIST.mktmp).
357# PLIST_SUB		- List of "variable=value" pair for substitution in ${PLIST}
358# 				  (default: see below).
359#
360# Note that the install target will automatically add manpages (see
361# above) and also substitute special sequences of characters (delimited
362# by "%%") as defined in PLIST_SUB to generate ${TMPPLIST}.  For
363# instance, "OSREL=${OSREL}" in PLIST_SUB causes all occurrences of
364# "%%OSREL%%" in ${PLIST} to be substituted by the value of OSREL.
365# ${TMPPLIST} is generated between the do-install and post-install
366# stages.  If you are generating the packing list on-the-fly, make
367# sure it's generated by the end of do-install!
368#
369# For package:
370#
371# NO_LATEST_LINK - Do not install the "Latest" link for package.  Define this
372#				  if this port is a beta version of another stable port
373#				  which is also in the tree.
374#
375# This is used in all stages:
376#
377# SCRIPTS_ENV	- Additional environment vars passed to scripts in
378#                 ${SCRIPTDIR} executed by bsd.port.mk (default: see below).
379#
380# Finally, variables to change if you want a special behavior.  These
381# are for debugging purposes.  Don't set them in your Makefile.
382#
383# ECHO_MSG		- Used to print all the '===>' style prompts - override this
384#				  to turn them off (default: /bin/echo).
385# PATCH_DEBUG	- If set, print out more information about the patches as
386#				  it attempts to apply them.
387# PKG_DBDIR		- Where package installation is recorded (default: /var/db/pkg)
388# NO_PKG_REGISTER - Don't register a port install as a package.
389# FORCE_PKG_REGISTER - If set, it will overwrite any existing package
390#				  registration information in ${PKG_DBDIR}/${PKGNAME}.
391# NO_DEPENDS	- Don't verify build of dependencies.
392# NO_CHECKSUM	- Don't verify the checksum.  Typically used when
393#				  when you noticed the distfile you just fetched has
394#				  a different checksum and you intend to verify if
395#				  the port still works with it.
396
397# Start of pre-makefile section.
398.if !defined(AFTERPORTMK)
399
400# Get the architecture
401ARCH!=	uname -m
402
403# Get the operating system type
404OPSYS!=	uname -s
405
406# Get the operating system revision
407OSREL!=	uname -r | sed -e 's/[-(].*//'
408
409# Get __FreeBSD_version
410OSVERSION!=	sysctl -n kern.osreldate
411
412# Get the object format.
413PORTOBJFORMAT!=	test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
414
415# If they exist, include Makefile.inc, then architecture/operating
416# system specific Makefiles, then local Makefile.local.
417
418.if exists(${.CURDIR}/../Makefile.inc)
419.include "${.CURDIR}/../Makefile.inc"
420.endif
421
422.if exists(${.CURDIR}/Makefile.${ARCH}-${OPSYS})
423.include "${.CURDIR}/Makefile.${ARCH}-${OPSYS}"
424.elif exists(${.CURDIR}/Makefile.${OPSYS})
425.include "${.CURDIR}/Makefile.${OPSYS}"
426.elif exists(${.CURDIR}/Makefile.${ARCH})
427.include "${.CURDIR}/Makefile.${ARCH}"
428.endif
429
430.if exists(${.CURDIR}/Makefile.local)
431.include "${.CURDIR}/Makefile.local"
432.endif
433
434# These need to be absolute since we don't know how deep in the ports
435# tree we are and thus can't go relative.  They can, of course, be overridden
436# by individual Makefiles or local system make configuration.
437.if (${OPSYS} == "NetBSD")
438PORTSDIR?=		/usr/opt
439.else
440PORTSDIR?=		/usr/ports
441.endif
442LOCALBASE?=		${DESTDIR}/usr/local
443X11BASE?=		${DESTDIR}/usr/X11R6
444DISTDIR?=		${PORTSDIR}/distfiles
445_DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
446PACKAGES?=		${PORTSDIR}/packages
447TEMPLATES?=		${PORTSDIR}/templates
448
449.if exists(${.CURDIR}/patches.${ARCH}-${OPSYS})
450PATCHDIR?=		${.CURDIR}/patches.${ARCH}-${OPSYS}
451.elif exists(${.CURDIR}/patches.${OPSYS})
452PATCHDIR?=		${.CURDIR}/patches.${OPSYS}
453.elif exists(${.CURDIR}/patches.${ARCH})
454PATCHDIR?=		${.CURDIR}/patches.${ARCH}
455.else
456PATCHDIR?=		${.CURDIR}/patches
457.endif
458
459.if exists(${.CURDIR}/scripts.${ARCH}-${OPSYS})
460SCRIPTDIR?=		${.CURDIR}/scripts.${ARCH}-${OPSYS}
461.elif exists(${.CURDIR}/scripts.${OPSYS})
462SCRIPTDIR?=		${.CURDIR}/scripts.${OPSYS}
463.elif exists(${.CURDIR}/scripts.${ARCH})
464SCRIPTDIR?=		${.CURDIR}/scripts.${ARCH}
465.else
466SCRIPTDIR?=		${.CURDIR}/scripts
467.endif
468
469.if exists(${.CURDIR}/files.${ARCH}-${OPSYS})
470FILESDIR?=		${.CURDIR}/files.${ARCH}-${OPSYS}
471.elif exists(${.CURDIR}/files.${OPSYS})
472FILESDIR?=		${.CURDIR}/files.${OPSYS}
473.elif exists(${.CURDIR}/files.${ARCH})
474FILESDIR?=		${.CURDIR}/files.${ARCH}
475.else
476FILESDIR?=		${.CURDIR}/files
477.endif
478
479.if exists(${.CURDIR}/pkg.${ARCH}-${OPSYS})
480PKGDIR?=		${.CURDIR}/pkg.${ARCH}-${OPSYS}
481.elif exists(${.CURDIR}/pkg.${OPSYS})
482PKGDIR?=		${.CURDIR}/pkg.${OPSYS}
483.elif exists(${.CURDIR}/pkg.${ARCH})
484PKGDIR?=		${.CURDIR}/pkg.${ARCH}
485.else
486PKGDIR?=		${.CURDIR}/pkg
487.endif
488
489.if defined(USE_IMAKE)
490USE_X_PREFIX=	yes
491.endif
492.if defined(USE_X_PREFIX)
493USE_XLIB=		yes
494.endif
495.if defined(USE_X_PREFIX)
496PREFIX?=		${X11BASE}
497.else
498PREFIX?=		${LOCALBASE}
499.endif
500
501.endif
502# End of pre-makefile section.
503
504# Start of post-makefile section.
505.if !defined(BEFOREPORTMK)
506
507.if !defined(NO_WRKDIR)
508WRKDIR?=		${WRKDIRPREFIX}${.CURDIR}/work
509.else
510WRKDIR?=		${WRKDIRPREFIX}${.CURDIR}
511.endif
512.if defined(NO_WRKSUBDIR)
513WRKSRC?=		${WRKDIR}
514.else
515WRKSRC?=		${WRKDIR}/${DISTNAME}
516.endif
517
518PLIST_SUB+=	OSREL=${OSREL}
519
520CONFIGURE_ENV+=	PORTOBJFORMAT=${PORTOBJFORMAT}
521SCRIPTS_ENV+=	PORTOBJFORMAT=${PORTOBJFORMAT}
522MAKE_ENV+=		PORTOBJFORMAT=${PORTOBJFORMAT}
523PLIST_SUB+=		PORTOBJFORMAT=${PORTOBJFORMAT}
524
525.if defined(MANCOMPRESSED)
526.if ${MANCOMPRESSED} != yes && ${MANCOMPRESSED} != no && \
527	${MANCOMPRESSED} != maybe
528.BEGIN:
529	@${ECHO_MSG} "Error: Value of MANCOMPRESSED (is \"${MANCOMPRESSED}\") can only be \"yes\", \"no\" or \"maybe\"".
530	@${FALSE}
531.endif
532.endif
533
534.if defined(USE_IMAKE) && ${OPSYS} != OpenBSD && !defined(NO_INSTALL_MANPAGES)
535MANCOMPRESSED?=	yes
536.else
537MANCOMPRESSED?=	no
538.endif
539
540.if defined(USE_GMAKE)
541BUILD_DEPENDS+=		gmake:${PORTSDIR}/devel/gmake
542.endif
543.if defined(USE_AUTOCONF)
544GNU_CONFIGURE=	yes
545BUILD_DEPENDS+=		autoconf:${PORTSDIR}/devel/autoconf
546.endif
547
548PERL_VERSION=	5.00502
549PERL_VER=		5.005
550PLIST_SUB+=		PERL_VERSION=${PERL_VERSION} \
551				PERL_VER=${PERL_VER}
552.if exists(/usr/bin/perl5)
553# 3.0-current after perl5 import
554.if !exists(/usr/bin/perl${PERL_VERSION}) && defined(USE_PERL5)
555.BEGIN:
556	@${ECHO_MSG} "Error: you don't have the right version of perl in /usr/bin."
557	@${FALSE}
558.endif
559PERL5=			/usr/bin/perl${PERL_VERSION}
560PERL=			/usr/bin/perl
561.else
562PERL5=			${LOCALBASE}/bin/perl${PERL_VERSION}
563PERL=			${LOCALBASE}/bin/perl
564.if defined(USE_PERL5)
565BUILD_DEPENDS+=	perl${PERL_VERSION}:${PORTSDIR}/lang/perl5
566RUN_DEPENDS+=	perl${PERL_VERSION}:${PORTSDIR}/lang/perl5
567.endif
568.endif
569
570.if defined(USE_XLIB)
571LIB_DEPENDS+=	X11.6:${PORTSDIR}/x11/XFree86
572.endif
573
574.if defined(USE_QT)
575LIB_DEPENDS+=	qt.1:${PORTSDIR}/x11-toolkits/qt140
576.endif
577
578.if exists(${PORTSDIR}/../Makefile.inc)
579.include "${PORTSDIR}/../Makefile.inc"
580.endif
581
582# Don't change these!!!  These names are built into the _TARGET_USE macro,
583# there is no way to refer to them cleanly from within the macro AFAIK.
584EXTRACT_COOKIE?=	${WRKDIR}/.extract_done
585CONFIGURE_COOKIE?=	${WRKDIR}/.configure_done
586INSTALL_COOKIE?=	${WRKDIR}/.install_done
587BUILD_COOKIE?=		${WRKDIR}/.build_done
588PATCH_COOKIE?=		${WRKDIR}/.patch_done
589PACKAGE_COOKIE?=	${WRKDIR}/.package_done
590
591# How to do nothing.  Override if you, for some strange reason, would rather
592# do something.
593DO_NADA?=		/usr/bin/true
594
595# Miscellaneous overridable commands:
596GMAKE?=			gmake
597AUTOCONF?=		autoconf
598XMKMF?=			xmkmf -a
599.if exists(/sbin/md5)
600MD5?=			/sbin/md5
601.elif exists(/bin/md5)
602MD5?=			/bin/md5
603.elif exists(/usr/bin/md5)
604MD5?=			/usr/bin/md5
605.else
606MD5?=			md5
607.endif
608MD5_FILE?=		${FILESDIR}/md5
609
610MAKE_FLAGS?=	-f
611MAKEFILE?=		Makefile
612MAKE_ENV+=		PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}" LIBDIR="${LIBDIR}"
613
614.if exists(/usr/bin/fetch)
615FETCH_CMD?=		/usr/bin/fetch
616#FETCH_BEFORE_ARGS+=	$${CKSIZE:+-S $$CKSIZE}
617.else
618FETCH_CMD?=		/usr/bin/ftp
619.endif
620
621TOUCH?=			/usr/bin/touch
622TOUCH_FLAGS?=	-f
623
624PATCH?=			/usr/bin/patch
625PATCH_STRIP?=	-p0
626PATCH_DIST_STRIP?=	-p0
627.if defined(PATCH_DEBUG)
628PATCH_DEBUG_TMP=	yes
629PATCH_ARGS?=	-d ${WRKSRC} -E ${PATCH_STRIP}
630PATCH_DIST_ARGS?=	-d ${WRKSRC} -E ${PATCH_DIST_STRIP}
631.else
632PATCH_DEBUG_TMP=	no
633PATCH_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
634PATCH_DIST_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
635.endif
636.if defined(BATCH)
637PATCH_ARGS+=		--batch
638PATCH_DIST_ARGS+=	--batch
639.endif
640
641.if defined(PATCH_CHECK_ONLY)
642PATCH_ARGS+=	-C
643PATCH_DIST_ARGS+=	-C
644.endif
645
646.if exists(/bin/tar)
647EXTRACT_CMD?=	/bin/tar
648.else
649EXTRACT_CMD?=	/usr/bin/tar
650.endif
651EXTRACT_SUFX?=	.tar.gz
652# Backwards compatability.
653.if defined(EXTRACT_ARGS)
654EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
655.else
656EXTRACT_BEFORE_ARGS?=   -xzf
657.endif
658
659# Figure out where the local mtree file is
660.if !defined(MTREE_FILE)
661.if defined(USE_X_PREFIX)
662MTREE_FILE=	/etc/mtree/BSD.x11.dist
663.else
664MTREE_FILE=	/etc/mtree/BSD.local.dist
665.endif
666.endif
667MTREE_CMD?=	/usr/sbin/mtree
668MTREE_ARGS?=	-U -f ${MTREE_FILE} -d -e -p
669
670# A few aliases for *-install targets
671INSTALL_PROGRAM= \
672	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
673INSTALL_SCRIPT= \
674	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
675INSTALL_DATA= \
676	${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
677INSTALL_MAN= \
678	${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
679
680INSTALL_MACROS=	BSD_INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
681			BSD_INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
682			BSD_INSTALL_DATA="${INSTALL_DATA}" \
683			BSD_INSTALL_MAN="${INSTALL_MAN}"
684MAKE_ENV+=	${INSTALL_MACROS}
685SCRIPTS_ENV+=	${INSTALL_MACROS}
686
687# The user can override the NO_PACKAGE by specifying this from
688# the make command line
689.if defined(FORCE_PACKAGE)
690.undef NO_PACKAGE
691.endif
692
693COMMENT?=	${PKGDIR}/COMMENT
694DESCR?=		${PKGDIR}/DESCR
695PLIST?=		${PKGDIR}/PLIST
696TMPPLIST?=	${WRKDIR}/.PLIST.mktmp
697
698PKG_CMD?=		/usr/sbin/pkg_create
699PKG_DELETE?=	/usr/sbin/pkg_delete
700.if !defined(PKG_ARGS)
701PKG_ARGS=		-v -c ${COMMENT} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
702.if exists(${PKGDIR}/INSTALL)
703PKG_ARGS+=		-i ${PKGDIR}/INSTALL
704.endif
705.if exists(${PKGDIR}/DEINSTALL)
706PKG_ARGS+=		-k ${PKGDIR}/DEINSTALL
707.endif
708.if exists(${PKGDIR}/REQ)
709PKG_ARGS+=		-r ${PKGDIR}/REQ
710.endif
711.if exists(${PKGDIR}/MESSAGE)
712PKG_ARGS+=		-D ${PKGDIR}/MESSAGE
713.endif
714.if !defined(NO_MTREE)
715PKG_ARGS+=		-m ${MTREE_FILE}
716.endif
717.endif
718PKG_SUFX?=		.tgz
719# where pkg_add records its dirty deeds.
720PKG_DBDIR?=		/var/db/pkg
721
722# shared/dynamic motif libs
723.if defined(HAVE_MOTIF)
724.if defined(MOTIF_STATIC)
725MOTIFLIB?=	${X11BASE}/lib/libXm.a
726.else
727MOTIFLIB?=	-L${X11BASE}/lib -lXm
728.endif
729.endif
730
731AWK?=		/usr/bin/awk
732BASENAME?=	/usr/bin/basename
733CAT?=		/bin/cat
734CP?=		/bin/cp
735ECHO?=		/bin/echo
736EXPR?=		/bin/expr
737FALSE?=		/usr/bin/false
738GREP?=		/usr/bin/grep
739GUNZIP_CMD?=	/usr/bin/gunzip -f
740GZCAT?=		/usr/bin/gzcat
741GZIP?=		-9
742GZIP_CMD?=	/usr/bin/gzip -nf ${GZIP}
743LDCONFIG?=	/sbin/ldconfig
744LN?=		/bin/ln
745MKDIR?=		/bin/mkdir -p
746MV?=		/bin/mv
747RM?=		/bin/rm
748RMDIR?=		/bin/rmdir
749SED?=		/usr/bin/sed
750SETENV?=	/usr/bin/env
751SH?=		/bin/sh
752TR?=		/usr/bin/tr
753TRUE?=		/usr/bin/true
754
755# Used to print all the '===>' style prompts - override this to turn them off.
756ECHO_MSG?=		${ECHO}
757
758.for sub in ${PLIST_SUB}
759_sedsubplist!=	sym=`${ECHO} "${sub}" | ${SED} -e 's/=.*//'`; \
760		val=`${ECHO} "${sub}" | ${SED} -e 's/^[^=][^=]*=//'`; \
761		echo "${_sedsubplist} -e s!%%$${sym}%%!$${val}!g"
762.endfor
763
764ALL_TARGET?=		all
765INSTALL_TARGET?=	install
766
767# Popular master sites
768MASTER_SITE_XCONTRIB+=	\
769	ftp://crl.dec.com/pub/X11/contrib/%SUBDIR%/ \
770    ftp://ftp.eu.net/X11/contrib/%SUBDIR%/
771
772MASTER_SITE_GNU+=	\
773	ftp://prep.ai.mit.edu/pub/gnu/%SUBDIR%/ \
774	ftp://wuarchive.wustl.edu/systems/gnu/%SUBDIR%/
775
776MASTER_SITE_PERL_CPAN+=	\
777	ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/%SUBDIR%/ \
778	ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/%SUBDIR%/
779
780MASTER_SITE_TEX_CTAN+=  \
781        ftp://ftp.cdrom.com/pub/tex/ctan/%SUBDIR%/  \
782        ftp://wuarchive.wustl.edu/packages/TeX/%SUBDIR%/  \
783        ftp://ftp.funet.fi/pub/TeX/CTAN/%SUBDIR%/  \
784        ftp://ftp.tex.ac.uk/tex-archive/%SUBDIR%/  \
785        ftp://ftp.dante.de/tex-archive/%SUBDIR%/
786
787MASTER_SITE_SUNSITE+=	\
788	ftp://sunsite.unc.edu/pub/Linux/%SUBDIR%/ \
789	ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/%SUBDIR%/ \
790	ftp://ftp.funet.fi/pub/mirrors/sunsite.unc.edu/pub/Linux/%SUBDIR%/
791
792MASTER_SITE_KDE+=	\
793	ftp://ftp.us.kde.org/pub/kde/%SUBDIR%/ \
794	ftp://ftp.kde.org/pub/kde/%SUBDIR%/ \
795	ftp://ftp.tuniv.szczecin.pl/pub/kde/%SUBDIR%/ \
796	ftp://ftp.fu-berlin.de/pub/unix/X11/gui/kde/%SUBDIR%/ \
797	ftp://ftp.blaze.net.au/pub/kde/%SUBDIR%/ \
798	ftp://ftp.dataplus.se/pub/linux/kde/%SUBDIR%/ \
799	ftp://ftp.caldera.com/pub/mirrors/kde/%SUBDIR%/
800
801# Empty declaration to avoid "variable MASTER_SITES recursive" error
802MASTER_SITES?=
803PATCH_SITES?=
804
805# To avoid double-slashes
806MASTER_SITE_SUBDIR?=	.
807PATCH_SITE_SUBDIR?=	.
808
809# Substitute subdirectory names
810MASTER_SITES:=	${MASTER_SITES:S/%SUBDIR%/${MASTER_SITE_SUBDIR}/}
811PATCH_SITES:=	${PATCH_SITES:S/%SUBDIR%/${PATCH_SITE_SUBDIR}/}
812
813# The primary backup site.
814MASTER_SITE_BACKUP?=	\
815	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
816
817# If the user has this set, go to the FreeBSD repository for everything.
818.if defined(MASTER_SITE_FREEBSD)
819MASTER_SITE_OVERRIDE=  ${MASTER_SITE_BACKUP}
820.endif
821
822# Where to put distfiles that don't have any other master site
823MASTER_SITE_LOCAL?= \
824	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/LOCAL_PORTS/
825
826# I guess we're in the master distribution business! :)  As we gain mirror
827# sites for distfiles, add them to this list.
828.if !defined(MASTER_SITE_OVERRIDE)
829MASTER_SITES+=	${MASTER_SITE_BACKUP}
830PATCH_SITES+=	${MASTER_SITE_BACKUP}
831.else
832MASTER_SITES:=	${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
833PATCH_SITES:=	${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
834.endif
835
836# Search CDROM first if mounted, symlink instead of copy if
837# FETCH_SYMLINK_DISTFILES is set
838CD_MOUNTPT?=	/cdrom
839.if exists(${CD_MOUNTPT}/ports/distfiles)
840MASTER_SITES:=	file:${CD_MOUNTPT}/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
841PATCH_SITES:=	file:${CD_MOUNTPT}/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
842.if defined(FETCH_SYMLINK_DISTFILES)
843FETCH_BEFORE_ARGS+=	-l
844.endif
845.endif
846
847# Derived names so that they're easily overridable.
848DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
849PKGNAME?=		${DISTNAME}
850
851ALLFILES?=	${DISTFILES} ${PATCHFILES}
852
853.if defined(IGNOREFILES)
854CKSUMFILES!=	\
855	for file in ${ALLFILES}; do \
856		ignore=0; \
857		for tmp in ${IGNOREFILES}; do \
858			if [ "$$file" = "$$tmp" ]; then \
859				ignore=1; \
860			fi; \
861		done; \
862		if [ "$$ignore" = 0 ]; then \
863			echo "$$file"; \
864		fi; \
865	done
866.else
867CKSUMFILES=		${ALLFILES}
868.endif
869
870# List of all files, with ${DIST_SUBDIR} in front.  Used for checksum.
871.if defined(DIST_SUBDIR)
872_CKSUMFILES?=	${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
873_IGNOREFILES?=	${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
874.else
875_CKSUMFILES?=	${CKSUMFILES}
876_IGNOREFILES?=	${IGNOREFILES}
877.endif
878
879# This is what is actually going to be extracted, and is overridable
880#  by user.
881EXTRACT_ONLY?=	${DISTFILES}
882
883# Documentation
884MAINTAINER?=	ports@FreeBSD.ORG
885
886.if !defined(CATEGORIES)
887.BEGIN:
888	@${ECHO_MSG} "CATEGORIES is mandatory."
889	@${FALSE}
890.endif
891
892# Note this has to start with a capital letter (or more accurately, it
893#  shouldn't match "[a-z]*"), see the target "delete-package-links" below.
894PKGREPOSITORYSUBDIR?=	All
895PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
896.if exists(${PACKAGES})
897PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
898.else
899PKGFILE?=		${.CURDIR}/${PKGNAME}${PKG_SUFX}
900.endif
901
902# The "latest version" link -- ${PKGNAME} minus everthing after the last '-'
903PKGLATESTREPOSITORY?=	${PACKAGES}/Latest
904PKGBASE!=	${ECHO} ${PKGNAME} | ${SED} -e 's/-[^-]*$$//'
905PKGLATESTFILE?=		${PKGLATESTREPOSITORY}/${PKGBASE}${PKG_SUFX}
906
907CONFIGURE_SCRIPT?=	configure
908
909.if defined(GNU_CONFIGURE)
910CONFIGURE_ARGS+=	--prefix=${PREFIX}
911HAS_CONFIGURE=		yes
912.endif
913
914# Passed to most of script invocations
915SCRIPTS_ENV+=	CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
916		  WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
917		  SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
918		  PORTSDIR=${PORTSDIR} DEPENDS="${DEPENDS}" \
919		  PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
920
921.if defined(BATCH)
922SCRIPTS_ENV+=	BATCH=yes
923.endif
924
925MANPREFIX?=	${PREFIX}
926
927.for sect in 1 2 3 4 5 6 7 8 9
928MAN${sect}PREFIX?=	${MANPREFIX}
929.endfor
930MANLPREFIX?=	${MANPREFIX}
931MANNPREFIX?=	${MANPREFIX}
932
933MANLANG?=	""	# english only by default
934
935.if !defined(NOMANCOMPRESS)
936MANEXT=	.gz
937.endif
938
939.if defined(MLINKS)
940__pmlinks!=	${ECHO} '${MLINKS:S/	/ /}' | ${AWK} \
941 '{ if (NF % 2 != 0) { print "broken"; exit; } \
942	for (i=1; i<=NF; i++) { \
943		if ($$i ~ /^-$$/ && i != 1 && i % 2 != 0) \
944			{ $$i = $$(i-2); printf " " $$i " "; } \
945		else if ($$i ~ /^[^ ]+\.[1-9ln][^. ]*$$/ || $$i ~ /^\//) \
946			printf " " $$i " "; \
947		else \
948			{ print "broken"; exit; } \
949	} \
950  }' | ${SED} -e 's/ \/[^ ]*/ &x/g' -e 's/ [^/ ][^ ]*\.\(.\)[^. ]*/ &\1/g'
951.if ${__pmlinks:Mbroken} == "broken"
952.BEGIN:
953	@${ECHO_MSG} "Error: Unable to parse MLINKS."
954	@${FALSE}
955.endif
956.endif
957
958.for lang in ${MANLANG}
959
960.for sect in 1 2 3 4 5 6 7 8 9
961.if defined(MAN${sect})
962_MANPAGES+=	${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%}
963.endif
964.endfor
965
966.if defined(MANL)
967_MANPAGES+=	${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%}
968.endif
969
970.if defined(MANN)
971_MANPAGES+=	${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
972.endif
973
974.if defined(MLINKS)
975.for __page in ${__pmlinks}
976__name=	${__page:S// /:N[1-9lnx]}
977__sect=	${__page:S// /:M[1-9lnx]}
978.if ${__name:M/*}x == x
979_MLINKS+=	${MAN${__sect:S/l/L/:S/n/N/}PREFIX}/man/${lang}/man${__sect}/${__name}${MANEXT}
980.else
981_MLINKS+=	${__name}${MANEXT}
982.endif
983_MLINKS:=	${_MLINKS}
984.endfor
985.endif
986
987.endfor lang in ${MANLANG}
988
989_TMLINKS!=	${ECHO} ${_MLINKS} | ${AWK} '{for (i=2; i<=NF; i+=2) print $$i}'
990
991.if defined(_MANPAGES) && defined(NOMANCOMPRESS)
992__MANPAGES:=	${_MANPAGES:S^${PREFIX}/^^:S/""//:S^//^/^g}
993.elif defined(_MANPAGES)
994__MANPAGES:=	${_MANPAGES:S^${PREFIX}/^^:S/""//:S^//^/^g:S/$/.gz/}
995.endif
996
997.if defined(_MANPAGES) && ${MANCOMPRESSED} == "yes"
998_MANPAGES:=	${_MANPAGES:S/$/.gz/}
999.endif
1000
1001.MAIN: all
1002
1003################################################################
1004# Many ways to disable a port.
1005#
1006# If we're in BATCH mode and the port is interactive, or we're
1007# in interactive mode and the port is non-interactive, skip all
1008# the important targets.  The reason we have two modes is that
1009# one might want to leave a build in BATCH mode running
1010# overnight, then come back in the morning and do _only_ the
1011# interactive ones that required your intervention.
1012#
1013# Don't attempt to build ports that require Motif if you don't
1014# have Motif.
1015#
1016# Ignore ports that can't be resold if building for a CDROM.
1017#
1018# Don't build a port if it's restricted and we don't want to get
1019# into that.
1020#
1021# Don't build a port on an ELF machine if it's broken for ELF.
1022#
1023# Don't build a port if it's broken.
1024################################################################
1025
1026OLDSYSTCL!=	${ECHO} /usr/include/tcl.h /usr/lib/libtcl??.so.*.*
1027OLDTCL=		${LOCALBASE}/include/tcl.h ${LOCALBASE}/lib/tclConfig.sh
1028OLDTK=		${LOCALBASE}/include/tk.h ${LOCALBASE}/lib/tkConfig.sh
1029
1030.if !defined(NO_IGNORE)
1031.for file in ${OLDSYSTCL} ${OLDTCL}
1032.if exists(${file})
1033IGNORE=	": You have an old file \(${file}\) that could cause problems for some ports to compile.  Please remove it and try again.  You may have to reinstall tcl from the ports tree afterwards"
1034.endif
1035.endfor
1036.for file in ${OLDTK}
1037.if exists(${file})
1038IGNORE=	": You have an old file \(${file}\) that could cause problems for some ports to compile.  Please remove it and try again.  You may have to reinstall tk from the ports tree afterwards"
1039.endif
1040.endfor
1041.endif
1042
1043.if !defined(NO_IGNORE)
1044.if (defined(IS_INTERACTIVE) && defined(BATCH))
1045IGNORE=	"is an interactive port"
1046.elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
1047IGNORE=	"is not an interactive port"
1048.elif (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF))
1049IGNORE=	"requires Motif"
1050.elif (defined(MOTIF_ONLY) && !defined(REQUIRES_MOTIF))
1051IGNORE=	"does not require Motif"
1052.elif (defined(NO_CDROM) && defined(FOR_CDROM))
1053IGNORE=	"may not be placed on a CDROM: ${NO_CDROM}"
1054.elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
1055IGNORE=	"is restricted: ${RESTRICTED}"
1056.elif defined(NO_CONFIGURE)
1057IGNORE=	"defines NO_CONFIGURE, which is obsoleted"
1058.elif defined(NO_PATCH)
1059IGNORE=	"defines NO_PATCH, which is obsoleted"
1060.elif (defined(BROKEN_ELF) && (${PORTOBJFORMAT} == "elf"))
1061IGNORE=	"is broken for ELF: ${BROKEN_ELF}"
1062.elif defined(BROKEN)
1063IGNORE=	"is marked as broken: ${BROKEN}"
1064.endif
1065
1066.if (defined(MANUAL_PACKAGE_BUILD) && defined(PACKAGE_BUILDING))
1067IGNORE=	"has to be built manually: ${MANUAL_PACKAGE_BUILD}"
1068clean:
1069	@${IGNORECMD}
1070.endif
1071
1072.if defined(IGNORE)
1073.if defined(IGNORE_SILENT)
1074IGNORECMD=	${DO_NADA}
1075.else
1076IGNORECMD=	${ECHO_MSG} "===>  ${PKGNAME} ${IGNORE}."
1077.endif
1078fetch:
1079	@${IGNORECMD}
1080checksum:
1081	@${IGNORECMD}
1082extract:
1083	@${IGNORECMD}
1084patch:
1085	@${IGNORECMD}
1086configure:
1087	@${IGNORECMD}
1088all:
1089	@${IGNORECMD}
1090build:
1091	@${IGNORECMD}
1092install:
1093	@${IGNORECMD}
1094reinstall:
1095	@${IGNORECMD}
1096package:
1097	@${IGNORECMD}
1098.endif
1099.endif
1100
1101################################################################
1102# Clean directories for ftp or CDROM.
1103################################################################
1104
1105.if defined(RESTRICTED)
1106clean-restricted:	delete-distfiles delete-package
1107.else
1108clean-restricted:
1109.endif
1110
1111.if defined(NO_CDROM)
1112clean-for-cdrom:	delete-distfiles delete-package
1113.else
1114clean-for-cdrom:
1115.endif
1116
1117.if defined(ALL_HOOK)
1118all:
1119	@cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
1120	  DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
1121	  PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
1122	  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
1123	  DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
1124	  RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
1125	${ALL_HOOK}
1126.endif
1127
1128.if !target(all)
1129all: build
1130.endif
1131
1132.if !defined(DEPENDS_TARGET)
1133.if make(reinstall)
1134DEPENDS_TARGET=	reinstall
1135.else
1136DEPENDS_TARGET=	install
1137.endif
1138.endif
1139
1140################################################################
1141# The following are used to create easy dummy targets for
1142# disabling some bit of default target behavior you don't want.
1143# They still check to see if the target exists, and if so don't
1144# do anything, since you might want to set this globally for a
1145# group of ports in a Makefile.inc, but still be able to
1146# override from an individual Makefile.
1147################################################################
1148
1149# Disable checksum
1150.if defined(NO_CHECKSUM) && !target(checksum)
1151checksum: fetch
1152	@${DO_NADA}
1153.endif
1154
1155# Disable extract
1156.if defined(NO_EXTRACT) && !target(extract)
1157extract: fetch
1158	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} checksum REAL_EXTRACT=yes
1159	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
1160.endif
1161
1162# Disable build
1163.if defined(NO_BUILD) && !target(build)
1164build: configure
1165	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
1166.endif
1167
1168# Disable install
1169.if defined(NO_INSTALL) && !target(install)
1170install: build
1171	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
1172.endif
1173
1174# Disable package
1175.if defined(NO_PACKAGE) && !target(package)
1176package:
1177.if defined(IGNORE_SILENT)
1178	@${DO_NADA}
1179.else
1180	@${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
1181.endif
1182.endif
1183
1184# Disable describe
1185.if defined(NO_DESCRIBE) && !target(describe)
1186describe:
1187	@${DO_NADA}
1188.endif
1189
1190################################################################
1191# More standard targets start here.
1192#
1193# These are the body of the build/install framework.  If you are
1194# not happy with the default actions, and you can't solve it by
1195# adding pre-* or post-* targets/scripts, override these.
1196################################################################
1197
1198# Fetch
1199
1200.if !target(do-fetch)
1201do-fetch:
1202	@${MKDIR} ${_DISTDIR}
1203	@(cd ${_DISTDIR}; \
1204	 for file in ${DISTFILES}; do \
1205		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1206			if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1207				${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1208				${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
1209				${ECHO_MSG} ">> Please correct this problem and try again."; \
1210				exit 1; \
1211			fi ; \
1212			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
1213			for site in ${MASTER_SITES}; do \
1214			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1215				DIR=${DIST_SUBDIR}; \
1216				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1217				if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1218					continue 2; \
1219				fi \
1220			done; \
1221			${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1222			${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1223			exit 1; \
1224	    fi \
1225	 done)
1226.if defined(PATCHFILES)
1227	@(cd ${_DISTDIR}; \
1228	 for file in ${PATCHFILES}; do \
1229		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1230			if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1231				${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1232				${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
1233				${ECHO_MSG} ">> Please correct this problem and try again."; \
1234				exit 1; \
1235			fi ; \
1236			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
1237			for site in ${PATCH_SITES}; do \
1238			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1239				DIR=${DIST_SUBDIR}; \
1240				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1241				if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1242					continue 2; \
1243				fi \
1244			done; \
1245			${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1246			${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1247			exit 1; \
1248	    fi \
1249	 done)
1250.endif
1251.endif
1252
1253# Extract
1254
1255.if !target(do-extract)
1256do-extract:
1257.if !defined(NO_WRKDIR)
1258	@${RM} -rf ${WRKDIR}
1259	@${MKDIR} ${WRKDIR}
1260.endif
1261	@for file in ${EXTRACT_ONLY}; do \
1262		if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1263		then \
1264			exit 1; \
1265		fi \
1266	done
1267.endif
1268
1269# Patch
1270
1271.if !target(do-patch)
1272do-patch:
1273.if defined(PATCHFILES)
1274	@${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
1275	@(cd ${_DISTDIR}; \
1276	  for i in ${PATCHFILES}; do \
1277		if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1278			${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
1279		fi; \
1280		case $$i in \
1281			*.Z|*.gz) \
1282				${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
1283				;; \
1284			*) \
1285				${PATCH} ${PATCH_DIST_ARGS} < $$i; \
1286				;; \
1287		esac; \
1288	  done)
1289.endif
1290	@if [ -d ${PATCHDIR} ]; then \
1291		if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
1292			${ECHO_MSG} "===>   Ignoring empty patch directory"; \
1293			if [ -d ${PATCHDIR}/CVS ]; then \
1294				${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
1295			fi; \
1296		else \
1297			${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
1298			for i in ${PATCHDIR}/patch-*; do \
1299				case $$i in \
1300					*.orig|*.rej|*~) \
1301						${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
1302						;; \
1303					*) \
1304						if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1305							${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
1306						fi; \
1307						${PATCH} ${PATCH_ARGS} < $$i; \
1308						;; \
1309				esac; \
1310			done; \
1311		fi; \
1312	fi
1313.endif
1314
1315# Configure
1316
1317.if !target(do-configure)
1318do-configure:
1319.if defined(USE_AUTOCONF)
1320	@(cd ${WRKSRC} && ${AUTOCONF})
1321.endif
1322	@if [ -f ${SCRIPTDIR}/configure ]; then \
1323		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1324		  ${SCRIPTDIR}/configure; \
1325	fi
1326.if defined(HAS_CONFIGURE)
1327	@(cd ${WRKSRC} && CC="${CC}" CXX="${CXX}" ac_cv_path_CC="${CC}" \
1328	    CFLAGS="${CFLAGS}" \
1329	    INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1330	    INSTALL_DATA="${INSTALL_DATA}" \
1331	    INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1332	    INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
1333	    ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
1334.endif
1335.if defined(USE_IMAKE)
1336	@(cd ${WRKSRC} && ${XMKMF})
1337.endif
1338.endif
1339
1340# Build
1341
1342.if !target(do-build)
1343do-build:
1344.if defined(USE_GMAKE)
1345	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
1346.else defined(USE_GMAKE)
1347	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
1348.endif
1349.endif
1350
1351# Install
1352
1353.if !target(do-install)
1354do-install:
1355.if defined(USE_GMAKE)
1356	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})
1357.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1358	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install.man)
1359.endif
1360.else defined(USE_GMAKE)
1361	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})
1362.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1363	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install.man)
1364.endif
1365.endif
1366.endif
1367
1368# Package
1369
1370.if !target(do-package)
1371do-package: ${TMPPLIST}
1372	@${ECHO_MSG} "===>  Building package for ${PKGNAME}"
1373	@if [ -d ${PACKAGES} ]; then \
1374		if [ ! -d ${PKGREPOSITORY} ]; then \
1375			if ! ${MKDIR} ${PKGREPOSITORY}; then \
1376				${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
1377				exit 1; \
1378			fi; \
1379		fi; \
1380	fi
1381	@if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
1382		if [ -d ${PACKAGES} ]; then \
1383			${MAKE} ${.MAKEFLAGS} package-links; \
1384		fi; \
1385	else \
1386		${MAKE} ${.MAKEFLAGS} delete-package; \
1387		exit 1; \
1388	fi
1389.endif
1390
1391# Some support rules for do-package
1392
1393.if !target(package-links)
1394package-links:
1395	@${MAKE} ${.MAKEFLAGS} delete-package-links
1396	@for cat in ${CATEGORIES}; do \
1397		if [ ! -d ${PACKAGES}/$$cat ]; then \
1398			if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1399				${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
1400				exit 1; \
1401			fi; \
1402		fi; \
1403		${LN} -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
1404	done
1405.if !defined(NO_LATEST_LINK)
1406	@if [ ! -d ${PKGLATESTREPOSITORY} ]; then \
1407		if ! ${MKDIR} ${PKGLATESTREPOSITORY}; then \
1408			${ECHO_MSG} ">> Can't create directory ${PKGLATESTREPOSITORY}."; \
1409			exit 1; \
1410		fi; \
1411	fi
1412	@${LN} -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PKGLATESTFILE}
1413.endif
1414.endif
1415
1416.if !target(delete-package-links)
1417delete-package-links:
1418	@${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX}
1419.if !defined(NO_LATEST_LINK)
1420	@${RM} -f ${PKGLATESTFILE}
1421.endif
1422.endif
1423
1424.if !target(delete-package)
1425delete-package:
1426	@${MAKE} ${.MAKEFLAGS} delete-package-links
1427	@${RM} -f ${PKGFILE}
1428.endif
1429
1430################################################################
1431# This is the "generic" port target, actually a macro used from the
1432# six main targets.  See below for more.
1433################################################################
1434
1435_PORT_USE: .USE
1436.if make(real-fetch)
1437	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1438.endif
1439.if make(real-extract)
1440	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} checksum REAL_EXTRACT=yes
1441	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1442.endif
1443.if make(real-install)
1444.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
1445	@if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1446		${ECHO_MSG} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
1447		${ECHO_MSG} "      If so, you may wish to \`\`make deinstall'' and install"; \
1448		${ECHO_MSG} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
1449		${ECHO_MSG} "      If you really wish to overwrite the old port of ${PKGNAME}"; \
1450		${ECHO_MSG} "      without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
1451		${ECHO_MSG} "      in your environment or the \"make install\" command line."; \
1452		exit 1; \
1453	fi
1454.endif
1455	@if [ `${SH} -c umask` != 0022 ]; then \
1456		${ECHO_MSG} "===>  Warning: your umask is \"`${SH} -c umask`"\".; \
1457		${ECHO_MSG} "      If this is not desired, set it to an appropriate value"; \
1458		${ECHO_MSG} "      and install this port again by \`\`make reinstall''."; \
1459	fi
1460	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1461.endif
1462.if make(real-install)
1463.if !defined(NO_MTREE)
1464	@if [ `id -u` = 0 ]; then \
1465		${MKDIR} ${PREFIX}; \
1466		if [ ! -f ${MTREE_FILE} ]; then \
1467			${ECHO_MSG} "Error: mtree file \"${MTREE_FILE}\" is missing."; \
1468			${ECHO_MSG} "Copy it from a suitable location (e.g., /usr/src/etc/mtree) and try again."; \
1469			exit 1; \
1470		else \
1471			${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
1472		fi; \
1473	else \
1474		${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
1475		${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
1476	fi
1477.endif
1478.endif
1479	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1480	@if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1481		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1482			${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
1483	fi
1484	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
1485# put here so ports can change the contents of ${TMPPLIST} if necessary
1486.if make(real-install)
1487	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} generate-plist
1488.endif
1489	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1490	@if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1491		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1492			${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
1493	fi
1494.if make(real-install) && (defined(_MANPAGES) || defined(_MLINKS))
1495	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} compress-man
1496.endif
1497.if make(real-install) && !defined(NO_PKG_REGISTER)
1498	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1499.endif
1500.if !make(real-fetch) \
1501	&& (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
1502	&& (!make(real-package) || !defined(PACKAGE_NOINSTALL))
1503	@${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
1504.endif
1505
1506################################################################
1507# Skeleton targets start here
1508#
1509# You shouldn't have to change these.  Either add the pre-* or
1510# post-* targets/scripts or redefine the do-* targets.  These
1511# targets don't do anything other than checking for cookies and
1512# call the necessary targets/scripts.
1513################################################################
1514
1515.if !target(fetch)
1516fetch:
1517	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1518.endif
1519
1520.if !target(extract)
1521extract: ${EXTRACT_COOKIE}
1522.endif
1523
1524.if !target(patch)
1525patch: ${PATCH_COOKIE}
1526.endif
1527
1528.if !target(configure)
1529configure: ${CONFIGURE_COOKIE}
1530.endif
1531
1532.if !target(build)
1533build: ${BUILD_COOKIE}
1534.endif
1535
1536.if !target(install)
1537install: ${INSTALL_COOKIE}
1538.endif
1539
1540.if !target(package)
1541package: ${PACKAGE_COOKIE}
1542.endif
1543
1544${EXTRACT_COOKIE}:
1545	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch
1546	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1547${PATCH_COOKIE}:
1548	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} extract
1549	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1550${CONFIGURE_COOKIE}:
1551	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} patch
1552	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1553${BUILD_COOKIE}:
1554	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} configure
1555	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1556${INSTALL_COOKIE}:
1557	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build
1558	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1559${PACKAGE_COOKIE}:
1560	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} install
1561	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1562
1563# And call the macros
1564
1565real-fetch: _PORT_USE
1566real-extract: _PORT_USE
1567	@${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
1568real-patch: _PORT_USE
1569	@${ECHO_MSG} "===>  Patching for ${PKGNAME}"
1570real-configure: _PORT_USE
1571	@${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
1572real-build: _PORT_USE
1573	@${ECHO_MSG} "===>  Building for ${PKGNAME}"
1574real-install: _PORT_USE
1575	@${ECHO_MSG} "===>  Installing for ${PKGNAME}"
1576real-package: _PORT_USE
1577
1578# Empty pre-* and post-* targets, note we can't use .if !target()
1579# in the _PORT_USE macro
1580
1581.for name in fetch extract patch configure build install package
1582
1583.if !target(pre-${name})
1584pre-${name}:
1585	@${DO_NADA}
1586.endif
1587
1588.if !target(post-${name})
1589post-${name}:
1590	@${DO_NADA}
1591.endif
1592
1593.endfor
1594
1595# Checkpatch
1596#
1597# Special target to verify patches
1598
1599.if !target(checkpatch)
1600checkpatch:
1601	@cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1602.endif
1603
1604# Reinstall
1605#
1606# Special target to re-run install
1607
1608.if !target(reinstall)
1609reinstall:
1610	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
1611	@DEPENDS_TARGET=${DEPENDS_TARGET} ${MAKE} install
1612.endif
1613
1614# Deinstall
1615#
1616# Special target to remove installation
1617
1618.if !target(deinstall)
1619deinstall:
1620	@${ECHO_MSG} "===>  Deinstalling for ${PKGNAME}"
1621	@${PKG_DELETE} -f ${PKGNAME}
1622	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
1623.endif
1624
1625################################################################
1626# Some more targets supplied for users' convenience
1627################################################################
1628
1629# Cleaning up
1630
1631.if !target(pre-clean)
1632pre-clean:
1633	@${DO_NADA}
1634.endif
1635
1636.if !target(clean)
1637clean: pre-clean
1638.if !defined(NOCLEANDEPENDS)
1639	@${MAKE} clean-depends
1640.endif
1641	@${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
1642.if !defined(NO_WRKDIR)
1643	@if [ -d ${WRKDIR} ]; then \
1644		if [ -w ${WRKDIR} ]; then \
1645			${RM} -rf ${WRKDIR}; \
1646		else \
1647			${ECHO_MSG} "===>   ${WRKDIR} not writable, skipping"; \
1648		fi; \
1649	fi
1650.else
1651	@${RM} -f ${WRKDIR}/.*_done ${TMPPLIST}
1652.endif
1653.endif
1654
1655.if !target(pre-distclean)
1656pre-distclean:
1657	@${DO_NADA}
1658.endif
1659
1660.if !target(distclean)
1661distclean: pre-distclean clean delete-distfiles
1662.endif
1663
1664.if !target(delete-distfiles)
1665delete-distfiles:
1666	@${ECHO_MSG} "===>  Deleting distfiles for ${PKGNAME}"
1667	@(if [ "X${DISTFILES}${PATCHFILES}" != "X" -a -d ${_DISTDIR} ]; then \
1668		cd ${_DISTDIR}; \
1669		${RM} -f ${DISTFILES} ${PATCHFILES}; \
1670	fi)
1671.if defined(DIST_SUBDIR)
1672	-@${RMDIR} ${_DISTDIR}
1673.endif
1674.endif
1675
1676# Prints out a list of files to fetch (useful to do a batch fetch)
1677
1678.if !target(fetch-list)
1679fetch-list:
1680	@${MKDIR} ${_DISTDIR}
1681	@(cd ${_DISTDIR}; \
1682	 for file in ${DISTFILES}; do \
1683		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1684			for site in ${MASTER_SITES}; do \
1685				DIR=${DIST_SUBDIR}; \
1686				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1687				${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1688					break; \
1689			done; \
1690			${ECHO} "echo $${file} not fetched" ; \
1691		fi \
1692	done)
1693.if defined(PATCHFILES)
1694	@(cd ${_DISTDIR}; \
1695	 for file in ${PATCHFILES}; do \
1696		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1697			for site in ${PATCH_SITES}; do \
1698				DIR=${DIST_SUBDIR}; \
1699				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1700				${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1701					break; \
1702			done; \
1703			${ECHO} "echo $${file} not fetched" ; \
1704		fi \
1705	 done)
1706.endif
1707.endif
1708
1709# Checksumming utilities
1710
1711.if !target(makesum)
1712makesum: fetch
1713	@${MKDIR} ${FILESDIR}
1714	@if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
1715	@(cd ${DISTDIR}; \
1716	 for file in ${_CKSUMFILES}; do \
1717		${MD5} $$file >> ${MD5_FILE}; \
1718	 done)
1719	@for file in ${_IGNOREFILES}; do \
1720		${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
1721	done
1722.endif
1723# this line goes after the ${MD5} above
1724#		echo "SIZE ($$file) = "`wc -c < $$file` >> ${MD5_FILE}; \
1725
1726
1727.if !target(checksum)
1728checksum:
1729.if !defined(REAL_EXTRACT)
1730	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch
1731.endif
1732	@if [ ! -f ${MD5_FILE} ]; then \
1733		${ECHO_MSG} ">> No MD5 checksum file."; \
1734	else \
1735		(cd ${DISTDIR}; OK="true"; \
1736		  for file in ${_CKSUMFILES}; do \
1737			CKSUM=`${MD5} < $$file`; \
1738			CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1739			if [ "$$CKSUM2" = "" ]; then \
1740				${ECHO_MSG} ">> No checksum recorded for $$file."; \
1741				OK="false"; \
1742			elif [ "$$CKSUM2" = "IGNORE" ]; then \
1743				${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
1744				${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
1745				OK="false"; \
1746			elif ${EXPR} "$$CKSUM2" : ".*$$CKSUM" > /dev/null; then \
1747				${ECHO_MSG} ">> Checksum OK for $$file."; \
1748			else \
1749				${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1750				OK="false"; \
1751			fi; \
1752		  done; \
1753		  for file in ${_IGNOREFILES}; do \
1754			CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1755			if [ "$$CKSUM2" = "" ]; then \
1756				${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
1757				OK="false"; \
1758			elif [ "$$CKSUM2" != "IGNORE" ]; then \
1759				${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
1760				${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
1761				OK="false"; \
1762			fi; \
1763		  done; \
1764		  if [ "$$OK" != "true" ]; then \
1765			${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
1766			${ECHO_MSG} "are up to date.  If you want to override this check, type"; \
1767			${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \
1768			exit 1; \
1769		  fi) ; \
1770	fi
1771.endif
1772
1773################################################################
1774# The special package-building targets
1775# You probably won't need to touch these
1776################################################################
1777
1778# Nobody should want to override this unless PKGNAME is simply bogus.
1779
1780.if !target(package-name)
1781package-name:
1782	@${ECHO} ${PKGNAME}
1783.endif
1784
1785# Show (recursively) all the packages this package depends on.
1786
1787.if !target(package-depends)
1788package-depends:
1789	@for dir in `${ECHO} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
1790		if [ -d $$dir ]; then \
1791			(cd $$dir ; ${MAKE} package-name package-depends); \
1792		else \
1793			${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
1794		fi; \
1795	done
1796.endif
1797
1798# Build a package but don't check the package cookie
1799
1800.if !target(repackage)
1801repackage: pre-repackage package
1802
1803pre-repackage:
1804	@${RM} -f ${PACKAGE_COOKIE}
1805.endif
1806
1807# Build a package but don't check the cookie for installation, also don't
1808# install package cookie
1809
1810.if !target(package-noinstall)
1811package-noinstall:
1812.if !defined(NO_WRKDIR)
1813	@${MKDIR} ${WRKDIR}
1814.endif
1815	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1816	@${RM} ${TMPPLIST}
1817	-@${RMDIR} ${WRKDIR}
1818.endif
1819
1820# Loop through several options for package building
1821
1822.if !target(package-loop)
1823.if defined(LOOP_VAR)
1824package-loop:
1825.if !exists(${PACKAGE_COOKIE})
1826.for option in ${LOOP_OPTIONS}
1827	@cd ${.CURDIR} && ${SETENV} ${LOOP_VAR}=${option} LOOP=yes \
1828		${MAKE} ${.MAKEFLAGS} clean
1829	@cd ${.CURDIR} && ${SETENV} ${LOOP_VAR}=${option} LOOP=yes \
1830		${MAKE} ${.MAKEFLAGS} package
1831.endfor
1832.else
1833	@${DO_NADA}
1834.endif
1835.else
1836package-loop: package
1837.endif
1838.endif
1839
1840################################################################
1841# Dependency checking
1842################################################################
1843
1844.if !target(depends)
1845depends: lib-depends misc-depends
1846	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1847	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
1848	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1849
1850.if make(fetch-depends)
1851DEPENDS_TMP+=	${FETCH_DEPENDS}
1852.endif
1853
1854.if make(build-depends)
1855DEPENDS_TMP+=	${BUILD_DEPENDS}
1856.endif
1857
1858.if make(run-depends)
1859DEPENDS_TMP+=	${RUN_DEPENDS}
1860.endif
1861
1862_DEPENDS_USE:	.USE
1863.if defined(DEPENDS_TMP)
1864.if !defined(NO_DEPENDS)
1865	@for i in ${DEPENDS_TMP}; do \
1866		prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1867		dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1868		if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
1869			target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1870			dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1871		else \
1872			target=${DEPENDS_TARGET}; \
1873		fi; \
1874		if ${EXPR} "$$prog" : \\/ >/dev/null; then \
1875			if [ -e "$$prog" ]; then \
1876				${ECHO_MSG} "===>   ${PKGNAME} depends on file: $$prog - found"; \
1877				notfound=0; \
1878			else \
1879				${ECHO_MSG} "===>   ${PKGNAME} depends on file: $$prog - not found"; \
1880				notfound=1; \
1881			fi; \
1882		else \
1883			if which "$$prog" > /dev/null 2>&1 ; then \
1884				${ECHO_MSG} "===>   ${PKGNAME} depends on executable: $$prog - found"; \
1885				notfound=0; \
1886			else \
1887				${ECHO_MSG} "===>   ${PKGNAME} depends on executable: $$prog - not found"; \
1888				notfound=1; \
1889			fi; \
1890		fi; \
1891		if [ $$notfound != 0 ]; then \
1892			${ECHO_MSG} "===>    Verifying $$target for $$prog in $$dir"; \
1893			if [ ! -d "$$dir" ]; then \
1894				${ECHO_MSG} "     >> No directory for $$prog.  Skipping.."; \
1895			else \
1896				(cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1897				${ECHO_MSG} "===>   Returning to build of ${PKGNAME}"; \
1898			fi; \
1899		fi; \
1900	done
1901.endif
1902.else
1903	@${DO_NADA}
1904.endif
1905
1906fetch-depends:	_DEPENDS_USE
1907build-depends:	_DEPENDS_USE
1908run-depends:	_DEPENDS_USE
1909
1910lib-depends:
1911.if defined(LIB_DEPENDS)
1912.if !defined(NO_DEPENDS)
1913	@for i in ${LIB_DEPENDS}; do \
1914		lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1915		dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1916		if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
1917			target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1918			dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1919		else \
1920			target=${DEPENDS_TARGET}; \
1921		fi; \
1922		if ${LDCONFIG} -r | ${GREP} -qwF -e "-l$$lib"; then \
1923			${ECHO_MSG} "===>   ${PKGNAME} depends on shared library: $$lib - found"; \
1924		else \
1925			${ECHO_MSG} "===>   ${PKGNAME} depends on shared library: $$lib - not found"; \
1926			${ECHO_MSG} "===>    Verifying $$target for $$lib in $$dir"; \
1927			if [ ! -d "$$dir" ]; then \
1928				${ECHO_MSG} "     >> No directory for $$lib.  Skipping.."; \
1929			else \
1930				(cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1931				${ECHO_MSG} "===>   Returning to build of ${PKGNAME}"; \
1932				if ${LDCONFIG} -r | ${GREP} -qwF -e "-l$$lib"; then \
1933					${TRUE}; \
1934				else \
1935					${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \
1936					${FALSE}; \
1937				fi; \
1938			fi; \
1939		fi; \
1940	done
1941.endif
1942.else
1943	@${DO_NADA}
1944.endif
1945
1946misc-depends:
1947.if defined(DEPENDS)
1948.if !defined(NO_DEPENDS)
1949	@for dir in ${DEPENDS}; do \
1950		if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
1951			target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1952			dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1953		else \
1954			target=${DEPENDS_TARGET}; \
1955		fi; \
1956		${ECHO_MSG} "===>   ${PKGNAME} depends on: $$dir"; \
1957		${ECHO_MSG} "===>    Verifying $$target for $$dir"; \
1958		if [ ! -d $$dir ]; then \
1959			${ECHO_MSG} "     >> No directory for $$dir.  Skipping.."; \
1960		else \
1961			(cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1962		fi \
1963	done
1964	@${ECHO_MSG} "===>   Returning to build of ${PKGNAME}"
1965.endif
1966.else
1967	@${DO_NADA}
1968.endif
1969
1970.endif
1971
1972.if !target(clean-depends)
1973clean-depends:
1974.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
1975	|| defined(RUN_DEPENDS)
1976	@for dir in `${ECHO} "${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
1977		if [ -d $$dir ] ; then \
1978			(cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1979		fi \
1980	done
1981.endif
1982.if defined(DEPENDS)
1983	@for dir in `${ECHO} "${DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
1984		if [ -d $$dir ] ; then \
1985			(cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1986		fi \
1987	done
1988.endif
1989.endif
1990
1991.if !target(depends-list)
1992depends-list:
1993	@for dir in `${ECHO} "${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
1994		if [ -d $$dir ]; then \
1995			(cd $$dir ; ${MAKE} package-name depends-list); \
1996		else \
1997			${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
1998		fi; \
1999	done
2000.endif
2001
2002################################################################
2003# Everything after here are internal targets and really
2004# shouldn't be touched by anybody but the release engineers.
2005################################################################
2006
2007# This target generates an index entry suitable for aggregation into
2008# a large index.  Format is:
2009#
2010# distribution-name|port-path|installation-prefix|comment| \
2011#  description-file|maintainer|categories|build deps|run deps
2012#
2013# If LOOP_VAR is set, multiple lines will be printed with the
2014# variable set to each value of LOOP_OPTIONS.
2015
2016.if !target(describe)
2017describe:
2018.if !defined(LOOP_VAR)
2019	@cd ${.CURDIR} && ${MAKE} do-describe
2020.else
2021.for option in ${LOOP_OPTIONS}
2022	@cd ${.CURDIR} && ${SETENV} ${LOOP_VAR}=${option} ${MAKE} do-describe
2023.endfor
2024.endif
2025.endif
2026
2027.if !target(do-describe)
2028do-describe:
2029	@${ECHO} -n "${PKGNAME}|${.CURDIR}|"; \
2030	${ECHO} -n "${PREFIX}|"; \
2031	if [ -f ${COMMENT} ]; then \
2032		${ECHO} -n "`${CAT} ${COMMENT}`"; \
2033	else \
2034		${ECHO} -n "** No Description"; \
2035	fi; \
2036	if [ -f ${DESCR} ]; then \
2037		${ECHO} -n "|${DESCR}"; \
2038	else \
2039		${ECHO} -n "|/dev/null"; \
2040	fi; \
2041	${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
2042	case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
2043		ABCDE) ;; \
2044		*) cd ${.CURDIR} && ${ECHO} -n `${MAKE} depends-list|sort -u`;; \
2045	esac; \
2046	${ECHO} -n "|"; \
2047	case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
2048		ABCD) ;; \
2049		*) cd ${.CURDIR} && ${ECHO} -n `${MAKE} package-depends|sort -u`;; \
2050	esac; \
2051	${ECHO} ""
2052.endif
2053
2054.if !target(readmes)
2055readmes:	readme
2056.endif
2057
2058.if !target(readme)
2059readme:
2060	@rm -f README.html
2061	@cd ${.CURDIR} && make README.html
2062.endif
2063
2064README.html:
2065	@${ECHO_MSG} "===>   Creating README.html for ${PKGNAME}"
2066	@${CAT} ${TEMPLATES}/README.port | \
2067		${SED} -e 's%%PORT%%'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'g' \
2068			-e 's%%PKG%%${PKGNAME}g' \
2069			-e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
2070			-e '/%%COMMENT%%/d' \
2071			-e 's%%BUILD_DEPENDS%%'"`${MAKE} print-depends-list`"'' \
2072			-e 's%%RUN_DEPENDS%%'"`${MAKE} print-package-depends`"'' \
2073		>> $@
2074
2075.if !target(print-depends-list)
2076print-depends-list:
2077.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
2078	defined(LIB_DEPENDS) || defined(DEPENDS)
2079	@${ECHO} -n 'This port requires package(s) "'
2080	@${ECHO} -n `${MAKE} depends-list | sort -u`
2081	@${ECHO} '" to build.'
2082.endif
2083.endif
2084
2085.if !target(print-package-depends)
2086print-package-depends:
2087.if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
2088	@${ECHO} -n 'This port requires package(s) "'
2089	@${ECHO} -n `${MAKE} package-depends | sort -u`
2090	@${ECHO} '" to run.'
2091.endif
2092.endif
2093
2094# Generate packing list.  Also tests to make sure all required package
2095# files exist.
2096
2097.if !target(generate-plist)
2098generate-plist:
2099	@${ECHO_MSG} "===>   Generating temporary packing list"
2100	@if [ ! -f ${PLIST} -o ! -f ${COMMENT} -o ! -f ${DESCR} ]; then ${ECHO} "** Missing package files for ${PKGNAME}."; exit 1; fi
2101	@>${TMPPLIST}
2102.for man in ${__MANPAGES}
2103	@${ECHO} ${man} >> ${TMPPLIST}
2104.endfor
2105.for _PREFIX in ${PREFIX}
2106.if ${_TMLINKS:M${_PREFIX}*}x != x
2107	@for i in ${_TMLINKS:M${_PREFIX}*:S,^${_PREFIX}/,,}; do \
2108		${ECHO} "$$i" >> ${TMPPLIST}; \
2109	done
2110.endif
2111.if ${_TMLINKS:N${_PREFIX}*}x != x
2112	@${ECHO} @cwd / >> ${TMPPLIST}
2113	@for i in ${_TMLINKS:N${_PREFIX}*:S,^/,,}; do \
2114		${ECHO} "$$i" >> ${TMPPLIST}; \
2115	done
2116	@${ECHO} '@cwd ${PREFIX}' >> ${TMPPLIST}
2117.endif
2118.endfor
2119	@${SED} ${_sedsubplist} ${PLIST} >> ${TMPPLIST}
2120.if !defined(NO_FILTER_SHLIBS)
2121.if (${PORTOBJFORMAT} == "aout")
2122	@${SED} -e 's,\(/lib.*\.so\.[0-9]*\)$$,\1.0,' ${TMPPLIST} > ${TMPPLIST}.tmp
2123.else
2124	@${SED} -e 's,\(/lib.*\.so\.[0-9]*\)\.[0-9]*$$,\1,' ${TMPPLIST} > ${TMPPLIST}.tmp
2125.endif
2126	@${MV} -f ${TMPPLIST}.tmp ${TMPPLIST}
2127.endif
2128.endif
2129
2130${TMPPLIST}:
2131	@cd ${.CURDIR} && ${MAKE} generate-plist
2132
2133# Compress (or uncompress) and symlink manpages.
2134.if !target(compress-man)
2135compress-man:
2136.if ${MANCOMPRESSED} == yes && defined(NOMANCOMPRESS)
2137	@${ECHO_MSG} "===>   Uncompressing manual pages for ${PKGNAME}"
2138.for manpage in ${_MANPAGES}
2139	@${GUNZIP_CMD} ${manpage}
2140.endfor
2141.elif ${MANCOMPRESSED} == no && !defined(NOMANCOMPRESS)
2142	@${ECHO_MSG} "===>   Compressing manual pages for ${PKGNAME}"
2143.for manpage in ${_MANPAGES}
2144	@${GZIP_CMD} ${manpage}
2145.endfor
2146.endif
2147.if defined(_MLINKS)
2148	@set ${_MLINKS:S,"",,g:S,//,/,g}; \
2149	while :; do \
2150		[ $$# -eq 0 ] && break || ${TRUE}; \
2151		${RM} -f $${2%.gz}; ${RM} -f $$2.gz; \
2152		${LN} -fs `${ECHO} $$1 $$2 | ${AWK} '{ \
2153					z=split($$1, a, /\//); x=split($$2, b, /\//); \
2154					while (a[i] == b[i]) i++; \
2155					for (q=i; q<x; q++) printf "../"; \
2156					for (; i<z; i++) printf a[i] "/"; printf a[z]; }'` $$2; \
2157		shift; shift; \
2158	done
2159.endif
2160.endif
2161
2162# Fake installation of package so that user can pkg_delete it later.
2163# Also, make sure that an installed port is recognized correctly in
2164# accordance to the @pkgdep directive in the packing lists
2165
2166.if !target(fake-pkg)
2167fake-pkg:
2168	@if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
2169.if defined(FORCE_PKG_REGISTER)
2170	@${RM} -rf ${PKG_DBDIR}/${PKGNAME}
2171.endif
2172	@if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
2173		${ECHO_MSG} "===>   Registering installation for ${PKGNAME}"; \
2174		${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
2175		${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
2176		${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
2177		${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
2178		if [ -f ${PKGDIR}/INSTALL ]; then \
2179			${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
2180		fi; \
2181		if [ -f ${PKGDIR}/DEINSTALL ]; then \
2182			${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
2183		fi; \
2184		if [ -f ${PKGDIR}/REQ ]; then \
2185			${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQUIRE; \
2186		fi; \
2187		if [ -f ${PKGDIR}/MESSAGE ]; then \
2188			${CP} ${PKGDIR}/MESSAGE ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \
2189		fi; \
2190		for dep in `${MAKE} package-depends ECHO_MSG=/usr/bin/true | sort -u`; do \
2191			if [ -d ${PKG_DBDIR}/$$dep ]; then \
2192				if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
2193					>/dev/null 2>&1; then \
2194					${ECHO} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \
2195				fi; \
2196			fi; \
2197		done; \
2198	fi
2199.endif
2200
2201# Depend is generally meaningless for arbitrary ports, but if someone wants
2202# one they can override this.  This is just to catch people who've gotten into
2203# the habit of typing `make depend all install' as a matter of course.
2204#
2205.if !target(depend)
2206depend:
2207.endif
2208
2209# Same goes for tags
2210.if !target(tags)
2211tags:
2212.endif
2213
2214.endif
2215# End of post-makefile section.
2216