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