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 2009 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 #
  25 #
  26 
  27 LIBRARY= libnisdb.a
  28 VERS=   .2
  29 PROTOCOL_DIR= $(ROOT)/include/rpcsvc
  30 YPTOL_DIR= ./yptol
  31 
  32 SED=    sed
  33 
  34 OBJECTS = \
  35         db_entry.o db_entry_c_xdr.o \
  36         db_item.o db_item_c_xdr.o \
  37         db_vers.o db_vers_c_xdr.o \
  38         db_pickle.o \
  39         db_table.o db_table_c_xdr.o \
  40         db_index_entry.o db_index_entry_c.o \
  41         db_index.o db_index_c_xdr.o \
  42         db_scheme.o db_scheme_c_xdr.o \
  43         db_query.o db_query_c_xdr.o \
  44         db_mindex.o db_mindex2.o db_mindex3.o db_mindex_c_xdr.o \
  45         db_log_entry.o db_log_entry_c_xdr.o \
  46         db_log.o \
  47         db.o \
  48         xdr_nullptr.o \
  49         db_dictionary.o db_dictionary_c_xdr.o \
  50         db_dictxdr.o db_dictlog.o db_dictlog_c_xdr.o \
  51         nis_db.o \
  52         nisdb_mt.o nisdb_rw.o \
  53         nis_hashitem.o \
  54         ldap_attr.o ldap_cto.o ldap_glob.o ldap_ldap.o \
  55         ldap_map.o ldap_nisdbquery.o \
  56         ldap_op.o ldap_parse.o ldap_print.o ldap_ruleval.o \
  57         ldap_util.o ldap_val.o ldap_xdr.o ldap_scheme.o \
  58         nis_ldap.o \
  59         nis_parse_ldap_attr.o nis_parse_ldap_conf.o \
  60         nis_parse_ldap_map.o nis_parse_ldap_util.o \
  61         nis_parse_ldap_yp_util.o        \
  62         dit_access.o \
  63         dit_access_utils.o \
  64         lock_update.o \
  65         map_conv.o \
  66         map_ctrl.o \
  67         yptol_utils.o \
  68         shim.o \
  69         shim_ancil.o \
  70         shim_lockmap.o \
  71         ttl_utils.o \
  72         update.o \
  73         shim_changepasswd.o \
  74         stubs.o
  75 
  76 X_FILES= \
  77     db_c.x             db_dictionary_c.x db_entry_c.x  db_index_c.x     \
  78     db_index_entry_c.x db_item_c.x       db_log_c.x    db_log_entry_c.x \
  79     db_mindex_c.x      db_query_c.x      db_scheme_c.x db_table_c.x     \
  80     db_vers_c.x        db_dictlog_c.x
  81 
  82 DERIVED_HEADERS= $(X_FILES:%_c.x=%_c.h) $(X_FILES:%_c.x=%.h)
  83 DERIVED_SOURCES= $(X_FILES:%_c.x=%_c_xdr.c)
  84 DERIVED_FILES= $(DERIVED_HEADERS) $(DERIVED_SOURCES)
  85 
  86 # delete the derived files when cleaning up
  87 CLEANFILES += $(DERIVED_FILES)
  88 
  89 # include library definitions
  90 include ../Makefile.lib
  91 
  92 MAPFILES =      mapfile-vers
  93 
  94 SRCS= db_dictionary_c_xdr.c db_dictlog_c_xdr.c db_dictxdr.c \
  95 db_entry_c_xdr.c db_index_c_xdr.c db_index_entry_c_xdr.c db_item_c_xdr.c \
  96 db_log_c_xdr.c db_log_entry_c_xdr.c db_mindex_c_xdr.c db_query_c_xdr.c \
  97 db_scheme_c_xdr.c db_table_c_xdr.c db_vers_c_xdr.c \
  98 $(YPTOL_DIR)/dit_access.c \
  99 $(YPTOL_DIR)/dit_access_utils.c \
 100 $(YPTOL_DIR)/lock_update.c \
 101 $(YPTOL_DIR)/map_conv.c \
 102 $(YPTOL_DIR)/map_ctrl.c \
 103 $(YPTOL_DIR)/yptol_utils.c \
 104 $(YPTOL_DIR)/shim.c \
 105 $(YPTOL_DIR)/shim_ancil.c \
 106 $(YPTOL_DIR)/shim_lockmap.c \
 107 $(YPTOL_DIR)/ttl_utils.c \
 108 $(YPTOL_DIR)/update.c \
 109 $(YPTOL_DIR)/shim_changepasswd.c \
 110 $(YPTOL_DIR)/stubs.c \
 111 #db_c_xdr.c xdr_nullptr.c
 112 
 113 # Libnisdb has grown large enough that there may be too many symbols
 114 # wanting `small' PIC references. Hence, compile some files with
 115 # `large' PIC references; the parser files are good candidates, since
 116 # they're only used at startup, and performance isn't too important.
 117 LARGESYMS=      nis_parse_ldap_conf.o \
 118                 nis_parse_ldap_attr.o \
 119                 nis_parse_ldap_yp_util.o \
 120                 nis_parse_ldap_map.o \
 121                 ldap_parse.o \
 122                 dit_access.o \
 123                 dit_access_utilis.o \
 124                 map_conv.o \
 125                 map_ctrl.o \
 126                 shim.o \
 127                 shim_ancil.o \
 128                 shim_changepasswd.o \
 129                 update.o \
 130                 stubs.o \
 131                 yptol_utils.o \
 132                 nis_parse_ldap_util.o
 133 LARGEPICS=      $(LARGESYMS:%=pics/%)
 134 $(LARGEPICS) := sparc_C_PICFLAGS = $(C_BIGPICFLAGS)
 135 $(LARGEPICS) := i386_C_PICFLAGS = $(C_BIGPICFLAGS)
 136 
 137 CPPFLAGS +=     -D_REENTRANT
 138 
 139 CERRWARN +=     -_gcc=-Wno-unused-variable
 140 CERRWARN +=     -_gcc=-Wno-unused-value
 141 CERRWARN +=     -_gcc=-Wno-uninitialized
 142 CERRWARN +=     -_gcc=-Wno-implicit-function-declaration
 143 CERRWARN +=     -_gcc=-Wno-switch
 144 CERRWARN +=     -_gcc=-Wno-parentheses
 145 
 146 # Extra includes, from yp, for yptol files.
 147 CPPFLAGS += -I$(SRC)/cmd/ypcmd
 148 
 149 LIBS = $(DYNLIB)
 150 ZDEFS=
 151 LDLIBS += -lnsl -lldap -lc
 152 
 153 # A number of interfaces are interposed by numerous applications, therefore
 154 # prevent direct binding to anything in libnisdb.  Disable libnisdb from
 155 # directly binding to itself, but allow libnisdb to directly bind to its
 156 # dependencies (ie. map -Bdirect -> -zdirect).  Ensure lazy loading is
 157 # established (which is enabled automatically with -Bdirect).  In addition,
 158 # libnisdb interposes on socket(), so tag this library as an interposer.
 159 # dependencies (lazyload).
 160 BDIRECT =
 161 DYNFLAGS +=     $(BNODIRECT) $(ZINTERPOSE) $(ZDIRECT) $(ZLAZYLOAD)
 162 
 163 all :=          TARGET= all
 164 clean :=        TARGET= clean
 165 clobber :=      TARGET= clobber
 166 install :=      TARGET= install
 167 lint :=         TARGET= lint
 168 
 169 .KEEP_STATE:
 170 
 171 all:    $(DERIVED_FILES) $(LIBS)
 172 
 173 install: all $(ROOTLIBS) $(ROOTLINKS)
 174 
 175 lint: $(DERIVED_FILES) .WAIT lintcheck
 176 
 177 pics/%.o: %.c
 178         $(COMPILE.c) -o $@ $<
 179         $(POST_PROCESS_O)
 180 
 181 pics/%.o: %.cc
 182         $(COMPILE.cc) -o $@ $<
 183         $(POST_PROCESS_O)
 184 
 185 objs/%.o pics/%.o profs/%.o: $(YPTOL_DIR)/%.c
 186         $(COMPILE.c) -o $@ $<
 187         $(POST_PROCESS_O)
 188 
 189 #
 190 # Pattern matching rules that define how to build the derived files.
 191 #
 192 %_c.h: %_c.x
 193         $(RM) $@
 194         $(RPCGEN) -DUSINGC -h -o $@ $<
 195 
 196 %.h: %_c.x
 197         $(RM) $@
 198         $(RPCGEN) -h -o $@ $<
 199 
 200 %_c_xdr.c: %_c.x
 201         $(RM) $@
 202         $(RPCGEN) -DUSINGC -c -o $@ $<
 203 
 204 # rename the xdr_db_free_entry() in the db_table_c_xdr.c.  So the one
 205 # in db_index_entry_c is used instead.
 206 DB_TABLE=db_table_c
 207 
 208 $(DB_TABLE)_xdr.c:      $(DB_TABLE).x
 209         $(RM) $@
 210         $(RPCGEN) -DUSINGC -c $(DB_TABLE).x |\
 211         $(SED) -e 's/^xdr_db_free_entry(/__OBSOLETED_xdr_db_free_entry(/' > $@
 212 
 213 # include library targets
 214 include ../Makefile.targ