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