xref: /illumos-gate/usr/src/cmd/su/Makefile (revision a787240632bcb1404b9fd4583516b875d3f02c8b)
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
57c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate# with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate# build two versions, su and su.static
297c478bd9Sstevel@tonic-gate# su.static is dynamically linked; the .static suffix is historical.
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gatePROG =		su
327c478bd9Sstevel@tonic-gateROOTFS_PROG =	su.static
33*a7872406SmeemDEFAULTFILES =	su.dfl
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gateinclude		../Makefile.cmd
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gateEMB_PROG =	embedded_su
387c478bd9Sstevel@tonic-gateROOTEMB_PROG =	$(ROOTLIB)/$(EMB_PROG)
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gatePROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG)
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gate# set /usr/bin/su to 4555; set /sbin/su.static to 0555
437c478bd9Sstevel@tonic-gateFILEMODE =	04555
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gateGROUP =		sys
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate$(PROG_STATIC) := FILEMODE = 0555
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gate# A reduced su.static is created, with just enough functionality
507c478bd9Sstevel@tonic-gate# to satisfy the needs of a single-user login with /usr not mounted.
517c478bd9Sstevel@tonic-gate# In particular, nss_files.so.1 may be dlopen()'ed at runtime.
525435d801Sgww$(ROOTFS_PROG) :=	LDLIBS += -lcmd -lbsm -lpam
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gate# The standard su is fully functional.
557c478bd9Sstevel@tonic-gate$(PROG) :=	CPPFLAGS += -DDYNAMIC_SU
567c478bd9Sstevel@tonic-gate$(PROG) :=	LDLIBS += -lcmd -lbsm -lpam
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gateLINTFLAGS += -DDYNAMIC_SU
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gateCLOBBERFILES	+= $(ROOTFS_PROG) $(EMB_PROG)
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gatelint :=		LDLIBS += -lcmd -lbsm -lpam
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate.KEEP_STATE:
657c478bd9Sstevel@tonic-gate
66*a7872406Smeemall:		$(PROG) $(ROOTFS_PROG) $(EMB_PROG)
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gate# install rule for non-setuid /sbin/su.static
697c478bd9Sstevel@tonic-gate# (exec'd by /sbin/sulogin when booting single user)
707c478bd9Sstevel@tonic-gate$(ROOTFS_PROG):	$(PROG).c
717c478bd9Sstevel@tonic-gate		$(LINK.c) $(PROG).c -o $@ $(LDLIBS)
727c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
737c478bd9Sstevel@tonic-gate
74*a7872406Smeeminstall:	all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) \
75*a7872406Smeem		$(ROOTETCDEFAULTFILES) $(ROOTEMB_PROG)
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate$(ROOTSBINPROG): $(ROOTPROG)
787c478bd9Sstevel@tonic-gate		$(RM) $(ROOTSBINPROG); \
797c478bd9Sstevel@tonic-gate		$(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG)
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate$(ROOTEMB_PROG):
827c478bd9Sstevel@tonic-gate		$(RM) $(ROOTEMB_PROG); \
837c478bd9Sstevel@tonic-gate		$(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG)
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gate$(EMB_PROG):
867c478bd9Sstevel@tonic-gate		$(RM) $(EMB_PROG); \
877c478bd9Sstevel@tonic-gate		$(SYMLINK) $(PROG) $(EMB_PROG)
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gateclean:
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gatelint:		lint_PROG
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gateinclude		../Makefile.targ
94