summaryrefslogtreecommitdiff
path: root/mk/install/deinstall.mk
blob: 57068d77cfce9f2ada87a2a1b7199b0452c28be1 (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
# $NetBSD: deinstall.mk,v 1.11 2011/10/15 00:23:09 reed Exp $

# DEINSTALLDEPENDS controls whether dependencies and dependents are also
# removed when a package is de-installed.  The valid values are:
#
#    no		only the package is removed (if dependencies allow it)
#    yes	dependent packages are also removed
#    all	dependent packages and unused dependencies are also removed
#
DEINSTALLDEPENDS?=	no

######################################################################
### deinstall, su-deinstall (PUBLIC)
######################################################################
### deinstall is a public target to remove an installed package.
### It will acquire elevated privileges just-in-time.
###
.PHONY: deinstall su-deinstall
.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
.  if !target(deinstall)
deinstall: su-deinstall
	@${PHASE_MSG} "Deinstalling for ${PKGNAME}"
.  endif
.else
.  if !target(deinstall)
deinstall: su-target
	@${PHASE_MSG} "Deinstalling for ${PKGNAME}"
.  endif
.endif

_SU_DEINSTALL_TARGETS=	acquire-deinstall-lock
_SU_DEINSTALL_TARGETS+=	_pkgformat-deinstall
_SU_DEINSTALL_TARGETS+=	release-deinstall-lock
.if ${_USE_DESTDIR} == "no"
_SU_DEINSTALL_TARGETS+=	install-clean
.endif
su-deinstall: ${_SU_DEINSTALL_TARGETS}

.PHONY: acquire-deinstall-lock release-deinstall-lock
acquire-deinstall-lock: acquire-localbase-lock
release-deinstall-lock: release-localbase-lock

MAKEFLAGS.su-deinstall+=	DEINSTALLDEPENDS=${DEINSTALLDEPENDS}

######################################################################
### reinstall (PUBLIC)
######################################################################
### reinstall is a special target to re-run the install target.
### It will acquire elevated privileges just-in-time.
###
.PHONY: reinstall
.if !target(reinstall)
reinstall: install-clean install
.endif