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