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