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