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 (the "License").
6# You may not use this file except in compliance with the License.
7#
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.
12#
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]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
23# Copyright (c) 2013 RackTop Systems.
24# Copyright (c) 2013 Gary Mills
25#
26# Copyright (c) 2018, Joyent, Inc.
27
28DEFAULTFILES= useradd.dfl
29
30include ../../Makefile.cmd
31
32GREP=		grep
33
34USERADD= 	useradd
35USERDEL= 	userdel
36USERMOD= 	usermod
37ROLEADD=	roleadd
38ROLEDEL=	roledel
39ROLEMOD=	rolemod
40
41SBINPROG=	$(USERADD)   $(USERDEL)   $(USERMOD)
42#
43#	Removing sysadm: deleted $(SYSADMPROG) from this target.
44#
45PROG=		$(SBINPROG)
46PRODUCT=	$(PROG)
47
48ADD_OBJ=	useradd.o     homedir.o        groups.o     call_pass.o \
49		userdefs.o    messages.o       val_lgrp.o   funcs.o \
50		val_lprj.o    proj.o
51
52DEL_OBJ=	userdel.o     call_pass.o      homedir.o    isbusy.o \
53		groups.o      messages.o       funcs.o      proj.o
54
55MOD_OBJ=	usermod.o     movedir.o        groups.o     homedir.o \
56		call_pass.o   isbusy.o         userdefs.o \
57		messages.o    val_lgrp.o       funcs.o      val_lprj.o \
58		proj.o
59
60OBJECTS=	$(ADD_OBJ)     $(DEL_OBJ)    $(MOD_OBJ)
61
62SRCS=		$(OBJECTS:.o=.c)
63
64LIBDIR=		../lib
65LIBUSRGRP=	$(LIBDIR)/lib.a
66LIBADM=		-ladm
67LOCAL=		../inc
68HERE=		.
69LINTFLAGS=	-u
70
71ROOTSKEL=	$(ROOTETC)/skel
72INSSBINPROG=	$(SBINPROG:%=$(ROOTUSRSBIN)/%)
73INSSKELFILE=	$(SKELFILE:%=$(ROOTSKEL)/%)
74
75CPPFLAGS=	-I$(HERE) -I$(LOCAL) $(CPPFLAGS.master)
76CERRWARN +=	-_gcc=-Wno-implicit-function-declaration
77
78# not linted
79SMATCH=off
80
81$(INSSBINPROG)  := FILEMODE = 0555
82$(INSSYSADMPROG):= FILEMODE = 0500
83$(INSSKELFILE)  := FILEMODE = 0644
84
85$(USERADD) :=	OBJS = $(ADD_OBJ)
86$(USERADD) :=	LIBS = $(LIBUSRGRP)
87$(USERADD) :=	LDLIBS += -lcmdutils
88
89$(USERDEL) :=	OBJS = $(DEL_OBJ)
90$(USERDEL) :=	LIBS = $(LIBUSRGRP)
91
92$(USERMOD) :=	OBJS = $(MOD_OBJ)
93$(USERMOD) :=	LIBS = $(LIBUSRGRP)
94
95LDLIBS +=	-lbsm -lnsl -lsecdb -lproject -lzfs -ltsol
96
97.PARALLEL: $(OBJECTS)
98
99all:	$(PRODUCT)
100
101$(PROG):	$$(OBJS) $$(LIBS)
102	$(LINK.c) $(OBJS) -o $@ $(LIBS) $(LDLIBS)
103	$(POST_PROCESS)
104
105$(USERADD):	$(ADD_OBJ)
106$(USERMOD):	$(MOD_OBJ)
107$(USERDEL):	$(DEL_OBJ)
108
109install:	all $(ROOTETCDEFAULTFILES) .WAIT \
110			$(ROOTSKEL) $(INSSBINPROG) $(INSSKELFILE)
111		$(RM) $(ROOTUSRSBIN)/$(ROLEADD)
112		$(LN) $(ROOTUSRSBIN)/$(USERADD) $(ROOTUSRSBIN)/$(ROLEADD)
113		$(RM) $(ROOTUSRSBIN)/$(ROLEDEL)
114		$(LN) $(ROOTUSRSBIN)/$(USERDEL) $(ROOTUSRSBIN)/$(ROLEDEL)
115		$(RM) $(ROOTUSRSBIN)/$(ROLEMOD)
116		$(LN) $(ROOTUSRSBIN)/$(USERMOD) $(ROOTUSRSBIN)/$(ROLEMOD)
117
118clean:
119	$(RM) $(OBJECTS)
120
121lint:	lint_SRCS
122
123include ../../Makefile.targ
124