xref: /illumos-gate/usr/src/lib/libnisdb/Makefile (revision 02b17e23cf5bf66a5ea787e066ae3d1aa49bd856)
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#
22a87701e9SGary 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#
263eca6103SJohn Levon# Copyright (c) 2019, Joyent, Inc.
278e0c8248SAndrew Stormont# Copyright 2019 RackTop Systems.
288e0c8248SAndrew Stormont#
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateLIBRARY= libnisdb.a
317c478bd9Sstevel@tonic-gateVERS=	.2
327c478bd9Sstevel@tonic-gatePROTOCOL_DIR= $(ROOT)/include/rpcsvc
337c478bd9Sstevel@tonic-gateYPTOL_DIR= ./yptol
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
138a87701e9SGary Mills# More and stricter semantic checks and lint-like checks
139a87701e9SGary MillsCFLAGS	+=	$(CCVERBOSE)
140a87701e9SGary Mills
1417c478bd9Sstevel@tonic-gateCPPFLAGS +=	-D_REENTRANT
1427c478bd9Sstevel@tonic-gate
143a87701e9SGary Mills# Have an unused variable that can't be removed
144a87701e9SGary MillsUVAR_PICS = \
145a87701e9SGary Millspics/db_dictionary_c_xdr.o \
146a87701e9SGary Millspics/db_dictlog_c_xdr.o \
147a87701e9SGary Millspics/db_entry_c_xdr.o \
148a87701e9SGary Millspics/db_index_c_xdr.o \
149a87701e9SGary Millspics/db_item_c_xdr.o \
150a87701e9SGary Millspics/db_log_entry_c_xdr.o \
151a87701e9SGary Millspics/db_mindex_c_xdr.o \
152a87701e9SGary Millspics/db_query_c_xdr.o \
153a87701e9SGary Millspics/db_scheme_c_xdr.o \
154a87701e9SGary Millspics/db_table_c_xdr.o \
155a87701e9SGary Millspics/db_vers_c_xdr.o \
156a87701e9SGary Millspics/ldap_xdr.o \
157a87701e9SGary Millspics/dit_access.o \
158a87701e9SGary Millspics/update.o \
159a87701e9SGary Millspics/yptol_utils.o \
160a87701e9SGary Millspics/map_ctrl.o
161a87701e9SGary Mills
162a87701e9SGary Mills$(UVAR_PICS) := CERRWARN += -_gcc=-Wno-unused-variable
163a87701e9SGary Mills
164a87701e9SGary Mills# Correcting these might alter logic
165d3b5f563SJohn LevonCERRWARN +=	$(CNOWARN_UNINIT)
1667014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-switch
1677014882cSRichard Lowe
1688e0c8248SAndrew StormontCCERRWARN +=	-_gcc=-Wno-parentheses
1698e0c8248SAndrew StormontCCERRWARN +=	-_gcc=-Wno-unused-variable
1708e0c8248SAndrew StormontCCERRWARN +=	-_gcc=-Wno-unused-value
1718e0c8248SAndrew StormontCCERRWARN +=	-_gcc=-Wno-unused-function
1728e0c8248SAndrew StormontCCERRWARN +=	-_gcc=-Wno-return-type
1738e0c8248SAndrew StormontCCERRWARN +=	-_gcc=-Wno-uninitialized
1748e0c8248SAndrew Stormont
1758e0c8248SAndrew StormontCCERRWARN +=	-_gcc7=-Wno-nonnull-compare
1768e0c8248SAndrew Stormont
17705ede3dbSJohn Levon# not linted
17805ede3dbSJohn LevonSMATCH=off
17905ede3dbSJohn Levon
1807c478bd9Sstevel@tonic-gate# Extra includes, from yp, for yptol files.
1817c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/cmd/ypcmd
1827c478bd9Sstevel@tonic-gate
183a87701e9SGary Mills# Need the path to nis_clnt.h
184a87701e9SGary MillsCLNT_PICS = pics/db_entry_c_xdr.o pics/ldap_xdr.o pics/db_mindex_c_xdr.o
185a87701e9SGary Mills
186a87701e9SGary Mills$(CLNT_PICS) := CPPFLAGS += -I../libnsl/nis/gen
187a87701e9SGary Mills
1887c478bd9Sstevel@tonic-gateLIBS = $(DYNLIB)
1897c478bd9Sstevel@tonic-gateZDEFS=
190*5801b0f0SToomas SoomeZGUIDANCE=
191*5801b0f0SToomas Soome
19206e1a714SrafLDLIBS += -lnsl -lldap -lc
1937c478bd9Sstevel@tonic-gate
19424da5b34Srie# A number of interfaces are interposed by numerous applications, therefore
195f6acbf7cSrie# prevent direct binding to anything in libnisdb.  Disable libnisdb from
196f6acbf7cSrie# directly binding to itself, but allow libnisdb to directly bind to its
197f6acbf7cSrie# dependencies (ie. map -Bdirect -> -zdirect).  Ensure lazy loading is
198f6acbf7cSrie# established (which is enabled automatically with -Bdirect).  In addition,
199f6acbf7cSrie# libnisdb interposes on socket(), so tag this library as an interposer.
200f6acbf7cSrie# dependencies (lazyload).
201f6acbf7cSrieBDIRECT =
202f6acbf7cSrieDYNFLAGS +=	$(BNODIRECT) $(ZINTERPOSE) $(ZDIRECT) $(ZLAZYLOAD)
20324da5b34Srie
2047c478bd9Sstevel@tonic-gateall :=		TARGET= all
2057c478bd9Sstevel@tonic-gateclean :=	TARGET= clean
2067c478bd9Sstevel@tonic-gateclobber :=	TARGET= clobber
2077c478bd9Sstevel@tonic-gateinstall :=	TARGET= install
2087c478bd9Sstevel@tonic-gate
2097c478bd9Sstevel@tonic-gate.KEEP_STATE:
2107c478bd9Sstevel@tonic-gate
211f808c858Srafall:	$(DERIVED_FILES) $(LIBS)
2127c478bd9Sstevel@tonic-gate
2137c478bd9Sstevel@tonic-gateinstall: all $(ROOTLIBS) $(ROOTLINKS)
2147c478bd9Sstevel@tonic-gate
2157c478bd9Sstevel@tonic-gateobjs/%.o pics/%.o profs/%.o: $(YPTOL_DIR)/%.c
2167c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
2177c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
2187c478bd9Sstevel@tonic-gate
2197c478bd9Sstevel@tonic-gate#
2207c478bd9Sstevel@tonic-gate# Pattern matching rules that define how to build the derived files.
2217c478bd9Sstevel@tonic-gate#
2227c478bd9Sstevel@tonic-gate%_c.h: %_c.x
2237c478bd9Sstevel@tonic-gate	$(RM) $@
2247c478bd9Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -h -o $@ $<
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate%.h: %_c.x
2277c478bd9Sstevel@tonic-gate	$(RM) $@
2287c478bd9Sstevel@tonic-gate	$(RPCGEN) -h -o $@ $<
2297c478bd9Sstevel@tonic-gate
2307c478bd9Sstevel@tonic-gate%_c_xdr.c: %_c.x
2317c478bd9Sstevel@tonic-gate	$(RM) $@
2327c478bd9Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -c -o $@ $<
2337c478bd9Sstevel@tonic-gate
2347c478bd9Sstevel@tonic-gate# rename the xdr_db_free_entry() in the db_table_c_xdr.c.  So the one
2357c478bd9Sstevel@tonic-gate# in db_index_entry_c is used instead.
2367c478bd9Sstevel@tonic-gateDB_TABLE=db_table_c
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate$(DB_TABLE)_xdr.c:	$(DB_TABLE).x
2397c478bd9Sstevel@tonic-gate	$(RM) $@
2407c478bd9Sstevel@tonic-gate	$(RPCGEN) -DUSINGC -c $(DB_TABLE).x |\
2417c478bd9Sstevel@tonic-gate	$(SED) -e 's/^xdr_db_free_entry(/__OBSOLETED_xdr_db_free_entry(/' > $@
2427c478bd9Sstevel@tonic-gate
2437c478bd9Sstevel@tonic-gate# include library targets
2447c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
245