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