summaryrefslogtreecommitdiff
path: root/mk/install/replace.mk
blob: f1918fad77dce87353c87c8c98d74fc6573962b8 (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
68
69
70
71
72
73
# $NetBSD: replace.mk,v 1.12 2011/06/04 10:05:00 obache Exp $
#
# Public targets:
#
# replace:
#	Updates a package in-place on the system.
#	It will acquire elevated privileges just-in-time.
#
# undo-replace:
#	Undoes the effects of a previous "make replace".
#	It will acquire elevated privileges just-in-time.
#
#
# Private targets that must be defined by the package system flavor:
#
# _flavor-replace:
#	Updates a package in-place on the system (USE_DESTDIR=no).
#
# _flavor-destdir-replace:
#	Updates a package in-place on the system (USE_DESTDIR=yes).
#
# _flavor-undo-replace:
#	Undoes a previous "make _flavor-replace".

# _flavor-destdir-undo-replace:
#	Undoes a previous "make _flavor-destdir-replace".

.if ${_USE_DESTDIR} == "no"
_REPLACE_TARGETS+=	${_PKGSRC_BUILD_TARGETS}
.else
_REPLACE_TARGETS+=	package
.endif
_REPLACE_TARGETS+=	replace-message
_REPLACE_TARGETS+=	unprivileged-install-hook

#
# replace
#

.PHONY: replace
.if defined(_PKGSRC_BARRIER)
replace: ${_REPLACE_TARGETS} su-target
.else
replace: barrier
.endif

replace-message: .PHONY
	@${PHASE_MSG} "Replacing for ${PKGNAME}"
	@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."

.if ${_USE_DESTDIR} == "no"
su-replace: .PHONY _flavor-replace
.else
su-replace: .PHONY _flavor-destdir-replace
.endif
MAKEFLAGS.su-replace=	_UPDATE_RUNNING=yes

#
# undo-replace
#

undo-replace: .PHONY undo-replace-message su-target

undo-replace-message: .PHONY
	@${PHASE_MSG} "Undoing replacement for ${PKGNAME}"
	@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."

.if ${_USE_DESTDIR} == "no"
su-undo-replace: .PHONY _flavor-undo-replace
.else
su-undo-replace: .PHONY _flavor-destdir-undo-replace
.endif
MAKEFLAGS.su-undo-replace=	_UPDATE_RUNNING=yes