xref: /titanic_51/usr/src/cmd/ldap/Makefile.com (revision b453864f3587ccc3324d7a3b0438a1e542dcfde7)
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 2008 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 standalone.c
52LDAPLISTOBJS=	$(LDAPLISTSRCS:%.c=%.o)
53
54# ldapaddent command
55LDAPADDENTPROG=	ldapaddent
56LDAPADDENTSRCS=	ldapaddent.c ldapaddrbac.c ldapaddtsol.c standalone.c
57LDAPADDENTOBJS=	$(LDAPADDENTSRCS:%.c=%.o)
58
59# ldapclient command
60LDAPCLIENTPROG=	ldapclient
61LDAPCLIENTSRCS=	ldapclient.c standalone.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
113ldaplist :=	C99MODE = $(C99_ENABLE)
114ldapaddent :=	C99MODE = $(C99_ENABLE)
115ldapclient :=	C99MODE = $(C99_ENABLE)
116
117lint :=		LDLIBS += -lldap
118
119.KEEP_STATE:
120
121all:	$(PROG) $(LDAPCLIENTPROG) $(LDAPADDENTPROG) $(IDSCONFIGPROG)
122
123$(LDAPADD):	$(LDAPMOD)
124		@$(RM) $(LDAPADD); $(LN) $(LDAPMOD) $(LDAPADD)
125
126$(LDAPPROG):	../common/$$@.c $(LDAPCOMMOBJS)
127		$(LINK.c) -o $@ ../common/$@.c $(LDAPCOMMOBJS) $(LDLIBS)
128		$(POST_PROCESS)
129
130%.o:		../common/%.c
131		$(COMPILE.c) -o $@ $<
132		$(POST_PROCESS_O)
133
134%.o:		../ns_ldap/%.c
135		$(COMPILE.c) -o $@ $<
136		$(POST_PROCESS_O)
137
138idsconfig:	../ns_ldap/$$@.sh
139		$(CP) ../ns_ldap/$(IDSCONFIGSRC) $(IDSCONFIGPROG)
140		$(CHMOD) 755 $(IDSCONFIGPROG)
141
142ldaplist:	$(LDAPLISTOBJS)
143		$(LINK.c) -o $@ $(LDAPLISTOBJS) $(LDLIBS)
144		$(POST_PROCESS)
145
146ldapaddent:	$(LDAPADDENTOBJS)
147		$(LINK.c) -o $@ $(LDAPADDENTOBJS) $(LDLIBS)
148		$(POST_PROCESS)
149
150ldapclient:	$(LDAPCLIENTOBJS)
151		$(LINK.c) -o $@ $(LDAPCLIENTOBJS) $(LDLIBS)
152		$(POST_PROCESS)
153
154install: all $(ROOTVAR_LDAP) $(ROOTUSRLIBLDAP) $(ROOTADD) $(ROOTSBIN) \
155		$(ROOTSCRIPT)
156
157$(ROOTUSRLIBLDAP):
158		$(INS.dir)
159
160$(ROOTVAR_LDAP):
161		$(INS.dir)
162
163$(ROOTADD):	$(ROOTPROG)
164		$(RM) $@
165		$(LN) $(ROOTMOD) $@
166
167$(ROOTUSRLIBLDAP)/%:	%
168		$(INS.file)
169
170FRC:
171
172clean:
173	$(RM) $(OBJS)
174
175lint: lintns_ldaplist lintns_ldapaddent lintns_ldapclient \
176	$(LDAPPROG:%=lintc_%)
177
178lintns_ldaplist := C99MODE = $(C99_ENABLE)
179
180lintns_ldaplist:
181	$(LINT.c) $(LDAPLISTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap \
182		> $(LINTOUT) 2>&1
183
184lintns_ldapaddent := C99MODE = $(C99_ENABLE)
185
186lintns_ldapaddent:
187	$(LINT.c) $(LDAPADDENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lnsl \
188		-lsecdb >> $(LINTOUT) 2>&1
189
190lintns_ldapclient := C99MODE = $(C99_ENABLE)
191
192lintns_ldapclient:
193	$(LINT.c) $(LDAPCLIENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lscf \
194		>> $(LINTOUT) 2>&1
195
196lintc_%:
197	$(LINT.c) $(@:lintc_%=../common/%.c) $(LDAPCOMMSRC:%=../common/%) \
198		 $(LDLIBS) >> $(LINTOUT) 2>&1
199
200include $(SRC)/cmd/Makefile.targ
201