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, Version 1.0 only 6# (the "License"). You may not use this file except in compliance 7# with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22# 23# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# ident "%Z%%M% %I% %E% SMI" 27# 28# build two versions, su and su.static 29# su.static is dynamically linked; the .static suffix is historical. 30 31PROG = su 32ROOTFS_PROG = su.static 33 34include ../Makefile.cmd 35 36EMB_PROG = embedded_su 37ROOTEMB_PROG = $(ROOTLIB)/$(EMB_PROG) 38 39PROG_STATIC = $(ROOTSBIN)/$(ROOTFS_PROG) 40 41DFLTD = $(ROOTETC)/default 42ETCDFLTPROG = $(PROG:%=$(DFLTD)/%) 43 44# set /usr/bin/su to 4555; set /sbin/su.static to 0555 45FILEMODE = 04555 46 47GROUP = sys 48 49$(PROG_STATIC) := FILEMODE = 0555 50$(ETCDFLTPROG) := FILEMODE = $(LIBFILEMODE) 51 52# A reduced su.static is created, with just enough functionality 53# to satisfy the needs of a single-user login with /usr not mounted. 54# In particular, nss_files.so.1 may be dlopen()'ed at runtime. 55$(ROOTFS_PROG) := LDLIBS += -lcmd -lbsm -lpam 56 57# The standard su is fully functional. 58$(PROG) := CPPFLAGS += -DDYNAMIC_SU 59$(PROG) := LDLIBS += -lcmd -lbsm -lpam 60 61LINTFLAGS += -DDYNAMIC_SU 62 63CLOBBERFILES += $(ROOTFS_PROG) $(EMB_PROG) 64 65lint := LDLIBS += -lcmd -lbsm -lpam 66 67.KEEP_STATE: 68 69all: $(PROG) $(ROOTFS_PROG) $(EMB_PROG) $(PROG).dfl 70 71# install rule for the default file 72$(DFLTD)/%: %.dfl 73 $(INS.rename) 74 75# install rule for non-setuid /sbin/su.static 76# (exec'd by /sbin/sulogin when booting single user) 77$(ROOTFS_PROG): $(PROG).c 78 $(LINK.c) $(PROG).c -o $@ $(LDLIBS) 79 $(POST_PROCESS) 80 81install: all $(PROG_STATIC) $(ROOTPROG) $(ROOTSBINPROG) $(ETCDFLTPROG) \ 82 $(ROOTEMB_PROG) 83 84$(ROOTSBINPROG): $(ROOTPROG) 85 $(RM) $(ROOTSBINPROG); \ 86 $(SYMLINK) ../usr/bin/$(PROG) $(ROOTSBINPROG) 87 88$(ROOTEMB_PROG): 89 $(RM) $(ROOTEMB_PROG); \ 90 $(SYMLINK) ../bin/$(PROG) $(ROOTEMB_PROG) 91 92$(EMB_PROG): 93 $(RM) $(EMB_PROG); \ 94 $(SYMLINK) $(PROG) $(EMB_PROG) 95 96clean: 97 98lint: lint_PROG 99 100include ../Makefile.targ 101