xref: /onnv-gate/usr/src/lib/libnisdb/Makefile (revision 11262:b7ebfbf2359e)
10Sstevel@tonic-gate#
20Sstevel@tonic-gate# CDDL HEADER START
30Sstevel@tonic-gate#
40Sstevel@tonic-gate# The contents of this file are subject to the terms of the
52522Sraf# Common Development and Distribution License (the "License").
62522Sraf# You may not use this file except in compliance with the License.
70Sstevel@tonic-gate#
80Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate# See the License for the specific language governing permissions
110Sstevel@tonic-gate# and limitations under the License.
120Sstevel@tonic-gate#
130Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate#
190Sstevel@tonic-gate# CDDL HEADER END
200Sstevel@tonic-gate#
210Sstevel@tonic-gate#
22*11262SRajagopal.Andra@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate# Use is subject to license terms.
240Sstevel@tonic-gate#
250Sstevel@tonic-gate#
260Sstevel@tonic-gate
270Sstevel@tonic-gateLIBRARY= libnisdb.a
280Sstevel@tonic-gateVERS=	.2
290Sstevel@tonic-gatePROTOCOL_DIR= $(ROOT)/include/rpcsvc
300Sstevel@tonic-gateYPTOL_DIR= ./yptol
310Sstevel@tonic-gate
320Sstevel@tonic-gateSED=	sed
330Sstevel@tonic-gate
340Sstevel@tonic-gateOBJECTS = \
350Sstevel@tonic-gate	db_entry.o db_entry_c_xdr.o \
360Sstevel@tonic-gate	db_item.o db_item_c_xdr.o \
370Sstevel@tonic-gate	db_vers.o db_vers_c_xdr.o \
380Sstevel@tonic-gate	db_pickle.o \
390Sstevel@tonic-gate	db_table.o db_table_c_xdr.o \
400Sstevel@tonic-gate	db_index_entry.o db_index_entry_c.o \
410Sstevel@tonic-gate	db_index.o db_index_c_xdr.o \
420Sstevel@tonic-gate	db_scheme.o db_scheme_c_xdr.o \
430Sstevel@tonic-gate	db_query.o db_query_c_xdr.o \
440Sstevel@tonic-gate	db_mindex.o db_mindex2.o db_mindex3.o db_mindex_c_xdr.o \
450Sstevel@tonic-gate	db_log_entry.o db_log_entry_c_xdr.o \
460Sstevel@tonic-gate	db_log.o \
470Sstevel@tonic-gate	db.o \
480Sstevel@tonic-gate	xdr_nullptr.o \
490Sstevel@tonic-gate	db_dictionary.o db_dictionary_c_xdr.o \
500Sstevel@tonic-gate	db_dictxdr.o db_dictlog.o db_dictlog_c_xdr.o \
510Sstevel@tonic-gate	nis_db.o \
520Sstevel@tonic-gate	nisdb_mt.o nisdb_rw.o \
53*11262SRajagopal.Andra@Sun.COM	nis_hashitem.o \
540Sstevel@tonic-gate	ldap_attr.o ldap_cto.o ldap_glob.o ldap_ldap.o \
55*11262SRajagopal.Andra@Sun.COM	ldap_map.o ldap_nisdbquery.o \
560Sstevel@tonic-gate	ldap_op.o ldap_parse.o ldap_print.o ldap_ruleval.o \
570Sstevel@tonic-gate	ldap_util.o ldap_val.o ldap_xdr.o ldap_scheme.o \
580Sstevel@tonic-gate	nis_ldap.o \
590Sstevel@tonic-gate	nis_parse_ldap_attr.o nis_parse_ldap_conf.o \
600Sstevel@tonic-gate	nis_parse_ldap_map.o nis_parse_ldap_util.o \
610Sstevel@tonic-gate	nis_parse_ldap_yp_util.o	\
620Sstevel@tonic-gate	dit_access.o \
630Sstevel@tonic-gate	dit_access_utils.o \
640Sstevel@tonic-gate	lock_update.o \
650Sstevel@tonic-gate	map_conv.o \
660Sstevel@tonic-gate	map_ctrl.o \
670Sstevel@tonic-gate	yptol_utils.o \
680Sstevel@tonic-gate	shim.o \
690Sstevel@tonic-gate	shim_ancil.o \
700Sstevel@tonic-gate	shim_lockmap.o \
710Sstevel@tonic-gate	ttl_utils.o \
720Sstevel@tonic-gate	update.o \
730Sstevel@tonic-gate	shim_changepasswd.o \
740Sstevel@tonic-gate	stubs.o
750Sstevel@tonic-gate
760Sstevel@tonic-gateX_FILES= \
770Sstevel@tonic-gate    db_c.x             db_dictionary_c.x db_entry_c.x  db_index_c.x     \
780Sstevel@tonic-gate    db_index_entry_c.x db_item_c.x       db_log_c.x    db_log_entry_c.x \
790Sstevel@tonic-gate    db_mindex_c.x      db_query_c.x      db_scheme_c.x db_table_c.x     \
800Sstevel@tonic-gate    db_vers_c.x	       db_dictlog_c.x
810Sstevel@tonic-gate
820Sstevel@tonic-gateDERIVED_HEADERS= $(X_FILES:%_c.x=%_c.h) $(X_FILES:%_c.x=%.h)
830Sstevel@tonic-gateDERIVED_SOURCES= $(X_FILES:%_c.x=%_c_xdr.c)
840Sstevel@tonic-gateDERIVED_FILES= $(DERIVED_HEADERS) $(DERIVED_SOURCES)
850Sstevel@tonic-gate
860Sstevel@tonic-gate# delete the derived files when cleaning up
870Sstevel@tonic-gateCLEANFILES += $(DERIVED_FILES)
880Sstevel@tonic-gate
890Sstevel@tonic-gate# include library definitions
900Sstevel@tonic-gateinclude ../Makefile.lib
910Sstevel@tonic-gate
922522SrafMAPFILES =	mapfile-vers
930Sstevel@tonic-gate
940Sstevel@tonic-gateSRCS= db_dictionary_c_xdr.c db_dictlog_c_xdr.c db_dictxdr.c \
950Sstevel@tonic-gatedb_entry_c_xdr.c db_index_c_xdr.c db_index_entry_c_xdr.c db_item_c_xdr.c \
960Sstevel@tonic-gatedb_log_c_xdr.c db_log_entry_c_xdr.c db_mindex_c_xdr.c db_query_c_xdr.c \
970Sstevel@tonic-gatedb_scheme_c_xdr.c db_table_c_xdr.c db_vers_c_xdr.c \
980Sstevel@tonic-gate$(YPTOL_DIR)/dit_access.c \
990Sstevel@tonic-gate$(YPTOL_DIR)/dit_access_utils.c \
1000Sstevel@tonic-gate$(YPTOL_DIR)/lock_update.c \
1010Sstevel@tonic-gate$(YPTOL_DIR)/map_conv.c \
1020Sstevel@tonic-gate$(YPTOL_DIR)/map_ctrl.c \
1030Sstevel@tonic-gate$(YPTOL_DIR)/yptol_utils.c \
1040Sstevel@tonic-gate$(YPTOL_DIR)/shim.c \
1050Sstevel@tonic-gate$(YPTOL_DIR)/shim_ancil.c \
1060Sstevel@tonic-gate$(YPTOL_DIR)/shim_lockmap.c \
1070Sstevel@tonic-gate$(YPTOL_DIR)/ttl_utils.c \
1080Sstevel@tonic-gate$(YPTOL_DIR)/update.c \
1090Sstevel@tonic-gate$(YPTOL_DIR)/shim_changepasswd.c \
1100Sstevel@tonic-gate$(YPTOL_DIR)/stubs.c \
1110Sstevel@tonic-gate#db_c_xdr.c xdr_nullptr.c
1120Sstevel@tonic-gate
1130Sstevel@tonic-gate# Libnisdb has grown large enough that there may be too many symbols
1140Sstevel@tonic-gate# wanting `small' PIC references. Hence, compile some files with
1150Sstevel@tonic-gate# `large' PIC references; the parser files are good candidates, since
1160Sstevel@tonic-gate# they're only used at startup, and performance isn't too important.
1170Sstevel@tonic-gateLARGESYMS=	nis_parse_ldap_conf.o \
1180Sstevel@tonic-gate		nis_parse_ldap_attr.o \
1190Sstevel@tonic-gate		nis_parse_ldap_yp_util.o \
1200Sstevel@tonic-gate		nis_parse_ldap_map.o \
1210Sstevel@tonic-gate		ldap_parse.o \
1220Sstevel@tonic-gate		dit_access.o \
1230Sstevel@tonic-gate		dit_access_utilis.o \
1240Sstevel@tonic-gate		map_conv.o \
1250Sstevel@tonic-gate		map_ctrl.o \
1260Sstevel@tonic-gate		shim.o \
1270Sstevel@tonic-gate		shim_ancil.o \
1280Sstevel@tonic-gate		shim_changepasswd.o \
1290Sstevel@tonic-gate		update.o \
1300Sstevel@tonic-gate		stubs.o \
1310Sstevel@tonic-gate		yptol_utils.o \
1320Sstevel@tonic-gate		nis_parse_ldap_util.o
1330Sstevel@tonic-gateLARGEPICS=	$(LARGESYMS:%=pics/%)
1340Sstevel@tonic-gate$(LARGEPICS) :=	sparc_C_PICFLAGS = $(C_BIGPICFLAGS)
1350Sstevel@tonic-gate$(LARGEPICS) :=	i386_C_PICFLAGS = $(C_BIGPICFLAGS)
1360Sstevel@tonic-gate
1370Sstevel@tonic-gateCPPFLAGS +=	-D_REENTRANT
1380Sstevel@tonic-gate
1390Sstevel@tonic-gate# Extra includes, from yp, for yptol files.
1400Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/cmd/ypcmd
1410Sstevel@tonic-gate
1420Sstevel@tonic-gateLIBS = $(DYNLIB)
1430Sstevel@tonic-gateZDEFS=
1442923SrafLDLIBS += -lnsl -lldap -lc
1450Sstevel@tonic-gate
1464271Srie# A number of interfaces are interposed by numerous applications, therefore
1475905Srie# prevent direct binding to anything in libnisdb.  Disable libnisdb from
1485905Srie# directly binding to itself, but allow libnisdb to directly bind to its
1495905Srie# dependencies (ie. map -Bdirect -> -zdirect).  Ensure lazy loading is
1505905Srie# established (which is enabled automatically with -Bdirect).  In addition,
1515905Srie# libnisdb interposes on socket(), so tag this library as an interposer.
1525905Srie# dependencies (lazyload).
1535905SrieBDIRECT =
1545905SrieDYNFLAGS +=	$(BNODIRECT) $(ZINTERPOSE) $(ZDIRECT) $(ZLAZYLOAD)
1554271Srie
1560Sstevel@tonic-gateall :=		TARGET= all
1570Sstevel@tonic-gateclean :=	TARGET= clean
1580Sstevel@tonic-gateclobber :=	TARGET= clobber
1590Sstevel@tonic-gateinstall :=	TARGET= install
1600Sstevel@tonic-gatelint :=		TARGET= lint
1610Sstevel@tonic-gate
1620Sstevel@tonic-gate.KEEP_STATE:
1630Sstevel@tonic-gate
1642522Srafall:	$(DERIVED_FILES) $(LIBS)
1650Sstevel@tonic-gate
1660Sstevel@tonic-gateinstall: all $(ROOTLIBS) $(ROOTLINKS)
1670Sstevel@tonic-gate
1680Sstevel@tonic-gatelint: $(DERIVED_FILES) .WAIT lintcheck
1690Sstevel@tonic-gate
1700Sstevel@tonic-gatepics/%.o: %.c
1710Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1720Sstevel@tonic-gate	$(POST_PROCESS_O)
1730Sstevel@tonic-gate
1740Sstevel@tonic-gatepics/%.o: %.cc
1750Sstevel@tonic-gate	$(COMPILE.cc) -o $@ $<
1760Sstevel@tonic-gate	$(POST_PROCESS_O)
1770Sstevel@tonic-gate
1780Sstevel@tonic-gateobjs/%.o pics/%.o profs/%.o: $(YPTOL_DIR)/%.c
1790Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1800Sstevel@tonic-gate	$(POST_PROCESS_O)
1810Sstevel@tonic-gate
1820Sstevel@tonic-gate#
1830Sstevel@tonic-gate# Pattern matching rules that define how to build the derived files.
1840Sstevel@tonic-gate#
1850Sstevel@tonic-gate%_c.h: %_c.x
1860Sstevel@tonic-gate	$(RM) $@
1870Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -h -o $@ $<
1880Sstevel@tonic-gate
1890Sstevel@tonic-gate%.h: %_c.x
1900Sstevel@tonic-gate	$(RM) $@
1910Sstevel@tonic-gate	$(RPCGEN) -h -o $@ $<
1920Sstevel@tonic-gate
1930Sstevel@tonic-gate%_c_xdr.c: %_c.x
1940Sstevel@tonic-gate	$(RM) $@
1950Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -c -o $@ $<
1960Sstevel@tonic-gate
1970Sstevel@tonic-gate# rename the xdr_db_free_entry() in the db_table_c_xdr.c.  So the one
1980Sstevel@tonic-gate# in db_index_entry_c is used instead.
1990Sstevel@tonic-gateDB_TABLE=db_table_c
2000Sstevel@tonic-gate
2010Sstevel@tonic-gate$(DB_TABLE)_xdr.c:	$(DB_TABLE).x
2020Sstevel@tonic-gate	$(RM) $@
2030Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -c $(DB_TABLE).x |\
2040Sstevel@tonic-gate	$(SED) -e 's/^xdr_db_free_entry(/__OBSOLETED_xdr_db_free_entry(/' > $@
2050Sstevel@tonic-gate
2060Sstevel@tonic-gate# include library targets
2070Sstevel@tonic-gateinclude ../Makefile.targ
208