xref: /titanic_51/usr/src/lib/libnisdb/Makefile (revision a87701e9837f8a9ee9e4c4d3186295c0e29f743f)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5f808c858Sraf# Common Development and Distribution License (the "License").
6f808c858Sraf# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
22*a87701e9SGary Mills# Copyright 2015 Gary Mills
2336e852a1SRaja Andra# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateLIBRARY= libnisdb.a
297c478bd9Sstevel@tonic-gateVERS=	.2
307c478bd9Sstevel@tonic-gatePROTOCOL_DIR= $(ROOT)/include/rpcsvc
317c478bd9Sstevel@tonic-gateYPTOL_DIR= ./yptol
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gateSED=	sed
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gateOBJECTS = \
367c478bd9Sstevel@tonic-gate	db_entry.o db_entry_c_xdr.o \
377c478bd9Sstevel@tonic-gate	db_item.o db_item_c_xdr.o \
387c478bd9Sstevel@tonic-gate	db_vers.o db_vers_c_xdr.o \
397c478bd9Sstevel@tonic-gate	db_pickle.o \
407c478bd9Sstevel@tonic-gate	db_table.o db_table_c_xdr.o \
417c478bd9Sstevel@tonic-gate	db_index_entry.o db_index_entry_c.o \
427c478bd9Sstevel@tonic-gate	db_index.o db_index_c_xdr.o \
437c478bd9Sstevel@tonic-gate	db_scheme.o db_scheme_c_xdr.o \
447c478bd9Sstevel@tonic-gate	db_query.o db_query_c_xdr.o \
457c478bd9Sstevel@tonic-gate	db_mindex.o db_mindex2.o db_mindex3.o db_mindex_c_xdr.o \
467c478bd9Sstevel@tonic-gate	db_log_entry.o db_log_entry_c_xdr.o \
477c478bd9Sstevel@tonic-gate	db_log.o \
487c478bd9Sstevel@tonic-gate	db.o \
497c478bd9Sstevel@tonic-gate	xdr_nullptr.o \
507c478bd9Sstevel@tonic-gate	db_dictionary.o db_dictionary_c_xdr.o \
517c478bd9Sstevel@tonic-gate	db_dictxdr.o db_dictlog.o db_dictlog_c_xdr.o \
527c478bd9Sstevel@tonic-gate	nis_db.o \
537c478bd9Sstevel@tonic-gate	nisdb_mt.o nisdb_rw.o \
5436e852a1SRaja Andra	nis_hashitem.o \
557c478bd9Sstevel@tonic-gate	ldap_attr.o ldap_cto.o ldap_glob.o ldap_ldap.o \
5636e852a1SRaja Andra	ldap_map.o ldap_nisdbquery.o \
577c478bd9Sstevel@tonic-gate	ldap_op.o ldap_parse.o ldap_print.o ldap_ruleval.o \
587c478bd9Sstevel@tonic-gate	ldap_util.o ldap_val.o ldap_xdr.o ldap_scheme.o \
597c478bd9Sstevel@tonic-gate	nis_ldap.o \
607c478bd9Sstevel@tonic-gate	nis_parse_ldap_attr.o nis_parse_ldap_conf.o \
617c478bd9Sstevel@tonic-gate	nis_parse_ldap_map.o nis_parse_ldap_util.o \
627c478bd9Sstevel@tonic-gate	nis_parse_ldap_yp_util.o	\
637c478bd9Sstevel@tonic-gate	dit_access.o \
647c478bd9Sstevel@tonic-gate	dit_access_utils.o \
657c478bd9Sstevel@tonic-gate	lock_update.o \
667c478bd9Sstevel@tonic-gate	map_conv.o \
677c478bd9Sstevel@tonic-gate	map_ctrl.o \
687c478bd9Sstevel@tonic-gate	yptol_utils.o \
697c478bd9Sstevel@tonic-gate	shim.o \
707c478bd9Sstevel@tonic-gate	shim_ancil.o \
717c478bd9Sstevel@tonic-gate	shim_lockmap.o \
727c478bd9Sstevel@tonic-gate	ttl_utils.o \
737c478bd9Sstevel@tonic-gate	update.o \
747c478bd9Sstevel@tonic-gate	shim_changepasswd.o \
757c478bd9Sstevel@tonic-gate	stubs.o
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateX_FILES= \
787c478bd9Sstevel@tonic-gate    db_c.x             db_dictionary_c.x db_entry_c.x  db_index_c.x     \
797c478bd9Sstevel@tonic-gate    db_index_entry_c.x db_item_c.x       db_log_c.x    db_log_entry_c.x \
807c478bd9Sstevel@tonic-gate    db_mindex_c.x      db_query_c.x      db_scheme_c.x db_table_c.x     \
817c478bd9Sstevel@tonic-gate    db_vers_c.x	       db_dictlog_c.x
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gateDERIVED_HEADERS= $(X_FILES:%_c.x=%_c.h) $(X_FILES:%_c.x=%.h)
847c478bd9Sstevel@tonic-gateDERIVED_SOURCES= $(X_FILES:%_c.x=%_c_xdr.c)
857c478bd9Sstevel@tonic-gateDERIVED_FILES= $(DERIVED_HEADERS) $(DERIVED_SOURCES)
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gate# delete the derived files when cleaning up
887c478bd9Sstevel@tonic-gateCLEANFILES += $(DERIVED_FILES)
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate# include library definitions
917c478bd9Sstevel@tonic-gateinclude ../Makefile.lib
927c478bd9Sstevel@tonic-gate
93f808c858SrafMAPFILES =	mapfile-vers
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gateSRCS= db_dictionary_c_xdr.c db_dictlog_c_xdr.c db_dictxdr.c \
967c478bd9Sstevel@tonic-gatedb_entry_c_xdr.c db_index_c_xdr.c db_index_entry_c_xdr.c db_item_c_xdr.c \
977c478bd9Sstevel@tonic-gatedb_log_c_xdr.c db_log_entry_c_xdr.c db_mindex_c_xdr.c db_query_c_xdr.c \
987c478bd9Sstevel@tonic-gatedb_scheme_c_xdr.c db_table_c_xdr.c db_vers_c_xdr.c \
997c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/dit_access.c \
1007c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/dit_access_utils.c \
1017c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/lock_update.c \
1027c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/map_conv.c \
1037c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/map_ctrl.c \
1047c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/yptol_utils.c \
1057c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/shim.c \
1067c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/shim_ancil.c \
1077c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/shim_lockmap.c \
1087c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/ttl_utils.c \
1097c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/update.c \
1107c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/shim_changepasswd.c \
1117c478bd9Sstevel@tonic-gate$(YPTOL_DIR)/stubs.c \
1127c478bd9Sstevel@tonic-gate#db_c_xdr.c xdr_nullptr.c
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate# Libnisdb has grown large enough that there may be too many symbols
1157c478bd9Sstevel@tonic-gate# wanting `small' PIC references. Hence, compile some files with
1167c478bd9Sstevel@tonic-gate# `large' PIC references; the parser files are good candidates, since
1177c478bd9Sstevel@tonic-gate# they're only used at startup, and performance isn't too important.
1187c478bd9Sstevel@tonic-gateLARGESYMS=	nis_parse_ldap_conf.o \
1197c478bd9Sstevel@tonic-gate		nis_parse_ldap_attr.o \
1207c478bd9Sstevel@tonic-gate		nis_parse_ldap_yp_util.o \
1217c478bd9Sstevel@tonic-gate		nis_parse_ldap_map.o \
1227c478bd9Sstevel@tonic-gate		ldap_parse.o \
1237c478bd9Sstevel@tonic-gate		dit_access.o \
1247c478bd9Sstevel@tonic-gate		dit_access_utilis.o \
1257c478bd9Sstevel@tonic-gate		map_conv.o \
1267c478bd9Sstevel@tonic-gate		map_ctrl.o \
1277c478bd9Sstevel@tonic-gate		shim.o \
1287c478bd9Sstevel@tonic-gate		shim_ancil.o \
1297c478bd9Sstevel@tonic-gate		shim_changepasswd.o \
1307c478bd9Sstevel@tonic-gate		update.o \
1317c478bd9Sstevel@tonic-gate		stubs.o \
1327c478bd9Sstevel@tonic-gate		yptol_utils.o \
1337c478bd9Sstevel@tonic-gate		nis_parse_ldap_util.o
1347c478bd9Sstevel@tonic-gateLARGEPICS=	$(LARGESYMS:%=pics/%)
1357c478bd9Sstevel@tonic-gate$(LARGEPICS) :=	sparc_C_PICFLAGS = $(C_BIGPICFLAGS)
1367c478bd9Sstevel@tonic-gate$(LARGEPICS) :=	i386_C_PICFLAGS = $(C_BIGPICFLAGS)
1377c478bd9Sstevel@tonic-gate
138*a87701e9SGary Mills# More and stricter semantic checks and lint-like checks
139*a87701e9SGary MillsCFLAGS	+=	$(CCVERBOSE)
140*a87701e9SGary Mills
1417c478bd9Sstevel@tonic-gateCPPFLAGS +=	-D_REENTRANT
1427c478bd9Sstevel@tonic-gate
143*a87701e9SGary Mills# Have an unused variable that can't be removed
144*a87701e9SGary MillsUVAR_PICS = \
145*a87701e9SGary Millspics/db_dictionary_c_xdr.o \
146*a87701e9SGary Millspics/db_dictlog_c_xdr.o \
147*a87701e9SGary Millspics/db_entry_c_xdr.o \
148*a87701e9SGary Millspics/db_index_c_xdr.o \
149*a87701e9SGary Millspics/db_item_c_xdr.o \
150*a87701e9SGary Millspics/db_log_entry_c_xdr.o \
151*a87701e9SGary Millspics/db_mindex_c_xdr.o \
152*a87701e9SGary Millspics/db_query_c_xdr.o \
153*a87701e9SGary Millspics/db_scheme_c_xdr.o \
154*a87701e9SGary Millspics/db_table_c_xdr.o \
155*a87701e9SGary Millspics/db_vers_c_xdr.o \
156*a87701e9SGary Millspics/ldap_xdr.o \
157*a87701e9SGary Millspics/dit_access.o \
158*a87701e9SGary Millspics/update.o \
159*a87701e9SGary Millspics/yptol_utils.o \
160*a87701e9SGary Millspics/map_ctrl.o
161*a87701e9SGary Mills
162*a87701e9SGary Mills$(UVAR_PICS) := CERRWARN += -_gcc=-Wno-unused-variable
163*a87701e9SGary Mills
164*a87701e9SGary Mills# Correcting these might alter logic
1657014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-uninitialized
1667014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-switch
1677014882cSRichard Lowe
1687c478bd9Sstevel@tonic-gate# Extra includes, from yp, for yptol files.
1697c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/cmd/ypcmd
1707c478bd9Sstevel@tonic-gate
171*a87701e9SGary Mills# Need the path to nis_clnt.h
172*a87701e9SGary MillsCLNT_PICS = pics/db_entry_c_xdr.o pics/ldap_xdr.o pics/db_mindex_c_xdr.o
173*a87701e9SGary Mills
174*a87701e9SGary Mills$(CLNT_PICS) := CPPFLAGS += -I../libnsl/nis/gen
175*a87701e9SGary Mills
1767c478bd9Sstevel@tonic-gateLIBS = $(DYNLIB)
1777c478bd9Sstevel@tonic-gateZDEFS=
17806e1a714SrafLDLIBS += -lnsl -lldap -lc
1797c478bd9Sstevel@tonic-gate
18024da5b34Srie# A number of interfaces are interposed by numerous applications, therefore
181f6acbf7cSrie# prevent direct binding to anything in libnisdb.  Disable libnisdb from
182f6acbf7cSrie# directly binding to itself, but allow libnisdb to directly bind to its
183f6acbf7cSrie# dependencies (ie. map -Bdirect -> -zdirect).  Ensure lazy loading is
184f6acbf7cSrie# established (which is enabled automatically with -Bdirect).  In addition,
185f6acbf7cSrie# libnisdb interposes on socket(), so tag this library as an interposer.
186f6acbf7cSrie# dependencies (lazyload).
187f6acbf7cSrieBDIRECT =
188f6acbf7cSrieDYNFLAGS +=	$(BNODIRECT) $(ZINTERPOSE) $(ZDIRECT) $(ZLAZYLOAD)
18924da5b34Srie
1907c478bd9Sstevel@tonic-gateall :=		TARGET= all
1917c478bd9Sstevel@tonic-gateclean :=	TARGET= clean
1927c478bd9Sstevel@tonic-gateclobber :=	TARGET= clobber
1937c478bd9Sstevel@tonic-gateinstall :=	TARGET= install
1947c478bd9Sstevel@tonic-gatelint :=		TARGET= lint
1957c478bd9Sstevel@tonic-gate
1967c478bd9Sstevel@tonic-gate.KEEP_STATE:
1977c478bd9Sstevel@tonic-gate
198f808c858Srafall:	$(DERIVED_FILES) $(LIBS)
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gateinstall: all $(ROOTLIBS) $(ROOTLINKS)
2017c478bd9Sstevel@tonic-gate
2027c478bd9Sstevel@tonic-gatelint: $(DERIVED_FILES) .WAIT lintcheck
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gatepics/%.o: %.c
2057c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
2067c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gatepics/%.o: %.cc
2097c478bd9Sstevel@tonic-gate	$(COMPILE.cc) -o $@ $<
2107c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
2117c478bd9Sstevel@tonic-gate
2127c478bd9Sstevel@tonic-gateobjs/%.o pics/%.o profs/%.o: $(YPTOL_DIR)/%.c
2137c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
2147c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate#
2177c478bd9Sstevel@tonic-gate# Pattern matching rules that define how to build the derived files.
2187c478bd9Sstevel@tonic-gate#
2197c478bd9Sstevel@tonic-gate%_c.h: %_c.x
2207c478bd9Sstevel@tonic-gate	$(RM) $@
2217c478bd9Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -h -o $@ $<
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate%.h: %_c.x
2247c478bd9Sstevel@tonic-gate	$(RM) $@
2257c478bd9Sstevel@tonic-gate	$(RPCGEN) -h -o $@ $<
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate%_c_xdr.c: %_c.x
2287c478bd9Sstevel@tonic-gate	$(RM) $@
2297c478bd9Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -c -o $@ $<
2307c478bd9Sstevel@tonic-gate
2317c478bd9Sstevel@tonic-gate# rename the xdr_db_free_entry() in the db_table_c_xdr.c.  So the one
2327c478bd9Sstevel@tonic-gate# in db_index_entry_c is used instead.
2337c478bd9Sstevel@tonic-gateDB_TABLE=db_table_c
2347c478bd9Sstevel@tonic-gate
2357c478bd9Sstevel@tonic-gate$(DB_TABLE)_xdr.c:	$(DB_TABLE).x
2367c478bd9Sstevel@tonic-gate	$(RM) $@
2377c478bd9Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -c $(DB_TABLE).x |\
2387c478bd9Sstevel@tonic-gate	$(SED) -e 's/^xdr_db_free_entry(/__OBSOLETED_xdr_db_free_entry(/' > $@
2397c478bd9Sstevel@tonic-gate
2407c478bd9Sstevel@tonic-gate# include library targets
2417c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
242