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) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23 # Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  24 #
  25 # Copyright (c) 2018, Joyent, Inc.
  26 
  27 PROG =          idmapd
  28 MANIFEST =      idmap.xml
  29 SERVEROBJS =                            \
  30         adspriv_impl.o                  \
  31         directory_provider_builtin.o    \
  32         directory_provider_nsswitch.o   \
  33         directory_provider_ad.o         \
  34         directory_server.o              \
  35         adutils.o                       \
  36         dbutils.o                       \
  37         idmap_config.o                  \
  38         idmapd.o                        \
  39         init.o                          \
  40         idmap_lsa.o                     \
  41         krb5_lookup.o                   \
  42         nldaputils.o                    \
  43         server.o                        \
  44         wksids.o
  45 
  46 GENOBJS =                               \
  47         adspriv_srv.o                   \
  48         rpc_svc.o
  49 
  50 SERVERSRCS =    $(SERVEROBJS:%.o=%.c)
  51 GENSRCS =       $(GENOBJS:%.o=%.c)
  52 OBJS =          $(SERVEROBJS) $(GENOBJS)
  53 SRCS =          $(SERVERSRCS)
  54 POFILES =       $(OBJS:%.o=%.po)
  55 
  56 all :=          TARGET = all
  57 install :=      TARGET = install
  58 clean :=        TARGET = clean
  59 clobber :=      TARGET = clobber
  60 
  61 include ../../Makefile.cmd
  62 
  63 CERRWARN +=     -_gcc=-Wno-type-limits
  64 CERRWARN +=     -_gcc=-Wno-switch
  65 CERRWARN +=     -_gcc=-Wno-uninitialized
  66 
  67 # not linted
  68 SMATCH=off
  69 
  70 TEXT_DOMAIN =   SUNW_OST_OSLIB
  71 XGETTEXT =      $(GNUXGETTEXT)
  72 XGETFLAGS =     --foreign-user --strict -n -E --width=72 \
  73                 --omit-header --keyword=directoryError:2 \
  74                 --language=C --force-po
  75 
  76 CSTD = $(CSTD_GNU99)
  77 POFILE =        $(PROG)_all.po
  78 
  79 RPC_MSGOUT_OPT = -DRPC_MSGOUT=idmap_rpc_msgout
  80 
  81 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
  82 $(ROOTMANIFEST) := FILEMODE= 444
  83 RPCSVC= ../../../uts/common/rpcsvc
  84 ADS_CMN=../../../lib/libads/common
  85 
  86 INCS += -I. -I../../../lib/libidmap/common \
  87          -I../../../lib/libsldap/common \
  88          -I../../../lib/libadutils/common \
  89          -I $(ADS_CMN) \
  90          -I../../../lib/smbsrv/libsmb/common
  91 
  92 # Should not have to do this, but the Kerberos includes are a mess.
  93 INCS += -I $(ROOT)/usr/include/kerberosv5
  94 
  95 $(OBJS) := CPPFLAGS += $(INCS) -D_REENTRANT
  96 $(POFILE) := CPPFLAGS += $(INCS)
  97 
  98 LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
  99 LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
 100 
 101 CFLAGS += $(CCVERBOSE)
 102 LDLIBS += \
 103         -lsqlite-sys \
 104         -lsecdb \
 105         -lsocket \
 106         -lnsl \
 107         -lidmap \
 108         -lscf \
 109         -lsldap \
 110         -lldap \
 111         -luuid \
 112         -ladutils \
 113         -lads \
 114         -lumem \
 115         -lnvpair \
 116         -luutil \
 117         -L $(ROOT)/usr/lib/smbsrv \
 118         -lsmb
 119 
 120 rpc_svc.o := CFLAGS += $(RPC_MSGOUT_OPT)
 121 
 122 $(PROG) := MAPFILES = $(MAPFILE.INT) $(MAPFILE.NGB)
 123 $(PROG) := LDFLAGS += $(MAPFILES:%=-M%) \
 124         -R /usr/lib/smbsrv
 125 
 126 DIRMODE = 0755
 127 FILEMODE = 0555
 128 
 129 lint_SRCS := CPPFLAGS += $(INCS) -D_REENTRANT $(RPC_MSGOUT_OPT)
 130 
 131 .KEEP_STATE:
 132 
 133 .PARALLEL: $(OBJS)
 134 
 135 all: $(PROG)
 136 
 137 $(PROG): $(OBJS) $$(MAPFILES)
 138         $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
 139         $(POST_PROCESS)
 140 
 141 $(POFILE): $(POFILES)
 142         $(RM) $(POFILE)
 143         cat $(POFILES) > $(POFILE)
 144 
 145 install: all $(ROOTLIBPROG) $(ROOTMANIFEST)
 146 
 147 check: $(CHKMANIFEST)
 148 
 149 clean:
 150         $(RM) $(OBJS) $(GENSRCS)
 151 
 152 lint:   lint_SRCS
 153 
 154 lint_SRCS:
 155 
 156 RPCGENFLAGS = -CMN
 157 
 158 adspriv_srv.o : adspriv_srv.c
 159 
 160 adspriv_srv.c: 
 161         $(RPCGEN) $(RPCGENFLAGS) -m $(ADS_CMN)/ads_priv.x > $@
 162 
 163 rpc_svc.o : rpc_svc.c
 164 
 165 rpc_svc.c : $(RPCSVC)/idmap_prot.x
 166         $(RPCGEN) $(RPCGENFLAGS) -m $(RPCSVC)/idmap_prot.x > $@
 167 
 168 include ../../Makefile.targ