xref: /titanic_51/usr/src/lib/libnsl/Makefile (revision e37d48e735b8e55f327dfa35a2d0006049ea5e58)
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
75SED=	sed
76CP=	cp
77GREP=	grep
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
103clean clobber delete lint package:	$(SUBDIRS)
104
105$(PROTOCOL_DIR):
106	$(INS.dir)
107
108$(PROTOCOL_DIR)/%.h:	$(PROTOCOL_SRCDIR)/%.h
109	$(INS.file)
110
111$(PROTOCOL_DIR)/nis.h:	$(PROTOCOL_SRCDIR)/nis.x $(PROTOCOL_SRCDIR)/nis_object.x
112	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis.x > nis-tmp.h
113	$(SED) -e '/EDIT_START/,$$ d' < nis-tmp.h > nis.h
114	$(RM) $@
115	$(INS) -s -m $(FILEMODE) -f $(@D) nis.h
116	$(RM) nis.h nis-tmp.h
117
118$(PROTOCOL_DIR)/nis_callback.h:	$(PROTOCOL_SRCDIR)/nis_callback.x
119	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_callback.x -o nis_callback.h
120	$(RM) $@
121	$(INS) -s -m $(FILEMODE) -f $(@D) nis_callback.h
122	$(RM) nis_callback.h
123
124$(PROTOCOL_DIR)/nis_cache.h:	$(PROTOCOL_SRCDIR)/nis_cache.x
125	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_cache.x -o nis_cache.h
126	$(RM) $@
127	$(INS) -s -m $(FILEMODE) -f $(@D) nis_cache.h
128	$(RM) nis_cache.h
129
130$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_SRCDIR)/%.x
131	$(INS.file)
132
133$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_UTS_SRCDIR)/%.x
134	$(INS.file)
135
136#
137# Rules for building the derived files
138#
139# Derived header files
140#
141nis/gen/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
142	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-gen.h
143	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-gen.h |\
144	$(SED) -e 's/_3_svc/_svc/' |\
145	$(SED) -e 's/_3/_clnt/' > $@
146	$(RM) nis_clnt-gen.h
147
148nis/cache/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
149	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-cache.h
150	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-cache.h |\
151	$(SED) -e 's/_3_svc/_svc/' |\
152	$(SED) -e 's/_3/_clnt/' > $@
153	$(RM) nis_clnt-cache.h
154
155#
156# Derived source files
157#
158nis/gen/nis_clnt.c: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
159	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis.x > nis_clnt-tmp.c
160	$(SED) -e 's!\"$(PROTOCOL_DIR)/nis.h\"!\<rpcsvc/nis.h\>!' \
161	    < nis_clnt-tmp.c |\
162	$(SED) -e 's/_3/_clnt/' > $@
163	$(RM) nis_clnt-tmp.c
164
165nis/cache/nis_cache_xdr.cc: $(PROTOCOL_DIR)/nis_cache.x
166	$(RPCGEN) -C -c $(PROTOCOL_DIR)/nis_cache.x |\
167        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
168
169nis/cache/nis_cache_clnt.cc: $(PROTOCOL_DIR)/nis_cache.x
170	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis_cache.x |\
171        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
172
173nis/cache/nis_cache.h: $(PROTOCOL_DIR)/nis_cache.x
174	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis_cache.x |\
175        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
176
177# include library targets
178include ../Makefile.targ
179
180# EXPORT DELETE START
181# CRYPT DELETE START
182# Special target to clean up the source tree for export distribution
183# Warning: This target changes the source tree
184EXPORT_SRC:
185	$(RM) Makefile+ des/des_crypt.c+ des/des_soft.c+ key/xcrypt.c+
186	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
187		< des/des_crypt.c > des/des_crypt.c+
188	$(MV) des/des_crypt.c+ des/des_crypt.c
189	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
190		< des/des_soft.c > des/des_soft.c+
191	$(MV) des/des_soft.c+ des/des_soft.c
192	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
193		< key/xcrypt.c > key/xcrypt.c+
194	$(MV) key/xcrypt.c+ key/xcrypt.c
195	$(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
196		< Makefile > Makefile+
197	$(MV) Makefile+ Makefile
198	$(CHMOD) 444 Makefile des/des_crypt.c des/des_soft.c key/xcrypt.c
199
200CRYPT_SRC:
201	$(RM) Makefile+
202	$(SED) -e "/^# CRYPT DELETE START/,/^# CRYPT DELETE END/d"	\
203			< Makefile 				\
204	   | $(SED) -e "/EXPORT DELETE/d"				\
205			> Makefile+
206	$(MV) Makefile+ Makefile
207	$(CHMOD) 444 Makefile
208
209# CRYPT DELETE END
210# EXPORT DELETE END
211
212_msg: $(MSGDOMAIN) $(POFILE)
213	$(RM) $(MSGDOMAIN)/$(POFILE)
214	$(CP) $(POFILE) $(MSGDOMAIN)
215
216$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES)
217	$(RM) $@
218	$(CAT) $(POFILES) > $@
219
220_errlst.po:
221	$(RM) messages.po
222	$(XGETTEXT) -a nsl/_errlst.c
223	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
224	$(RM) messages.po
225
226generic.po:
227	$(RM) messages.po
228	$(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext */*.[ch] nis/*/*.[ch]*`
229	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
230	$(RM) messages.po
231
232$(MSGDOMAIN):
233	$(INS.dir)
234
235spec $(MACH) $(MACH64) $(SPEC) $(SPEC64):      FRC
236	@cd $@; pwd; $(MAKE) $(TARGET)
237
238FRC:
239