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