xref: /titanic_51/usr/src/cmd/su/Makefile (revision 06e1a7147edd272b7296f208141627a5b1191731)
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#
2209295472Sgww# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate# build two versions, su and su.static
287c478bd9Sstevel@tonic-gate# su.static is dynamically linked; the .static suffix is historical.
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gatePROG =		su
317c478bd9Sstevel@tonic-gateROOTFS_PROG =	su.static
32a7872406SmeemDEFAULTFILES =	su.dfl
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gateinclude		../Makefile.cmd
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gateEMB_PROG =	embedded_su
377c478bd9Sstevel@tonic-gateROOTEMB_PROG =	$(ROOTLIB)/$(EMB_PROG)
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gatePROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG)
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate# set /usr/bin/su to 4555; set /sbin/su.static to 0555
427c478bd9Sstevel@tonic-gateFILEMODE =	04555
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gateGROUP =		sys
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate$(PROG_STATIC) := FILEMODE = 0555
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate# A reduced su.static is created, with just enough functionality
497c478bd9Sstevel@tonic-gate# to satisfy the needs of a single-user login with /usr not mounted.
507c478bd9Sstevel@tonic-gate# In particular, nss_files.so.1 may be dlopen()'ed at runtime.
51*06e1a714Sraf$(ROOTFS_PROG) :=	LDLIBS += -lbsm -lpam -lsecdb
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate# The standard su is fully functional.
547c478bd9Sstevel@tonic-gate$(PROG) :=	CPPFLAGS += -DDYNAMIC_SU
55*06e1a714Sraf$(PROG) :=	LDLIBS += -lbsm -lpam -lsecdb
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gateLINTFLAGS += -DDYNAMIC_SU
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gateCLOBBERFILES	+= $(ROOTFS_PROG) $(EMB_PROG)
607c478bd9Sstevel@tonic-gate
61*06e1a714Sraflint :=		LDLIBS += -lbsm -lpam -lsecdb
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gate.KEEP_STATE:
647c478bd9Sstevel@tonic-gate
65a7872406Smeemall:		$(PROG) $(ROOTFS_PROG) $(EMB_PROG)
667c478bd9Sstevel@tonic-gate
677c478bd9Sstevel@tonic-gate# install rule for non-setuid /sbin/su.static
687c478bd9Sstevel@tonic-gate# (exec'd by /sbin/sulogin when booting single user)
697c478bd9Sstevel@tonic-gate$(ROOTFS_PROG):	$(PROG).c
707c478bd9Sstevel@tonic-gate		$(LINK.c) $(PROG).c -o $@ $(LDLIBS)
717c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
727c478bd9Sstevel@tonic-gate
73a7872406Smeeminstall:	all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) \
74a7872406Smeem		$(ROOTETCDEFAULTFILES) $(ROOTEMB_PROG)
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gate$(ROOTSBINPROG): $(ROOTPROG)
777c478bd9Sstevel@tonic-gate		$(RM) $(ROOTSBINPROG); \
787c478bd9Sstevel@tonic-gate		$(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG)
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate$(ROOTEMB_PROG):
817c478bd9Sstevel@tonic-gate		$(RM) $(ROOTEMB_PROG); \
827c478bd9Sstevel@tonic-gate		$(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG)
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gate$(EMB_PROG):
857c478bd9Sstevel@tonic-gate		$(RM) $(EMB_PROG); \
867c478bd9Sstevel@tonic-gate		$(SYMLINK) $(PROG) $(EMB_PROG)
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gateclean:
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gatelint:		lint_PROG
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gateinclude		../Makefile.targ
93