xref: /illumos-gate/usr/src/cmd/su/Makefile (revision 694c35faa87b858ecdadfe4fc592615f4eefbb07)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# build two versions, su and su.static
26# su.static is dynamically linked; the .static suffix is historical.
27
28PROG =		su
29ROOTFS_PROG =	su.static
30DEFAULTFILES =	su.dfl
31
32include		../Makefile.cmd
33
34EMB_PROG =	embedded_su
35ROOTEMB_PROG =	$(ROOTLIB)/$(EMB_PROG)
36
37PROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG)
38
39# set /usr/bin/su to 4555; set /sbin/su.static to 0555
40FILEMODE =	04555
41
42$(PROG_STATIC) := FILEMODE = 0555
43
44# A reduced su.static is created, with just enough functionality
45# to satisfy the needs of a single-user login with /usr not mounted.
46# In particular, nss_files.so.1 may be dlopen()'ed at runtime.
47$(ROOTFS_PROG) :=	LDLIBS += -lbsm -lpam -lsecdb
48
49# The standard su is fully functional.
50$(PROG) :=	CPPFLAGS += -DDYNAMIC_SU
51$(PROG) :=	LDLIBS += -lbsm -lpam -lsecdb
52
53LINTFLAGS += -DDYNAMIC_SU
54
55CLOBBERFILES	+= $(ROOTFS_PROG) $(EMB_PROG)
56
57CERRWARN +=	-_gcc=-Wno-parentheses
58
59lint :=		LDLIBS += -lbsm -lpam -lsecdb
60
61.KEEP_STATE:
62
63all:		$(PROG) $(ROOTFS_PROG) $(EMB_PROG)
64
65# install rule for non-setuid /sbin/su.static
66# (exec'd by /sbin/sulogin when booting single user)
67$(ROOTFS_PROG):	$(PROG).c
68		$(LINK.c) $(PROG).c -o $@ $(LDLIBS)
69		$(POST_PROCESS)
70
71install:	all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) \
72		$(ROOTETCDEFAULTFILES) $(ROOTEMB_PROG)
73
74$(ROOTSBINPROG): $(ROOTPROG)
75		$(RM) $(ROOTSBINPROG); \
76		$(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG)
77
78$(ROOTEMB_PROG):
79		$(RM) $(ROOTEMB_PROG); \
80		$(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG)
81
82$(EMB_PROG):
83		$(RM) $(EMB_PROG); \
84		$(SYMLINK) $(PROG) $(EMB_PROG)
85
86clean:
87
88lint:		lint_PROG
89
90include		../Makefile.targ
91