xref: /illumos-gate/usr/src/lib/libnsl/Makefile (revision 16ade92d9ce9c9ab33a25f7a2fdd00b581b6efda)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright 2005 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= $(ROOT)/usr/include/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
75TXTS +=		dial/uucp.h	dial/parms.h	dial/sysfiles.h
76
77SED=	sed
78CP=	cp
79GREP=	grep
80
81LIBRARY= libnsl.a
82TEXT_DOMAIN= SUNW_OST_NETRPC
83POFILE= $(LIBRARY:.a=.po)
84POFILES= generic.po _errlst.po
85
86all :=		TARGET= all
87clean :=	TARGET= clean
88clobber :=	TARGET= clobber
89delete :=	TARGET= delete
90install :=	TARGET= install
91lint :=		TARGET= lint
92_msg :=		TARGET= _msg
93package :=	TARGET= package
94
95
96.KEEP_STATE:
97
98all:		$(PROTOCOL_DIR) $(DERIVED_FILES) txts .WAIT $(SUBDIRS)
99
100headers:	$(PROTOCOL_DIR) .WAIT $(PROTOCOL_FILES) $(PROTOCOL_FILES_UTS) \
101		$(DERIVED_FILES)
102
103txts:		$(TXTS)
104
105install:	all $(SUBDIRS)
106
107clean clobber delete lint package:	$(SUBDIRS)
108
109$(PROTOCOL_DIR):
110	$(INS.dir)
111
112$(PROTOCOL_DIR)/%.h:	$(PROTOCOL_SRCDIR)/%.h
113	$(INS.file)
114
115$(PROTOCOL_DIR)/nis.h:	$(PROTOCOL_SRCDIR)/nis.x $(PROTOCOL_SRCDIR)/nis_object.x
116	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis.x > nis-tmp.h
117	$(SED) -e '/EDIT_START/,$$ d' < nis-tmp.h > nis.h
118	$(RM) $@
119	$(INS) -s -m $(FILEMODE) -f $(@D) nis.h
120	$(RM) nis.h nis-tmp.h
121
122$(PROTOCOL_DIR)/nis_callback.h:	$(PROTOCOL_SRCDIR)/nis_callback.x
123	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_callback.x -o nis_callback.h
124	$(RM) $@
125	$(INS) -s -m $(FILEMODE) -f $(@D) nis_callback.h
126	$(RM) nis_callback.h
127
128$(PROTOCOL_DIR)/nis_cache.h:	$(PROTOCOL_SRCDIR)/nis_cache.x
129	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_cache.x -o nis_cache.h
130	$(RM) $@
131	$(INS) -s -m $(FILEMODE) -f $(@D) nis_cache.h
132	$(RM) nis_cache.h
133
134$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_SRCDIR)/%.x
135	$(INS.file)
136
137$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_UTS_SRCDIR)/%.x
138	$(INS.file)
139
140#
141# Rules for building the derived files
142#
143# Derived header files
144#
145nis/gen/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
146	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-gen.h
147	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-gen.h |\
148	$(SED) -e 's/_3_svc/_svc/' |\
149	$(SED) -e 's/_3/_clnt/' > $@
150	$(RM) nis_clnt-gen.h
151
152nis/cache/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
153	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-cache.h
154	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-cache.h |\
155	$(SED) -e 's/_3_svc/_svc/' |\
156	$(SED) -e 's/_3/_clnt/' > $@
157	$(RM) nis_clnt-cache.h
158
159#
160# Derived source files
161#
162nis/gen/nis_clnt.c: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
163	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis.x > nis_clnt-tmp.c
164	$(SED) -e 's!\"$(PROTOCOL_DIR)/nis.h\"!\<rpcsvc/nis.h\>!' \
165	    < nis_clnt-tmp.c |\
166	$(SED) -e 's/_3/_clnt/' > $@
167	$(RM) nis_clnt-tmp.c
168
169nis/cache/nis_cache_xdr.cc: $(PROTOCOL_DIR)/nis_cache.x
170	$(RPCGEN) -C -c $(PROTOCOL_DIR)/nis_cache.x |\
171        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
172
173nis/cache/nis_cache_clnt.cc: $(PROTOCOL_DIR)/nis_cache.x
174	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis_cache.x |\
175        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
176
177nis/cache/nis_cache.h: $(PROTOCOL_DIR)/nis_cache.x
178	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis_cache.x |\
179        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
180
181# include library targets
182include ../Makefile.targ
183
184# EXPORT DELETE START
185# CRYPT DELETE START
186# Special target to clean up the source tree for export distribution
187# Warning: This target changes the source tree
188EXPORT_SRC:
189	$(RM) Makefile+ des/des_crypt.c+ des/des_soft.c+ key/xcrypt.c+
190	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
191		< des/des_crypt.c > des/des_crypt.c+
192	$(MV) des/des_crypt.c+ des/des_crypt.c
193	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
194		< des/des_soft.c > des/des_soft.c+
195	$(MV) des/des_soft.c+ des/des_soft.c
196	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
197		< key/xcrypt.c > key/xcrypt.c+
198	$(MV) key/xcrypt.c+ key/xcrypt.c
199	$(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
200		< Makefile > Makefile+
201	$(MV) Makefile+ Makefile
202	$(CHMOD) 444 Makefile des/des_crypt.c des/des_soft.c key/xcrypt.c
203
204CRYPT_SRC:
205	$(RM) Makefile+
206	$(SED) -e "/^# CRYPT DELETE START/,/^# CRYPT DELETE END/d"	\
207			< Makefile 				\
208	   | $(SED) -e "/EXPORT DELETE/d"				\
209			> Makefile+
210	$(MV) Makefile+ Makefile
211	$(CHMOD) 444 Makefile
212
213# CRYPT DELETE END
214# EXPORT DELETE END
215
216_msg: $(MSGDOMAIN) $(POFILE)
217	$(RM) $(MSGDOMAIN)/$(POFILE)
218	$(CP) $(POFILE) $(MSGDOMAIN)
219
220$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES)
221	$(RM) $@
222	$(CAT) $(POFILES) > $@
223
224_errlst.po:
225	$(RM) messages.po
226	$(XGETTEXT) -a nsl/_errlst.c
227	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
228	$(RM) messages.po
229
230generic.po:
231	$(RM) messages.po
232	$(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext */*.[ch] nis/*/*.[ch]*`
233	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
234	$(RM) messages.po
235
236$(MSGDOMAIN):
237	$(INS.dir)
238
239spec $(MACH) $(MACH64) $(SPEC) $(SPEC64):      FRC
240	@cd $@; pwd; $(MAKE) $(TARGET)
241
242FRC:
243