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 #
  28 include $(SRC)/cmd/Makefile.cmd
  29 
  30 LDAPMOD=        ldapmodify
  31 LDAPADD=        ldapadd
  32 LDAPPROG=       ldapmodrdn ldapsearch ldapdelete $(LDAPMOD)
  33 LDAPSRCS=       $(LDAPPROG:%=../common/%.c)
  34 LDAPOBJS=       $(LDAPPROG:%=%.o)
  35 
  36 #ldap common
  37 LDAPCOMMSRC=    common.c ldaptool-sasl.c fileurl.c convutf8.c
  38 LDAPCOMMOBJS=   $(LDAPCOMMSRC:%.c=%.o)
  39 
  40 # LDAP Naming service commands
  41 # idsconfig command
  42 IDSCONFIGPROG=  idsconfig
  43 IDSCONFIGSRC=   idsconfig.sh
  44 
  45 # ldaplist command
  46 LDAPLISTPROG=   ldaplist
  47 LDAPLISTSRCS=   ldaplist.c mapping.c printResult.c standalone.c
  48 LDAPLISTOBJS=   $(LDAPLISTSRCS:%.c=%.o)
  49 
  50 # ldapaddent command
  51 LDAPADDENTPROG= ldapaddent
  52 LDAPADDENTSRCS= ldapaddent.c ldapaddrbac.c ldapaddtsol.c standalone.c
  53 LDAPADDENTOBJS= $(LDAPADDENTSRCS:%.c=%.o)
  54 
  55 # ldapclient command
  56 LDAPCLIENTPROG= ldapclient
  57 LDAPCLIENTSRCS= ldapclient.c standalone.c
  58 LDAPCLIENTOBJS= $(LDAPCLIENTSRCS:%.c=%.o)
  59 
  60 
  61 NSLDAPOBJS=     $(LDAPLISTOBJS) $(LDAPADDENTOBJS) $(LDAPCLIENTOBJS)
  62 NSLDAPSRCS=     $(LDAPLISTSRCS) $(LDAPADDENTSRCS) $(LDAPCLIENTSRCS)
  63 
  64 OBJS=           $(LDAPOBJS) $(NSLDAPOBJS) $(LDAPCOMMOBJS)
  65 SRCS=           $(LDAPSRCS) $(NSLDAPSRCS)
  66 ROOTUSRSBIN=    $(ROOT)/usr/sbin
  67 ROOTUSRLIBLDAP= $(ROOT)/usr/lib/ldap
  68 
  69 ROOTSCRIPT=     $(IDSCONFIGPROG:%=$(ROOTUSRLIBLDAP)/%)
  70 ROOTSBIN=       $(LDAPADDENTPROG:%=$(ROOTUSRSBIN)/%) \
  71                 $(LDAPCLIENTPROG:%=$(ROOTUSRSBIN)/%)
  72 
  73 PROG=           $(LDAPPROG) $(LDAPLISTPROG)
  74 ROOTADD=        $(ROOTBIN)/$(LDAPADD)
  75 ROOTMOD=        $(ROOTBIN)/$(LDAPMOD)
  76 ALLPROG=        all $(ROOTADD)
  77 
  78 CLOBBERFILES += $(OBJS) $(PROG) $(LDAPCLIENTPROG) $(LDAPADDENTPROG) \
  79                 $(IDSCONFIGPROG) $(LINTOUT)
  80 
  81 # creating /var/ldap directory
  82 ROOTVAR_LDAP=   $(ROOT)/var/ldap
  83 
  84 LINTFLAGS += -erroff=E_INCONS_ARG_DECL2
  85 LINTFLAGS += -erroff=E_INCONS_VAL_TYPE_DECL2
  86 
  87 CERRWARN +=     -_gcc=-Wno-implicit-function-declaration
  88 CERRWARN +=     -_gcc=-Wno-parentheses
  89 CERRWARN +=     -_gcc=-Wno-unused-function
  90 CERRWARN +=     -_gcc=-Wno-unused-variable
  91 CERRWARN +=     -_gcc=-Wno-uninitialized
  92 
  93 # not linted
  94 SMATCH=off
  95 
  96 all:=           TARGET= all
  97 install:=       TARGET= install
  98 clean:=         TARGET= clean
  99 clobber:=       TARGET= clobber
 100 lint:=          TARGET= lint
 101 
 102 # C Pre-Processor flags used by C, CC & lint
 103 CPPFLAGS +=     -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
 109 LDLIBS +=       $(COMPLIB)
 110 
 111 ldapmodrdn :=   LDLIBS += -lldap
 112 ldapsearch :=   LDLIBS += -lldap
 113 ldapdelete :=   LDLIBS += -lldap
 114 ldapmodify :=   LDLIBS += -lldap
 115 ldaplist :=     LDLIBS += -lsldap
 116 ldapaddent :=   LDLIBS += -lsldap -lnsl -lsecdb
 117 ldapclient :=   LDLIBS += -lsldap -lscf
 118 
 119 ldaplist :=     CSTD = $(CSTD_GNU99)
 120 ldapaddent :=   CSTD = $(CSTD_GNU99)
 121 ldapclient :=   CSTD = $(CSTD_GNU99)
 122 
 123 lint :=         LDLIBS += -lldap
 124 
 125 .KEEP_STATE:
 126 
 127 all:    $(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 
 144 idsconfig:      ../ns_ldap/$$@.sh
 145                 $(CP) ../ns_ldap/$(IDSCONFIGSRC) $(IDSCONFIGPROG)
 146                 $(CHMOD) 755 $(IDSCONFIGPROG)
 147 
 148 ldaplist:       $(LDAPLISTOBJS)
 149                 $(LINK.c) -o $@ $(LDAPLISTOBJS) $(LDLIBS)
 150                 $(POST_PROCESS)
 151 
 152 ldapaddent:     $(LDAPADDENTOBJS)
 153                 $(LINK.c) -o $@ $(LDAPADDENTOBJS) $(LDLIBS)
 154                 $(POST_PROCESS)
 155 
 156 ldapclient:     $(LDAPCLIENTOBJS)
 157                 $(LINK.c) -o $@ $(LDAPCLIENTOBJS) $(LDLIBS)
 158                 $(POST_PROCESS)
 159 
 160 install: 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 
 176 FRC:
 177 
 178 clean:
 179         $(RM) $(OBJS)
 180 
 181 # Not linted Mozilla upstream commands
 182 lint: lintns_ldaplist lintns_ldapaddent lintns_ldapclient
 183 
 184 lintns_ldaplist := CSTD = $(CSTD_GNU99)
 185 
 186 lintns_ldaplist:
 187         $(LINT.c) $(LDAPLISTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap
 188 
 189 lintns_ldapaddent := CSTD = $(CSTD_GNU99)
 190 
 191 lintns_ldapaddent:
 192         $(LINT.c) $(LDAPADDENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lnsl \
 193                 -lsecdb
 194 
 195 lintns_ldapclient := CSTD = $(CSTD_GNU99)
 196 
 197 lintns_ldapclient:
 198         $(LINT.c) $(LDAPCLIENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lscf
 199 
 200 lintc_%:
 201         $(LINT.c) $(@:lintc_%=../common/%.c) $(LDAPCOMMSRC:%=../common/%) \
 202                  $(LDLIBS)
 203 
 204 include $(SRC)/cmd/Makefile.targ