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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright (c) 2018, Joyent, Inc.
26
27SBINPROG = keyserv newkey
28BINPROG	= keylogout keylogin domainname chkey
29
30MANIFEST= keyserv.xml
31
32PROG= $(SBINPROG) $(BINPROG)
33
34HDRS= key_prot.h
35
36DEFAULTFILES = keyserv.dfl
37
38KEYSERVOBJS = keyserv.o
39KEYLOGOUTOBJS = keylogout.o
40KEYLOGINOBJS = keylogin.o
41CHKEYOBJS = chkey.o
42NEWKEYOBJS = newkey.o
43UPDATEOBJS = update.o
44
45DOMAINNAMEOBJS = domainname.o
46K_OBJS = setkey.o detach.o key_generic.o keyserv_cache.o
47CHANGE_OBJS  = update.o chkey_common.o
48OUTSIDE_UTIL_OBJS = selfcheck.o
49
50OBJS	= $(KEYSERVOBJS) $(KEYLOGOUTOBJS) $(KEYLOGINOBJS) $(CHKEYOBJS) \
51	$(NEWKEYOBJS) $(UPDATEOBJS) $(DOMAINNAMEOBJS) \
52	$(K_OBJS)  $(CHANGE_OBJS)
53SRCS	= $(OBJS:.o=.c)
54
55SED=	sed
56
57include ../Makefile.cmd
58
59IBINPROG=		$(BINPROG:%=$(ROOTBIN)/%)
60ISBINPROG=		$(SBINPROG:%=$(ROOTUSRSBIN)/%)
61
62ROOTMANIFESTDIR=	$(ROOTSVCNETWORKRPC)
63
64$(ROOTBIN)/chkey :=				FILEMODE=	4555
65
66$(ROOTKEYSERVDFLT) :=				FILEMODE=	444
67
68CPPFLAGS += -I. -I$(SRC)/lib/libnsl/include -I$(SRC)/lib/libsldap/common \
69		-D_REENTRANT
70
71CERRWARN +=	-_gcc=-Wno-implicit-function-declaration
72CERRWARN +=	-_gcc=-Wno-parentheses
73CERRWARN +=	$(CNOWARN_UNINIT)
74CERRWARN +=	-_gcc=-Wno-unused-variable
75CERRWARN +=	-_gcc=-Wno-address
76CERRWARN +=	-_gcc=-Wno-unused-function
77
78# not linted
79SMATCH=off
80
81LDLIBS +=	-lnsl
82chkey :=	LDLIBS += -lsldap
83keyserv :=	LDLIBS += -lmp
84newkey  :=	LDLIBS += -lsldap -lsocket
85
86.KEEP_STATE:
87
88all: $(PROG)
89
90keyserv: $(K_OBJS)  $(KEYSERVOBJS)
91	$(LINK.c) $(K_OBJS)  $(KEYSERVOBJS) -o $@ $(LDLIBS)
92	$(POST_PROCESS)
93
94keylogout: $(KEYLOGOUTOBJS)
95	$(LINK.c) $(KEYLOGOUTOBJS) -o $@ $(LDLIBS)
96	$(POST_PROCESS)
97
98keylogin: $(KEYLOGINOBJS)
99	$(LINK.c) $(KEYLOGINOBJS) -o $@ $(LDLIBS)
100	$(POST_PROCESS)
101
102chkey: $(CHKEYOBJS) $(CHANGE_OBJS)
103	$(LINK.c) $(CHANGE_OBJS) $(CHKEYOBJS) -o $@ $(LDLIBS)
104	$(POST_PROCESS)
105
106newkey:$(CHANGE_OBJS)  $(NEWKEYOBJS) $(OUTSIDE_UTIL_OBJS)
107	$(LINK.c) $(CHANGE_OBJS)  $(NEWKEYOBJS) $(OUTSIDE_UTIL_OBJS) \
108	-o $@ $(LDLIBS)
109	$(POST_PROCESS)
110
111update: $(UPDATEOBJS)
112	$(LINK.c)  $(UPDATEOBJS) -o $@ $(LDLIBS)
113	$(POST_PROCESS)
114
115domainname: $(DOMAINNAMEOBJS)
116	$(LINK.c) $(DOMAINNAMEOBJS) -o $@ $(LDLIBS)
117	$(POST_PROCESS)
118
119selfcheck.o: ../fs.d/nfs/lib/selfcheck.c
120	$(COMPILE.c) ../fs.d/nfs/lib/selfcheck.c
121
122install: all $(DIRS) $(IBINPROG) $(ISBINPROG) $(ROOTETCDEFAULTFILES) \
123	$(ROOTMANIFEST)
124
125clean:
126	$(RM) $(OBJS) $(OUTSIDE_UTIL_OBJS)
127
128lint: lint_SRCS
129
130check:	$(CHKMANIFEST)
131
132key_prot.h : $(ROOT)/usr/include/rpcsvc/key_prot.x
133	$(RPCGEN) -h $(ROOT)/usr/include/rpcsvc/key_prot.x > key_prot.h
134
135include ../Makefile.targ
136