xref: /titanic_41/usr/src/cmd/ldap/Makefile.com (revision a7df97bafe5a886e6ddb3fe8170b2d547cd3b029)
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# cmd/ldap/Makefile.com
26# Native LDAP II commands (makestyle clean).
27#
28include $(SRC)/cmd/Makefile.cmd
29
30LINTOUT=	lint.out
31
32LDAPMOD=	ldapmodify
33LDAPADD=	ldapadd
34LDAPPROG=	ldapmodrdn ldapsearch ldapdelete $(LDAPMOD)
35LDAPSRCS=	$(LDAPPROG:%=../common/%.c)
36LDAPOBJS=	$(LDAPPROG:%=%.o)
37
38#ldap common
39LDAPCOMMSRC=	common.c ldaptool-sasl.c fileurl.c convutf8.c
40LDAPCOMMOBJS=	$(LDAPCOMMSRC:%.c=%.o)
41
42# LDAP Naming service commands
43# idsconfig command
44IDSCONFIGPROG=	idsconfig
45IDSCONFIGSRC=	idsconfig.sh
46
47# ldaplist command
48LDAPLISTPROG=	ldaplist
49LDAPLISTSRCS=	ldaplist.c mapping.c printResult.c standalone.c
50LDAPLISTOBJS=	$(LDAPLISTSRCS:%.c=%.o)
51
52# ldapaddent command
53LDAPADDENTPROG=	ldapaddent
54LDAPADDENTSRCS=	ldapaddent.c ldapaddrbac.c ldapaddtsol.c standalone.c
55LDAPADDENTOBJS=	$(LDAPADDENTSRCS:%.c=%.o)
56
57# ldapclient command
58LDAPCLIENTPROG=	ldapclient
59LDAPCLIENTSRCS=	ldapclient.c standalone.c
60LDAPCLIENTOBJS=	$(LDAPCLIENTSRCS:%.c=%.o)
61
62
63NSLDAPOBJS=	$(LDAPLISTOBJS) $(LDAPADDENTOBJS) $(LDAPCLIENTOBJS)
64NSLDAPSRCS=	$(LDAPLISTSRCS) $(LDAPADDENTSRCS) $(LDAPCLIENTSRCS)
65
66OBJS=		$(LDAPOBJS) $(NSLDAPOBJS) $(LDAPCOMMOBJS)
67SRCS=		$(LDAPSRCS) $(NSLDAPSRCS)
68ROOTUSRSBIN=	$(ROOT)/usr/sbin
69ROOTUSRLIBLDAP=	$(ROOT)/usr/lib/ldap
70
71ROOTSCRIPT=	$(IDSCONFIGPROG:%=$(ROOTUSRLIBLDAP)/%)
72ROOTSBIN=	$(LDAPADDENTPROG:%=$(ROOTUSRSBIN)/%) \
73		$(LDAPCLIENTPROG:%=$(ROOTUSRSBIN)/%)
74
75PROG=		$(LDAPPROG) $(LDAPLISTPROG)
76ROOTADD=	$(ROOTBIN)/$(LDAPADD)
77ROOTMOD=	$(ROOTBIN)/$(LDAPMOD)
78ALLPROG=	all $(ROOTADD)
79
80CLOBBERFILES += $(OBJS) $(PROG) $(LDAPCLIENTPROG) $(LDAPADDENTPROG) \
81		$(IDSCONFIGPROG) $(LINTOUT)
82
83# creating /var/ldap directory
84ROOTVAR_LDAP=	$(ROOT)/var/ldap
85
86all:=           TARGET= all
87install:=       TARGET= install
88clean:=         TARGET= clean
89clobber:=       TARGET= clobber
90lint:=          TARGET= lint
91
92# C Pre-Processor flags used by C, CC & lint
93CPPFLAGS +=	-DSUN -DSVR4 -DSOLARIS_LDAP_CMD \
94		-I $(SRC)/lib/libldap5/include/ldap \
95		-I $(SRC)/lib/libsldap/common \
96		-I $(SRC)/lib/libnsl/include/rpcsvc \
97		-DNO_LIBLCACHE -DLDAP_REFERRALS -DNET_SSL -DLDAPSSLIO \
98		-DHAVE_SASL_OPTIONS -DSOLARIS_LDAP_CMD
99LDLIBS +=	$(COMPLIB)
100
101ldapmodrdn :=	LDLIBS += -lldap
102ldapsearch :=	LDLIBS += -lldap
103ldapdelete :=	LDLIBS += -lldap
104ldapmodify :=	LDLIBS += -lldap
105ldaplist :=	LDLIBS += -lsldap
106ldapaddent :=	LDLIBS += -lsldap -lnsl -lsecdb
107ldapclient :=	LDLIBS += -lsldap -lscf
108
109ldaplist :=	C99MODE = $(C99_ENABLE)
110ldapaddent :=	C99MODE = $(C99_ENABLE)
111ldapclient :=	C99MODE = $(C99_ENABLE)
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 := C99MODE = $(C99_ENABLE)
175
176lintns_ldaplist:
177	$(LINT.c) $(LDAPLISTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap \
178		> $(LINTOUT) 2>&1
179
180lintns_ldapaddent := C99MODE = $(C99_ENABLE)
181
182lintns_ldapaddent:
183	$(LINT.c) $(LDAPADDENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lnsl \
184		-lsecdb >> $(LINTOUT) 2>&1
185
186lintns_ldapclient := C99MODE = $(C99_ENABLE)
187
188lintns_ldapclient:
189	$(LINT.c) $(LDAPCLIENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lscf \
190		>> $(LINTOUT) 2>&1
191
192lintc_%:
193	$(LINT.c) $(@:lintc_%=../common/%.c) $(LDAPCOMMSRC:%=../common/%) \
194		 $(LDLIBS) >> $(LINTOUT) 2>&1
195
196include $(SRC)/cmd/Makefile.targ
197