xref: /illumos-gate/usr/src/cmd/ldap/Makefile.com (revision f52943a93040563107b95bccb9db87d9971ef47d)
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
84LINTFLAGS += -erroff=E_INCONS_ARG_DECL2
85LINTFLAGS += -erroff=E_INCONS_VAL_TYPE_DECL2
86
87CERRWARN +=	-_gcc=-Wno-implicit-function-declaration
88CERRWARN +=	-_gcc=-Wno-parentheses
89CERRWARN +=	-_gcc=-Wno-unused-function
90CERRWARN +=	-_gcc=-Wno-unused-variable
91CERRWARN +=	$(CNOWARN_UNINIT)
92
93# not linted
94SMATCH=off
95
96all:=           TARGET= all
97install:=       TARGET= install
98clean:=         TARGET= clean
99clobber:=       TARGET= clobber
100lint:=          TARGET= lint
101
102# C Pre-Processor flags used by C, CC & lint
103CPPFLAGS +=	-DSUN -DSVR4 -DSOLARIS_LDAP_CMD \
104		-I $(SRC)/lib/libldap5/include/ldap \
105		-I $(SRC)/lib/libsldap/common \
106		-I $(SRC)/lib/libnsl/include/rpcsvc \
107		-DNO_LIBLCACHE -DLDAP_REFERRALS -DNET_SSL -DLDAPSSLIO \
108		-DHAVE_SASL_OPTIONS -DSOLARIS_LDAP_CMD
109LDLIBS +=	$(COMPLIB)
110
111ldapmodrdn :=	LDLIBS += -lldap
112ldapsearch :=	LDLIBS += -lldap
113ldapdelete :=	LDLIBS += -lldap
114ldapmodify :=	LDLIBS += -lldap
115ldaplist :=	LDLIBS += -lsldap
116ldapaddent :=	LDLIBS += -lsldap -lnsl -lsecdb
117ldapclient :=	LDLIBS += -lsldap -lscf
118
119ldaplist :=	CSTD = $(CSTD_GNU99)
120ldapaddent :=	CSTD = $(CSTD_GNU99)
121ldapclient :=	CSTD = $(CSTD_GNU99)
122
123lint :=		LDLIBS += -lldap
124
125.KEEP_STATE:
126
127all:	$(PROG) $(LDAPCLIENTPROG) $(LDAPADDENTPROG) $(IDSCONFIGPROG)
128
129$(LDAPADD):	$(LDAPMOD)
130		@$(RM) $(LDAPADD); $(LN) $(LDAPMOD) $(LDAPADD)
131
132$(LDAPPROG):	../common/$$@.c $(LDAPCOMMOBJS)
133		$(LINK.c) -o $@ ../common/$@.c $(LDAPCOMMOBJS) $(LDLIBS)
134		$(POST_PROCESS)
135
136%.o:		../common/%.c
137		$(COMPILE.c) -o $@ $<
138		$(POST_PROCESS_O)
139
140%.o:		../ns_ldap/%.c
141		$(COMPILE.c) -o $@ $<
142		$(POST_PROCESS_O)
143
144idsconfig:	../ns_ldap/$$@.sh
145		$(CP) ../ns_ldap/$(IDSCONFIGSRC) $(IDSCONFIGPROG)
146		$(CHMOD) 755 $(IDSCONFIGPROG)
147
148ldaplist:	$(LDAPLISTOBJS)
149		$(LINK.c) -o $@ $(LDAPLISTOBJS) $(LDLIBS)
150		$(POST_PROCESS)
151
152ldapaddent:	$(LDAPADDENTOBJS)
153		$(LINK.c) -o $@ $(LDAPADDENTOBJS) $(LDLIBS)
154		$(POST_PROCESS)
155
156ldapclient:	$(LDAPCLIENTOBJS)
157		$(LINK.c) -o $@ $(LDAPCLIENTOBJS) $(LDLIBS)
158		$(POST_PROCESS)
159
160install: all $(ROOTVAR_LDAP) $(ROOTUSRLIBLDAP) $(ROOTADD) $(ROOTSBIN) \
161		$(ROOTSCRIPT)
162
163$(ROOTUSRLIBLDAP):
164		$(INS.dir)
165
166$(ROOTVAR_LDAP):
167		$(INS.dir)
168
169$(ROOTADD):	$(ROOTPROG)
170		$(RM) $@
171		$(LN) $(ROOTMOD) $@
172
173$(ROOTUSRLIBLDAP)/%:	%
174		$(INS.file)
175
176FRC:
177
178clean:
179	$(RM) $(OBJS)
180
181# Not linted Mozilla upstream commands
182lint: lintns_ldaplist lintns_ldapaddent lintns_ldapclient
183
184lintns_ldaplist := CSTD = $(CSTD_GNU99)
185
186lintns_ldaplist:
187	$(LINT.c) $(LDAPLISTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap
188
189lintns_ldapaddent := CSTD = $(CSTD_GNU99)
190
191lintns_ldapaddent:
192	$(LINT.c) $(LDAPADDENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lnsl \
193		-lsecdb
194
195lintns_ldapclient := CSTD = $(CSTD_GNU99)
196
197lintns_ldapclient:
198	$(LINT.c) $(LDAPCLIENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lscf
199
200lintc_%:
201	$(LINT.c) $(@:lintc_%=../common/%.c) $(LDAPCOMMSRC:%=../common/%) \
202		 $(LDLIBS)
203
204include $(SRC)/cmd/Makefile.targ
205