xref: /titanic_51/usr/src/cmd/su/Makefile (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
509295472Sgww# Common Development and Distribution License (the "License").
609295472Sgww# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2224fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# build two versions, su and su.static
267c478bd9Sstevel@tonic-gate# su.static is dynamically linked; the .static suffix is historical.
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gatePROG =		su
297c478bd9Sstevel@tonic-gateROOTFS_PROG =	su.static
30a7872406SmeemDEFAULTFILES =	su.dfl
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateinclude		../Makefile.cmd
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gateEMB_PROG =	embedded_su
357c478bd9Sstevel@tonic-gateROOTEMB_PROG =	$(ROOTLIB)/$(EMB_PROG)
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gatePROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG)
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gate# set /usr/bin/su to 4555; set /sbin/su.static to 0555
407c478bd9Sstevel@tonic-gateFILEMODE =	04555
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gate$(PROG_STATIC) := FILEMODE = 0555
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate# A reduced su.static is created, with just enough functionality
457c478bd9Sstevel@tonic-gate# to satisfy the needs of a single-user login with /usr not mounted.
467c478bd9Sstevel@tonic-gate# In particular, nss_files.so.1 may be dlopen()'ed at runtime.
4706e1a714Sraf$(ROOTFS_PROG) :=	LDLIBS += -lbsm -lpam -lsecdb
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gate# The standard su is fully functional.
507c478bd9Sstevel@tonic-gate$(PROG) :=	CPPFLAGS += -DDYNAMIC_SU
5106e1a714Sraf$(PROG) :=	LDLIBS += -lbsm -lpam -lsecdb
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gateLINTFLAGS += -DDYNAMIC_SU
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gateCLOBBERFILES	+= $(ROOTFS_PROG) $(EMB_PROG)
567c478bd9Sstevel@tonic-gate
57*7014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
58*7014882cSRichard Lowe
5906e1a714Sraflint :=		LDLIBS += -lbsm -lpam -lsecdb
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate.KEEP_STATE:
627c478bd9Sstevel@tonic-gate
63a7872406Smeemall:		$(PROG) $(ROOTFS_PROG) $(EMB_PROG)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate# install rule for non-setuid /sbin/su.static
667c478bd9Sstevel@tonic-gate# (exec'd by /sbin/sulogin when booting single user)
677c478bd9Sstevel@tonic-gate$(ROOTFS_PROG):	$(PROG).c
687c478bd9Sstevel@tonic-gate		$(LINK.c) $(PROG).c -o $@ $(LDLIBS)
697c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
707c478bd9Sstevel@tonic-gate
71a7872406Smeeminstall:	all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) \
72a7872406Smeem		$(ROOTETCDEFAULTFILES) $(ROOTEMB_PROG)
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate$(ROOTSBINPROG): $(ROOTPROG)
757c478bd9Sstevel@tonic-gate		$(RM) $(ROOTSBINPROG); \
767c478bd9Sstevel@tonic-gate		$(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG)
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate$(ROOTEMB_PROG):
797c478bd9Sstevel@tonic-gate		$(RM) $(ROOTEMB_PROG); \
807c478bd9Sstevel@tonic-gate		$(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG)
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gate$(EMB_PROG):
837c478bd9Sstevel@tonic-gate		$(RM) $(EMB_PROG); \
847c478bd9Sstevel@tonic-gate		$(SYMLINK) $(PROG) $(EMB_PROG)
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gateclean:
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gatelint:		lint_PROG
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gateinclude		../Makefile.targ
91