xref: /titanic_50/usr/src/cmd/ldap/Makefile.com (revision 98157a7002f4f2cf7978f3084ca5577f0a1d72b2)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#ident	"%Z%%M%	%I%	%E% SMI"
26#
27# cmd/ldap/Makefile.com
28# Native LDAP II commands (makestyle clean).
29#
30include $(SRC)/cmd/Makefile.cmd
31
32LINTOUT=	lint.out
33
34LDAPMOD=	ldapmodify
35LDAPADD=	ldapadd
36LDAPPROG=	ldapmodrdn ldapsearch ldapdelete $(LDAPMOD)
37LDAPSRCS=	$(LDAPPROG:%=../common/%.c)
38LDAPOBJS=	$(LDAPPROG:%=%.o)
39
40#ldap common
41LDAPCOMMSRC=	common.c ldaptool-sasl.c fileurl.c convutf8.c
42LDAPCOMMOBJS=	$(LDAPCOMMSRC:%.c=%.o)
43
44# LDAP Naming service commands
45# idsconfig command
46IDSCONFIGPROG=	idsconfig
47IDSCONFIGSRC=	idsconfig.sh
48
49# ldaplist command
50LDAPLISTPROG=	ldaplist
51LDAPLISTSRCS=	ldaplist.c mapping.c printResult.c
52LDAPLISTOBJS=	$(LDAPLISTSRCS:%.c=%.o)
53
54# ldapaddent command
55LDAPADDENTPROG=	ldapaddent
56LDAPADDENTSRCS=	ldapaddent.c ldapaddrbac.c ldapaddtsol.c
57LDAPADDENTOBJS=	$(LDAPADDENTSRCS:%.c=%.o)
58
59# ldapclient command
60LDAPCLIENTPROG=	ldapclient
61LDAPCLIENTSRCS=	ldapclient.c
62LDAPCLIENTOBJS=	$(LDAPCLIENTSRCS:%.c=%.o)
63
64
65NSLDAPOBJS=	$(LDAPLISTOBJS) $(LDAPADDENTOBJS) $(LDAPCLIENTOBJS)
66NSLDAPSRCS=	$(LDAPLISTSRCS) $(LDAPADDENTSRCS) $(LDAPCLIENTSRCS)
67
68OBJS=		$(LDAPOBJS) $(NSLDAPOBJS) $(LDAPCOMMOBJS)
69SRCS=		$(LDAPSRCS) $(NSLDAPSRCS)
70ROOTUSRSBIN=	$(ROOT)/usr/sbin
71ROOTUSRLIBLDAP=	$(ROOT)/usr/lib/ldap
72
73ROOTSCRIPT=	$(IDSCONFIGPROG:%=$(ROOTUSRLIBLDAP)/%)
74ROOTSBIN=	$(LDAPADDENTPROG:%=$(ROOTUSRSBIN)/%) \
75		$(LDAPCLIENTPROG:%=$(ROOTUSRSBIN)/%)
76
77PROG=		$(LDAPPROG) $(LDAPLISTPROG)
78ROOTADD=	$(ROOTBIN)/$(LDAPADD)
79ROOTMOD=	$(ROOTBIN)/$(LDAPMOD)
80ALLPROG=	all $(ROOTADD)
81
82CLOBBERFILES += $(OBJS) $(PROG) $(LDAPCLIENTPROG) $(LDAPADDENTPROG) \
83		$(IDSCONFIGPROG) $(LINTOUT)
84
85# creating /var/ldap directory
86ROOTVAR_LDAP=	$(ROOT)/var/ldap
87$(ROOTVAR_LDAP) :=				OWNER=		root
88$(ROOTVAR_LDAP) :=				GROUP=		sys
89
90all:=           TARGET= all
91install:=       TARGET= install
92clean:=         TARGET= clean
93clobber:=       TARGET= clobber
94lint:=          TARGET= lint
95
96# C Pre-Processor flags used by C, CC & lint
97CPPFLAGS +=	-DSUN -DSVR4 -DSOLARIS_LDAP_CMD \
98		-I $(SRC)/lib/libldap5/include/ldap \
99		-I $(SRC)/lib/libsldap/common \
100		-I $(SRC)/lib/libnsl/include/rpcsvc \
101		-DNO_LIBLCACHE -DLDAP_REFERRALS -DNET_SSL -DLDAPSSLIO \
102		-DHAVE_SASL_OPTIONS -DSOLARIS_LDAP_CMD
103LDLIBS +=	$(COMPLIB)
104
105ldapmodrdn :=	LDLIBS += -lldap
106ldapsearch :=	LDLIBS += -lldap
107ldapdelete :=	LDLIBS += -lldap
108ldapmodify :=	LDLIBS += -lldap
109ldaplist :=	LDLIBS += -lsldap
110ldapaddent :=	LDLIBS += -lsldap -lnsl -lsecdb
111ldapclient :=	LDLIBS += -lsldap -lscf
112
113lint :=		LDLIBS += -lldap
114
115.KEEP_STATE:
116
117all:	$(PROG) $(LDAPCLIENTPROG) $(LDAPADDENTPROG) $(IDSCONFIGPROG)
118
119$(LDAPADD):	$(LDAPMOD)
120		@$(RM) $(LDAPADD); $(LN) $(LDAPMOD) $(LDAPADD)
121
122$(LDAPPROG):	../common/$$@.c $(LDAPCOMMOBJS)
123		$(LINK.c) -o $@ ../common/$@.c $(LDAPCOMMOBJS) $(LDLIBS)
124		$(POST_PROCESS)
125
126%.o:		../common/%.c
127		$(COMPILE.c) -o $@ $<
128		$(POST_PROCESS_O)
129
130%.o:		../ns_ldap/%.c
131		$(COMPILE.c) -o $@ $<
132		$(POST_PROCESS_O)
133
134idsconfig:	../ns_ldap/$$@.sh
135		$(CP) ../ns_ldap/$(IDSCONFIGSRC) $(IDSCONFIGPROG)
136		$(CHMOD) 755 $(IDSCONFIGPROG)
137
138ldaplist:	$(LDAPLISTOBJS)
139		$(LINK.c) -o $@ $(LDAPLISTOBJS) $(LDLIBS)
140		$(POST_PROCESS)
141
142ldapaddent:	$(LDAPADDENTOBJS)
143		$(LINK.c) -o $@ $(LDAPADDENTOBJS) $(LDLIBS)
144		$(POST_PROCESS)
145
146ldapclient:	$(LDAPCLIENTOBJS)
147		$(LINK.c) -o $@ $(LDAPCLIENTOBJS) $(LDLIBS)
148		$(POST_PROCESS)
149
150install: all $(ROOTVAR_LDAP) $(ROOTUSRLIBLDAP) $(ROOTADD) $(ROOTSBIN) \
151		$(ROOTSCRIPT)
152
153$(ROOTUSRLIBLDAP):
154		$(INS.dir)
155
156$(ROOTVAR_LDAP):
157		$(INS.dir)
158
159$(ROOTADD):	$(ROOTPROG)
160		$(RM) $@
161		$(LN) $(ROOTMOD) $@
162
163$(ROOTUSRLIBLDAP)/%:	%
164		$(INS.file)
165
166FRC:
167
168clean:
169	$(RM) $(OBJS)
170
171lint: lintns_ldaplist lintns_ldapaddent lintns_ldapclient \
172	$(LDAPPROG:%=lintc_%)
173
174lintns_ldaplist:
175	$(LINT.c) $(LDAPLISTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap \
176		> $(LINTOUT) 2>&1
177
178lintns_ldapaddent:
179	$(LINT.c) $(LDAPADDENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lnsl \
180		-lsecdb >> $(LINTOUT) 2>&1
181
182lintns_ldapclient:
183	$(LINT.c) $(LDAPCLIENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lscf \
184		>> $(LINTOUT) 2>&1
185
186lintc_%:
187	$(LINT.c) $(@:lintc_%=../common/%.c) $(LDAPCOMMSRC:%=../common/%) \
188		 $(LDLIBS) >> $(LINTOUT) 2>&1
189
190include $(SRC)/cmd/Makefile.targ
191