summaryrefslogtreecommitdiff
path: root/mk/package/bsd.package.mk
blob: 91f4d11267591abb4448e830a5201c15f4e71c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# $NetBSD: bsd.package.mk,v 1.8 2006/10/08 20:31:38 rillig Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to binary packages.
#
# The following are the "public" targets provided by this module:
#
#    package, repackage
#
# The following variables may be set by the package:
#
# MAKE_PACKAGE_AS_ROOT: YesNo
#	When this variable is set to "no", the package is created by
#	the user that also built the package. Since most packages don't
#	need root privileges to create the package, the default value
#	is "no". Packages that install unreadable files (for example
#	with mode 4111) need to set this variable to "yes".
#
#	Default value: "yes", but this will change to "no" after most
#	packages that really need this option have been identified.

MAKE_PACKAGE_AS_ROOT?=	yes

_COOKIE.package=	${WRKDIR}/.package_done

######################################################################
### package (PUBLIC)
######################################################################
### package is a public target to generate a binary package.
###
.PHONY: package
.if !defined(NO_PACKAGE)
.  include "${PKGSRCDIR}/mk/package/package.mk"
.elif !target(package)
.  if exists(${_COOKIE.package})
package:
	@${DO_NADA}
.  elif defined(_PKGSRC_BARRIER)
package: install
.    if defined(SKIP_SILENT)
	@${DO_NADA}
.    else
	@${PHASE_MSG} "${PKGNAME} may not be packaged: "${NO_PACKAGE:Q}"."
.    endif
.  else
package: barrier
.  endif
.endif

######################################################################
### repackage (PUBLIC)
######################################################################
### repackage is a special target to re-run the package target.
###
.PHONY: repackage
.if !target(repackage)
repackage: package-clean package
.endif

######################################################################
### package-clean (PRIVATE)
######################################################################
### package-clean removes the state files associated with the "package"
### phase so that the "package" target may be re-invoked.
###
package-clean:
	${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${_COOKIE.package}