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