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