summaryrefslogtreecommitdiff
path: root/Makefile.binary.in
blob: 60d05eaba0c1c39565330ed34a34fe80dd04d2dc (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#
# Copyright (c) 1996, 1998-2002,2004 Todd C. Miller <Todd.Miller@courtesan.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

srcdir = .

# Which install program?
INSTALL = $(srcdir)/install-sh -c

# For installing the shared lib
LIBTOOL = $(srcdir)/libtool

# Where to install things...
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
sysconfdir = @sysconfdir@
mandir = @mandir@
noexecdir = @NOEXECDIR@

# Directory in which to install sudo.
sudodir = $(bindir)

# Directory in which to install visudo
visudodir = $(sbindir)

# Directory in which to install the sudoers file
sudoersdir = $(sysconfdir)

# Directory in which to install the man page
mantype = @MANTYPE@
mansectsu = @mansectsu@
mansectform = @mansectform@
mandirsu = $(mandir)/$(mantype)$(mansectsu)
mandirform = $(mandir)/$(mantype)$(mansectform)

# User and group ids the installed files should be "owned" by
install_uid = 0
install_gid = 0

# User, group, and mode the sudoers file should be "owned" by
sudoers_uid = @SUDOERS_UID@
sudoers_gid = @SUDOERS_GID@
sudoers_mode = @SUDOERS_MODE@

SHELL = /bin/sh

PROGS = @PROGS@

all: $(PROGS)
	@echo run 'make install' to install sudo

install: install-dirs install-binaries @INSTALL_NOEXEC@ install-sudoers install-man

install-dirs:
	$(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(sudodir) \
	    $(DESTDIR)$(visudodir) $(DESTDIR)$(sudoersdir) \
	    $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform) \
	    $(DESTDIR)$(noexecdir)

install-binaries: $(PROGS)
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 4111 sudo $(DESTDIR)$(sudodir)/sudo
	rm -f $(DESTDIR)$(sudodir)/sudoedit
	ln $(DESTDIR)$(sudodir)/sudo $(DESTDIR)$(sudodir)/sudoedit
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0111 visudo $(DESTDIR)$(visudodir)/visudo

install-noexec: sudo_noexec.la
	$(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la $(DESTDIR)$(noexecdir)

install-sudoers:
	test -f $(DESTDIR)$(sudoersdir)/sudoers || \
	    $(INSTALL) -O $(sudoers_uid) -G $(sudoers_gid) -M $(sudoers_mode) \
		$(srcdir)/sudoers $(DESTDIR)$(sudoersdir)/sudoers

install-man:
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
	@rm -f $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
	ln $(DESTDIR)$(mandirsu)/sudo.$(mansectsu) $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/visudo.$(mantype) $(DESTDIR)$(mandirsu)/visudo.$(mansectsu)
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudoers.$(mantype) $(DESTDIR)$(mandirform)/sudoers.$(mansectform)
@MAN_POSTINSTALL@

check:
	@echo nothing to check

clean:
	@echo nothing to clean

mostlyclean: clean

distclean: clean

clobber: clean

realclean: clean

cleandir: clean