bsd.port.mk revision 5508
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.99 1995/01/10 12:23:44 jkh Exp $
7#
8# Please view me with 4 column tabs!
9
10
11# Supported Variables and their behaviors:
12#
13# Variables that typically apply to all ports:
14# 
15# PORTSDIR		- The root of the ports tree (default: /usr/ports).
16# DISTDIR 		- Where to get gzip'd, tarballed copies of original sources
17#				  (default: ${PORTSDIR}/distfiles).
18# PREFIX		- Where to install things in general (default: /usr/local).
19# MASTER_SITES	- Primary location(s) for distribution files if not found
20#				  locally (default:
21#				   ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles)
22#
23# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
24#				  value.
25# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for
26#				  MASTER_SITES.
27# PACKAGES		- A top level directory where all packages go (rather than
28#				  going locally to each port). (default: ${PORTSDIR}/packages).
29# GMAKE			- Set to path of GNU make if not in $PATH (default: gmake).
30# XMKMF			- Set to path of `xmkmf' if not in $PATH (default: xmkmf).
31#
32# Variables that typically apply to an individual port.  Non-Boolean
33# variables without defaults are *mandatory*.
34# 
35#
36# WRKDIR 		- A temporary working directory that gets *clobbered* on clean
37#				  (default: ${.CURDIR}/work).
38# WRKSRC		- A subdirectory of ${WRKDIR} where the distribution actually
39#				  unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
40#				  NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
41# DISTNAME		- Name of port or distribution.
42# DISTFILES		- Name(s) of archive file(s) containing distribution
43#				  (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}).
44# PKGNAME		- Name of the package file to create if the DISTNAME 
45#				  isn't really relevant for the port/package
46#				  (default: ${DISTNAME}).
47# EXTRACT_ONLY	- If defined, a subset of ${DISTFILES} you want to
48#			  	  actually extract.
49# PATCHDIR 		- A directory containing any required patches
50#				  (default: ${.CURDIR}/patches)
51# SCRIPTDIR 	- A directory containing any auxiliary scripts
52#				  (default: ${.CURDIR}/scripts)
53# FILESDIR 		- A directory containing any miscellaneous additional files.
54#				  (default: ${.CURDIR}/files)
55# PKGDIR 		- A direction containing any package creation files.
56#				  (default: ${.CURDIR}/pkg)
57#
58# NO_EXTRACT	- Use a dummy (do-nothing) extract target.
59# NO_CONFIGURE	- Use a dummy (do-nothing) configure target.
60# NO_BUILD		- Use a dummy (do-nothing) build target.
61# NO_PACKAGE	- Use a dummy (do-nothing) package target.
62# NO_INSTALL	- Use a dummy (do-nothing) install target.
63# NO_WRKSUBDIR	- Assume port unpacks directly into ${WRKDIR}.
64# NO_WRKDIR		- There's no work directory at all; port does this someplace
65#				  else.
66# NO_DEPENDS	- Don't verify build of dependencies.
67# USE_GMAKE		- Says that the port uses gmake.
68# USE_IMAKE		- Says that the port uses imake.
69# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
70#						target.
71# HAS_CONFIGURE	- Says that the port has its own configure script.
72# GNU_CONFIGURE	- Set if you are using GNU configure (optional).
73# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set.
74# IS_INTERACTIVE - Set this if your port needs to interact with the user
75#				  during a build.  User can then decide to skip this port by
76#				  setting ${BATCH}, or compiling only the interactive ports
77#				  by setting ${INTERACTIVE}.
78# DEPENDS		- A list of other ports this package depends on being
79#				  made first, relative to ${PORTSDIR} (e.g. x11/tk, lang/tcl,
80#				  etc).
81# EXTRACT_CMD	- Command for extracting archive (default: tar).
82# EXTRACT_SUFX	- Suffix for archive names (default: .tar.gz).
83# EXTRACT_ARGS	- Arguments to ${EXTRACT_CMD} (default: -C ${WRKDIR} -xzf).
84#
85# NCFTP			- Full path to ncftp command if not in $PATH (default: ncftp).
86# NCFTPFLAGS    - Arguments to ${NCFTP} (default: -N).
87#
88#
89# Default targets and their behaviors:
90#
91# fetch			- Retrieves ${DISTFILES} into ${DISTDIR} as necessary.
92# extract		- Unpacks ${DISTFILES} into ${WRKDIR}.
93# configure		- Applies patches, if any, and runs either GNU configure, one
94#				  or more local configure scripts or nothing, depending on
95#				  what's available.
96# patch			- Apply any provided patches to the source.
97# build			- Actually compile the sources.
98# install		- Install the results of a build.
99# reinstall		- Install the results of a build, ignoring "already installed"
100#				  flag.
101# package		- Create a package from a build.
102# describe		- Try to generate a one-line description for each port for
103#				  use in INDEX files and the like.
104# checksum		- Use files/md5 to ensure that your distfiles are valid
105# makesum		- Generate files/md5
106#
107# Default sequence for "all" is:  fetch extract configure build
108
109.if exists(${.CURDIR}/../Makefile.inc)
110.include "${.CURDIR}/../Makefile.inc"
111.endif
112
113# These need to be absolute since we don't know how deep in the ports
114# tree we are and thus can't go relative.  They can, of course, be overridden
115# by individual Makefiles.
116PORTSDIR?=		${DESTDIR}/usr/ports
117X11BASE?=		/usr/X11R6
118DISTDIR?=		${PORTSDIR}/distfiles
119PACKAGES?=		${PORTSDIR}/packages
120.if !defined(NO_WRKDIR)
121WRKDIR?=		${.CURDIR}/work
122.else
123WRKDIR?=		${.CURDIR}
124.endif
125.if defined(NO_WRKSUBDIR)
126WRKSRC?=		${WRKDIR}
127.else
128WRKSRC?=		${WRKDIR}/${DISTNAME}
129.endif
130PATCHDIR?=		${.CURDIR}/patches
131SCRIPTDIR?=		${.CURDIR}/scripts
132FILESDIR?=		${.CURDIR}/files
133PKGDIR?=		${.CURDIR}/pkg
134.if defined(USE_IMAKE)
135PREFIX?=		${X11BASE}
136.else
137PREFIX?=		/usr/local
138.endif
139.if defined(USE_GMAKE)
140DEPENDS+=               ${PORTSDIR}/devel/gmake
141.endif
142
143.if exists(${PORTSDIR}/../Makefile.inc)
144.include "${PORTSDIR}/../Makefile.inc"
145.endif
146
147
148# Change these if you'd prefer to keep the cookies someplace else.
149EXTRACT_COOKIE?=	${WRKDIR}/.extract_done
150CONFIGURE_COOKIE?=	${WRKDIR}/.configure_done
151INSTALL_COOKIE?=	${WRKDIR}/.install_done
152BUILD_COOKIE?=		${WRKDIR}/.build_done
153PATCH_COOKIE?=		${WRKDIR}/.patch_done
154
155# How to do nothing.  Override if you, for some strange reason, would rather
156# do something.
157DO_NADA?=		echo -n
158
159# Miscellaneous overridable commands:
160GMAKE?=			gmake
161XMKMF?=			xmkmf
162MD5?=			md5
163MD5_FILE?=		${FILESDIR}/md5
164MAKE_FLAGS?=	-f
165MAKEFILE?=		Makefile
166
167NCFTP?=			ncftp
168NCFTPFLAGS?=	-N
169
170TOUCH?=			touch
171TOUCH_FLAGS?=	-f
172
173PATCH?=			patch
174PATCH_STRIP?=	-p0
175.if defined(PATCH_DEBUG)
176PATCH_ARGS?=	-d ${WRKSRC} -E ${PATCH_STRIP}
177.else
178PATCH_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
179.endif
180
181EXTRACT_CMD?=	tar
182EXTRACT_SUFX?=	.tar.gz
183EXTRACT_ARGS?=	-C ${WRKDIR} -xzf
184
185PKG_CMD?=		pkg_create
186PKG_ARGS?=		-v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX}
187PKG_SUFX?=		.tgz
188
189ALL_TARGET?=		all
190INSTALL_TARGET?=	install
191
192.if defined(MASTER_SITE_FREEBSD)
193MASTER_SITE_OVERRIDE=  ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 
194.endif
195
196# I guess we're in the master distribution business! :)  As we gain mirror
197# sites for distfiles, add them to this list.
198.if !defined(MASTER_SITE_OVERRIDE)
199MASTER_SITES+=	ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/
200.else
201MASTER_SITES=	${MASTER_SITE_OVERRIDE}
202.endif
203
204# Derived names so that they're easily overridable.
205DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
206PKGNAME?=		${DISTNAME}
207
208.if exists(${PACKAGES})
209PKGFILE?=		${PACKAGES}/${PKGNAME}${PKG_SUFX}
210.else
211PKGFILE?=		${PKGNAME}${PKG_SUFX}
212.endif
213
214.if defined(GNU_CONFIGURE)
215CONFIGURE_ARGS?=	--prefix=${PREFIX}
216HAS_CONFIGURE=		yes
217.endif
218
219.MAIN: all
220
221# If we're in BATCH mode and the port is interactive, or we're in
222# interactive mode and the port is non-interactive, skip all the important
223# targets.  The reason we have two modes is that one might want to leave
224# a build in BATCH mode running overnight, then come back in the morning
225# and do _only_ the interactive ones that required your intervention.
226# This allows you to do both.
227#
228.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
229all:
230	@${DO_NADA}
231pre-build:
232	@${DO_NADA}
233build:
234	@${DO_NADA}
235pre-install:
236	@${DO_NADA}
237install:
238	@${DO_NADA}
239pre-fetch:
240	@${DO_NADA}
241fetch:
242	@${DO_NADA}
243pre-configure:
244	@${DO_NADA}
245configure:
246	@${DO_NADA}
247.endif
248
249.if !target(all)
250all: extract configure build
251.endif
252
253.if !target(is_depended)
254is_depended:	all install
255.endif
256
257# The following are used to create easy dummy targets for disabling some
258# bit of default target behavior you don't want.  They still check to see
259# if the target exists, and if so don't do anything, since you might want
260# to set this globally for a group of ports in a Makefile.inc, but still
261# be able to override from an individual Makefile (since you can't _undefine_
262# a variable in make!).
263.if defined(NO_EXTRACT) && !target(extract)
264extract:
265	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
266checksum:
267	@${DO_NADA}
268makesum:
269	@${DO_NADA}
270.endif
271.if defined(NO_CONFIGURE) && !target(configure)
272configure:
273	@${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
274.endif
275.if defined(NO_BUILD) && !target(build)
276build:
277	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
278.endif
279.if defined(NO_PACKAGE) && !target(package)
280package:
281	@${DO_NADA}
282.endif
283.if defined(NO_INSTALL) && !target(install)
284install:
285	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
286.endif
287.if defined(NO_PATCH) && !target(patch)
288patch:
289	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
290.endif
291
292# More standard targets start here.
293
294.if !target(describe)
295describe:
296.if defined(NO_PACKAGE)
297	@echo "${.CURDIR}/${DISTNAME}:   ** Not packageable";
298.else
299	@if [ -f ${PKGDIR}/COMMENT ]; then \
300		echo "${.CURDIR}/${DISTNAME}:	`cat ${PKGDIR}/COMMENT`"; \
301	else \
302		echo "${.CURDIR}/${DISTNAME}:	** No Description"; \
303	fi
304.endif
305.endif
306
307.if !target(reinstall)
308reinstall: pre-reinstall install
309
310pre-reinstall:
311	@rm -f ${INSTALL_COOKIE}
312.endif
313
314.if !target(pre-install)
315pre-install:
316	@${DO_NADA}
317.endif
318
319.if !target(install)
320install: build ${INSTALL_COOKIE}
321
322${INSTALL_COOKIE}:
323	@echo "===>  Installing for ${DISTNAME}"
324	@${MAKE} ${.MAKEFLAGS} pre-install
325.if defined(USE_GMAKE)
326	@(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
327.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
328	@(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
329.endif
330.else defined(USE_GMAKE)
331	@(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
332.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
333	@(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
334.endif
335.endif
336	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
337.endif
338
339.if !target(pre-package)
340pre-package:
341	@${DO_NADA}
342.endif
343
344.if !target(package)
345package: pre-package
346# Makes some gross assumptions about a fairly simple package with no
347# install, require or deinstall scripts.  Override the arguments with
348# PKG_ARGS if your package is anything but run-of-the-mill.
349	@if [ -d ${PKGDIR} ]; then \
350		echo "===>  Building package for ${DISTNAME}"; \
351		${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \
352	fi
353.endif
354
355.if !target(depends)
356depends:
357.if defined(DEPENDS)
358	@echo "===>  ${DISTNAME} depends on:  ${DEPENDS}"
359.if !defined(NO_DEPENDS)
360	@for i in ${DEPENDS}; do \
361		echo "===>  Verifying build for $$i"; \
362		if [ ! -d $$i ]; then \
363			echo ">> No directory for $$i.  Skipping.."; \
364		else \
365			(cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
366		fi \
367	done
368	@echo "===>  Returning to build of ${DISTNAME}"
369.endif
370.endif
371.endif
372
373.if !target(pre-build)
374pre-build:
375	@${DO_NADA}
376.endif
377
378.if !target(build)
379build: configure ${BUILD_COOKIE}
380
381${BUILD_COOKIE}:
382	@echo "===>  Building for ${DISTNAME}"
383	@${MAKE} ${.MAKEFLAGS} pre-build
384.if defined(USE_GMAKE)
385	@(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
386.else defined(USE_GMAKE)
387	@(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
388.endif
389	@if [ -f ${SCRIPTDIR}/post-build ]; then \
390		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
391		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
392		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
393		  DEPENDS="${DEPENDS}" \
394		sh ${SCRIPTDIR}/post-build; \
395	fi
396	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
397.endif
398
399.if !target(pre-patch)
400pre-patch:
401	@${DO_NADA}
402.endif
403
404.if !target(patch)
405patch: extract ${PATCH_COOKIE}
406
407${PATCH_COOKIE}:
408	@${MAKE} ${.MAKEFLAGS} pre-patch
409.if defined(PATCH_DEBUG)
410	@if [ -d ${PATCHDIR} ]; then \
411		echo "===>  Applying patches for ${DISTNAME}" ; \
412		for i in ${PATCHDIR}/patch-*; do \
413			echo "===>   Applying patch $$i" ; \
414			${PATCH} ${PATCH_ARGS} < $$i; \
415		done; \
416	fi
417	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
418.else
419	@if [ -d ${PATCHDIR} ]; then \
420		echo "===>  Applying patches for ${DISTNAME}" ; \
421		for i in ${PATCHDIR}/patch-*; \
422			do ${PATCH} ${PATCH_ARGS} < $$i; \
423		done;\
424	fi
425	@${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
426.endif
427.endif
428
429.if !target(pre-configure)
430pre-configure:
431	@${DO_NADA}
432.endif
433
434.if !target(configure)
435configure: depends patch ${CONFIGURE_COOKIE}
436
437${CONFIGURE_COOKIE}:
438	@echo "===>  Configuring for ${DISTNAME}"
439	@${MAKE} ${.MAKEFLAGS} pre-configure
440	@if [ -f ${SCRIPTDIR}/pre-configure ]; then \
441		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
442		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
443		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
444		  DEPENDS="${DEPENDS}" \
445		sh ${SCRIPTDIR}/pre-configure; \
446	fi
447	@if [ -f ${SCRIPTDIR}/configure ]; then \
448		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
449		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
450		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
451		  DEPENDS="${DEPENDS}" \
452		sh ${SCRIPTDIR}/configure; \
453	fi
454.if defined(HAS_CONFIGURE)
455	@(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
456	    INSTALL="${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP}" \
457	    INSTALL_PROGRAM="${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \
458	    ./configure ${CONFIGURE_ARGS})
459.endif
460.if defined(USE_IMAKE)
461.if defined(USE_GMAKE)
462	@(cd ${WRKSRC}; ${XMKMF} && ${GMAKE} Makefiles)
463.else
464	@(cd ${WRKSRC}; ${XMKMF} && ${MAKE} Makefiles)
465.endif
466.endif
467	@if [ -f ${SCRIPTDIR}/post-configure ]; then \
468		env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
469		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
470		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
471		  DEPENDS="${DEPENDS}" \
472		sh ${SCRIPTDIR}/post-configure; \
473	fi
474	@${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
475.endif
476
477.if !target(pre-fetch)
478pre-fetch:
479	@${DO_NADA}
480.endif
481
482.if !target(fetch)
483fetch: pre-fetch
484	@if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi
485	@(cd ${DISTDIR}; \
486	 for file in ${DISTFILES}; do \
487		if [ ! -f $$file ]; then \
488			echo ">> $$file doesn't seem to exist on this system."; \
489			echo ">> Attempting to fetch it from a master site."; \
490			for site in ${MASTER_SITES}; do \
491				if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \
492					break; \
493				fi \
494			done; \
495			if [ ! -f $$file ]; then \
496				echo ">> Couldn't fetch it - please try to retreive this";\
497				echo ">> port manually into ${DISTDIR} and try again."; \
498				exit 1; \
499			fi; \
500	    fi \
501	 done)
502.endif
503
504.if !target(makesum)
505makesum: fetch
506	@if [ ! -d ${FILESDIR} ]; then mkdir -p ${FILESDIR}; fi
507	@if [ -f ${MD5_FILE} ]; then rm -f ${MD5_FILE}; fi
508	
509	@(cd ${DISTDIR}; \
510	for file in ${DISTFILES}; do \
511		${MD5} $$file >> ${MD5_FILE}; \
512	done)
513.endif
514
515.if !target(checksum)
516checksum: fetch
517	@if [ ! -f ${MD5_FILE} ]; then \
518		echo ">> No MD5 checksum file."; \
519	else \
520		(cd ${DISTDIR}; \
521	for file in ${DISTFILES}; do \
522		CKSUM=`${MD5} $$file | awk '{print $$4}'`; \
523		CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \
524		if [ "$$CKSUM" != "$$CKSUM2" ]; then \
525			echo ">> Checksum mismatch for $$file"; \
526			exit 1; \
527		fi; \
528		done); \
529		echo "Checksums OK."; \
530	fi
531.endif
532
533.if !target(pre-extract)
534pre-extract:
535	@${DO_NADA}
536.endif
537
538.if !target(extract)
539# We need to depend on .extract_done rather than the presence of ${WRKDIR}
540# because if the user interrupts the extract in the middle (and it's often
541# a long procedure), we get tricked into thinking that we've got a good dist
542# in ${WRKDIR}.
543extract: fetch ${EXTRACT_COOKIE}
544
545${EXTRACT_COOKIE}:
546	@${MAKE} ${.MAKEFLAGS} checksum pre-extract
547	@echo "===>  Extracting for ${DISTNAME}"
548	@rm -rf ${WRKDIR}
549	@mkdir -p ${WRKDIR}
550.if defined(EXTRACT_ONLY)
551	@for file in ${EXTRACT_ONLY}; do \
552		! if ${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTDIR}/$$file; then \
553			exit 1; \
554		fi \
555	done
556.else
557	@for file in ${DISTFILES}; do \
558		! if ${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTDIR}/$$file; then \
559			exit 1; \
560		fi \
561	done
562.endif
563	@${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
564.endif
565
566.if !target(pre-clean)
567pre-clean:
568	@${DO_NADA}
569.endif
570
571.if !target(clean)
572clean: pre-clean
573	@echo "===>  Cleaning for ${DISTNAME}"
574	@rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \
575		${BUILD_COOKIE} ${PATCH_COOKIE}
576.if !defined(NO_WRKDIR)
577	@rm -rf ${WRKDIR}
578.endif
579.endif
580
581# No pre-targets for depend or tags.  It would be silly.
582
583# Depend is generally meaningless for arbitrary ports, but if someone wants
584# one they can override this.  This is just to catch people who've gotten into
585# the habit of typing `make depend all install' as a matter of course.
586#
587.if !target(depend)
588depend:
589.endif
590
591# Same goes for tags
592.if !target(tags)
593tags:
594.endif
595