xref: /illumos-gate/usr/src/cmd/su/Makefile (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# build two versions, su and su.static
29# su.static is dynamically linked; the .static suffix is historical.
30
31PROG =		su
32ROOTFS_PROG =	su.static
33DEFAULTFILES =	su.dfl
34
35include		../Makefile.cmd
36
37EMB_PROG =	embedded_su
38ROOTEMB_PROG =	$(ROOTLIB)/$(EMB_PROG)
39
40PROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG)
41
42# set /usr/bin/su to 4555; set /sbin/su.static to 0555
43FILEMODE =	04555
44
45GROUP =		sys
46
47$(PROG_STATIC) := FILEMODE = 0555
48
49# A reduced su.static is created, with just enough functionality
50# to satisfy the needs of a single-user login with /usr not mounted.
51# In particular, nss_files.so.1 may be dlopen()'ed at runtime.
52$(ROOTFS_PROG) :=	LDLIBS += -lcmd -lbsm -lpam
53
54# The standard su is fully functional.
55$(PROG) :=	CPPFLAGS += -DDYNAMIC_SU
56$(PROG) :=	LDLIBS += -lcmd -lbsm -lpam
57
58LINTFLAGS += -DDYNAMIC_SU
59
60CLOBBERFILES	+= $(ROOTFS_PROG) $(EMB_PROG)
61
62lint :=		LDLIBS += -lcmd -lbsm -lpam
63
64.KEEP_STATE:
65
66all:		$(PROG) $(ROOTFS_PROG) $(EMB_PROG)
67
68# install rule for non-setuid /sbin/su.static
69# (exec'd by /sbin/sulogin when booting single user)
70$(ROOTFS_PROG):	$(PROG).c
71		$(LINK.c) $(PROG).c -o $@ $(LDLIBS)
72		$(POST_PROCESS)
73
74install:	all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) \
75		$(ROOTETCDEFAULTFILES) $(ROOTEMB_PROG)
76
77$(ROOTSBINPROG): $(ROOTPROG)
78		$(RM) $(ROOTSBINPROG); \
79		$(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG)
80
81$(ROOTEMB_PROG):
82		$(RM) $(ROOTEMB_PROG); \
83		$(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG)
84
85$(EMB_PROG):
86		$(RM) $(EMB_PROG); \
87		$(SYMLINK) $(PROG) $(EMB_PROG)
88
89clean:
90
91lint:		lint_PROG
92
93include		../Makefile.targ
94