Merge commit '00f1a4f432b3d8aad1aa270e91c44c57f03ef407'
[unleashed.git] / usr / src / cmd / su / Makefile
blobb8063d34f5fa8259f688e55661d53c2efc2abb86
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
25 # build two versions, su and su.static
26 # su.static is dynamically linked; the .static suffix is historical.
28 PROG = su
29 ROOTFS_PROG = su.static
30 DEFAULTFILES = su.dfl
32 include ../Makefile.cmd
34 EMB_PROG = embedded_su
35 ROOTEMB_PROG = $(ROOTLIB)/$(EMB_PROG)
37 PROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG)
39 # set /usr/bin/su to 4555; set /sbin/su.static to 0555
40 FILEMODE = 04555
42 $(PROG_STATIC) := FILEMODE = 0555
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
49 # The standard su is fully functional.
50 $(PROG) := CPPFLAGS += -DDYNAMIC_SU
51 $(PROG) := LDLIBS += -lbsm -lpam -lsecdb
54 CLOBBERFILES += $(ROOTFS_PROG) $(EMB_PROG)
56 CERRWARN += -Wno-parentheses
59 .KEEP_STATE:
61 all: $(PROG) $(ROOTFS_PROG) $(EMB_PROG)
63 # install rule for non-setuid /sbin/su.static
64 # (exec'd by /sbin/sulogin when booting single user)
65 $(ROOTFS_PROG): $(PROG).c
66 $(LINK.c) $(PROG).c -o $@ $(LDLIBS)
67 $(POST_PROCESS)
69 install: all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) \
70 $(ROOTETCDEFAULTFILES) $(ROOTEMB_PROG)
72 $(ROOTSBINPROG): $(ROOTPROG)
73 $(RM) $(ROOTSBINPROG); \
74 $(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG)
76 $(ROOTEMB_PROG):
77 $(RM) $(ROOTEMB_PROG); \
78 $(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG)
80 $(EMB_PROG):
81 $(RM) $(EMB_PROG); \
82 $(SYMLINK) $(PROG) $(EMB_PROG)
84 clean:
87 include ../Makefile.targ