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