xref: /illumos-gate/usr/src/lib/libnsl/Makefile (revision 80ab886d)
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#
23#
24# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27# ident	"%Z%%M%	%I%	%E% SMI"
28#
29# lib/libnsl/Makefile
30#
31PROTOCOL_DIR= $(ROOTHDRDIR)/rpcsvc
32PROTOCOL_SRCDIR= $(SRC)/head/rpcsvc
33PROTOCOL_UTS_SRCDIR= $(SRC)/uts/common/rpc
34
35SUBDIRS = spec .WAIT $(MACH) $(BUILD64) .WAIT $(MACH64)
36
37# objects are listed by source directory
38
39# common utility code used in more than one directory
40RPC_DERIVED_FILES=
41
42GEN_DERIVED_FILES= \
43	nis/gen/nis_clnt.h      \
44	nis/gen/nis_clnt.c
45
46CACHE_DERIVED_FILES= \
47	nis/cache/nis_clnt.h	\
48	nis/cache/nis_cache.h	\
49	nis/cache/nis_cache_clnt.cc \
50	nis/cache/nis_cache_xdr.cc
51
52PROTOCOL_FILES= \
53	$(PROTOCOL_DIR)/daemon_utils.h	\
54	$(PROTOCOL_DIR)/nis.x		\
55	$(PROTOCOL_DIR)/nis.h		\
56	$(PROTOCOL_DIR)/nis_object.x	\
57	$(PROTOCOL_DIR)/nis_callback.x	\
58	$(PROTOCOL_DIR)/nis_callback.h	\
59	$(PROTOCOL_DIR)/nis_cache.x	\
60	$(PROTOCOL_DIR)/nis_cache.h
61
62PROTOCOL_FILES_UTS= \
63	$(PROTOCOL_DIR)/key_prot.x
64
65DERIVED_FILES= $(GEN_DERIVED_FILES) $(CACHE_DERIVED_FILES) $(RPC_DERIVED_FILES)
66
67#
68# Make sure they get cleaned when necessary
69#
70CLEANFILES += $(DERIVED_FILES)
71
72# include library definitions
73include ../Makefile.lib
74
75# header file delivered to /usr/include; internal to ON build process
76HDRS =		nss.h
77HDRDIR =	nss
78
79LIBRARY= libnsl.a
80TEXT_DOMAIN= SUNW_OST_NETRPC
81POFILE= $(LIBRARY:.a=.po)
82POFILES= generic.po _errlst.po
83
84all :=		TARGET= all
85clean :=	TARGET= clean
86clobber :=	TARGET= clobber
87delete :=	TARGET= delete
88install :=	TARGET= install
89lint :=		TARGET= lint
90_msg :=		TARGET= _msg
91package :=	TARGET= package
92
93
94.KEEP_STATE:
95
96all:		$(PROTOCOL_DIR) $(DERIVED_FILES) .WAIT $(SUBDIRS)
97
98headers:	$(PROTOCOL_DIR) .WAIT $(PROTOCOL_FILES) $(PROTOCOL_FILES_UTS) \
99		$(DERIVED_FILES)
100
101install:	all $(SUBDIRS)
102
103install_h:	$(ROOTHDRS)
104
105# nss.h isn't delivered; no reason to check
106check:
107
108clean clobber delete lint package:	$(SUBDIRS)
109
110$(PROTOCOL_DIR):
111	$(INS.dir)
112
113$(PROTOCOL_DIR)/%.h:	$(PROTOCOL_SRCDIR)/%.h
114	$(INS.file)
115
116$(PROTOCOL_DIR)/nis.h:	$(PROTOCOL_SRCDIR)/nis.x $(PROTOCOL_SRCDIR)/nis_object.x
117	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis.x > nis-tmp.h
118	$(SED) -e '/EDIT_START/,$$ d' < nis-tmp.h > nis.h
119	$(RM) $@
120	$(INS) -s -m $(FILEMODE) -f $(@D) nis.h
121	$(RM) nis.h nis-tmp.h
122
123$(PROTOCOL_DIR)/nis_callback.h:	$(PROTOCOL_SRCDIR)/nis_callback.x
124	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_callback.x -o nis_callback.h
125	$(RM) $@
126	$(INS) -s -m $(FILEMODE) -f $(@D) nis_callback.h
127	$(RM) nis_callback.h
128
129$(PROTOCOL_DIR)/nis_cache.h:	$(PROTOCOL_SRCDIR)/nis_cache.x
130	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_cache.x -o nis_cache.h
131	$(RM) $@
132	$(INS) -s -m $(FILEMODE) -f $(@D) nis_cache.h
133	$(RM) nis_cache.h
134
135$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_SRCDIR)/%.x
136	$(INS.file)
137
138$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_UTS_SRCDIR)/%.x
139	$(INS.file)
140
141#
142# Rules for building the derived files
143#
144# Derived header files
145#
146nis/gen/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
147	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-gen.h
148	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-gen.h |\
149	$(SED) -e 's/_3_svc/_svc/' |\
150	$(SED) -e 's/_3/_clnt/' > $@
151	$(RM) nis_clnt-gen.h
152
153nis/cache/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
154	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-cache.h
155	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-cache.h |\
156	$(SED) -e 's/_3_svc/_svc/' |\
157	$(SED) -e 's/_3/_clnt/' > $@
158	$(RM) nis_clnt-cache.h
159
160#
161# Derived source files
162#
163nis/gen/nis_clnt.c: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
164	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis.x > nis_clnt-tmp.c
165	$(SED) -e 's!\"$(PROTOCOL_DIR)/nis.h\"!\<rpcsvc/nis.h\>!' \
166	    < nis_clnt-tmp.c |\
167	$(SED) -e '/#include <memory.h>/i\
168#include "mt.h"' |\
169	$(SED) -e 's/_3/_clnt/' > $@
170	$(RM) nis_clnt-tmp.c
171
172nis/cache/nis_cache_xdr.cc: $(PROTOCOL_DIR)/nis_cache.x
173	$(RPCGEN) -C -c $(PROTOCOL_DIR)/nis_cache.x |\
174        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
175
176nis/cache/nis_cache_clnt.cc: $(PROTOCOL_DIR)/nis_cache.x
177	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis_cache.x |\
178	$(SED) -e '/#include <memory.h>/i\
179#include "mt.h"' |\
180        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
181
182nis/cache/nis_cache.h: $(PROTOCOL_DIR)/nis_cache.x
183	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis_cache.x |\
184        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
185
186# include library targets
187include ../Makefile.targ
188
189# EXPORT DELETE START
190# CRYPT DELETE START
191# Special target to clean up the source tree for export distribution
192# Warning: This target changes the source tree
193EXPORT_SRC:
194	$(RM) Makefile+ des/des_crypt.c+ des/des_soft.c+ key/xcrypt.c+
195	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
196		< des/des_crypt.c > des/des_crypt.c+
197	$(MV) des/des_crypt.c+ des/des_crypt.c
198	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
199		< des/des_soft.c > des/des_soft.c+
200	$(MV) des/des_soft.c+ des/des_soft.c
201	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
202		< key/xcrypt.c > key/xcrypt.c+
203	$(MV) key/xcrypt.c+ key/xcrypt.c
204	$(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
205		< Makefile > Makefile+
206	$(MV) Makefile+ Makefile
207	$(CHMOD) 444 Makefile des/des_crypt.c des/des_soft.c key/xcrypt.c
208
209CRYPT_SRC:
210	$(RM) Makefile+
211	$(SED) -e "/^# CRYPT DELETE START/,/^# CRYPT DELETE END/d"	\
212			< Makefile 				\
213	   | $(SED) -e "/EXPORT DELETE/d"				\
214			> Makefile+
215	$(MV) Makefile+ Makefile
216	$(CHMOD) 444 Makefile
217
218# CRYPT DELETE END
219# EXPORT DELETE END
220
221_msg: $(MSGDOMAIN) $(POFILE)
222	$(RM) $(MSGDOMAIN)/$(POFILE)
223	$(CP) $(POFILE) $(MSGDOMAIN)
224
225$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES)
226	$(RM) $@
227	$(CAT) $(POFILES) > $@
228
229_errlst.po:
230	$(RM) messages.po
231	$(XGETTEXT) -a nsl/_errlst.c
232	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
233	$(RM) messages.po
234
235generic.po:
236	$(RM) messages.po
237	$(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext */*.[ch] nis/*/*.[ch]*`
238	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
239	$(RM) messages.po
240
241$(MSGDOMAIN):
242	$(INS.dir)
243
244spec $(MACH) $(MACH64) $(SPEC) $(SPEC64):      FRC
245	@cd $@; pwd; $(MAKE) $(TARGET)
246
247FRC:
248