xref: /illumos-gate/usr/src/lib/libnsl/Makefile (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#
26
27PROTOCOL_DIR= $(ROOTHDRDIR)/rpcsvc
28PROTOCOL_SRCDIR= $(SRC)/head/rpcsvc
29PROTOCOL_UTS_SRCDIR= $(SRC)/uts/common/rpc
30
31SUBDIRS =	$(MACH)
32$(BUILD64)SUBDIRS += $(MACH64)
33
34# objects are listed by source directory
35
36# common utility code used in more than one directory
37RPC_DERIVED_FILES=
38
39GEN_DERIVED_FILES= \
40	nis/gen/nis_clnt.h
41
42
43PROTOCOL_FILES= \
44	$(PROTOCOL_DIR)/daemon_utils.h	\
45	$(PROTOCOL_DIR)/nis.x		\
46	$(PROTOCOL_DIR)/nis.h		\
47	$(PROTOCOL_DIR)/nis_object.x
48
49PROTOCOL_FILES_UTS= \
50	$(PROTOCOL_DIR)/key_prot.x
51
52DERIVED_FILES= $(GEN_DERIVED_FILES) $(RPC_DERIVED_FILES)
53
54#
55# Make sure they get cleaned when necessary
56#
57CLEANFILES += $(DERIVED_FILES)
58
59# include library definitions
60include ../Makefile.lib
61
62# header file delivered to /usr/include; internal to ON build process
63HDRS =		nss.h
64HDRDIR =	nss
65
66LIBRARY= libnsl.a
67TEXT_DOMAIN= SUNW_OST_NETRPC
68POFILE= $(LIBRARY:.a=.po)
69POFILES= generic.po _errlst.po
70
71all :=		TARGET= all
72clean :=	TARGET= clean
73clobber :=	TARGET= clobber
74delete :=	TARGET= delete
75install :=	TARGET= install
76_msg :=		TARGET= _msg
77package :=	TARGET= package
78
79
80.KEEP_STATE:
81
82all:		$(PROTOCOL_DIR) $(DERIVED_FILES) .WAIT $(SUBDIRS)
83
84headers:	$(PROTOCOL_DIR) .WAIT $(PROTOCOL_FILES) $(PROTOCOL_FILES_UTS) \
85		$(DERIVED_FILES)
86
87install:	all .WAIT $(SUBDIRS)
88
89install_h:	$(ROOTHDRS)
90
91# nss.h isn't delivered; no reason to check
92check:
93
94clean clobber delete package:	$(SUBDIRS)
95
96$(PROTOCOL_DIR):
97	$(INS.dir)
98
99$(PROTOCOL_DIR)/%.h:	$(PROTOCOL_SRCDIR)/%.h
100	$(INS.file)
101
102$(PROTOCOL_DIR)/nis.h:	$(PROTOCOL_SRCDIR)/nis.x $(PROTOCOL_SRCDIR)/nis_object.x
103	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis.x > nis-tmp.h
104	$(SED) -e '/EDIT_START/,$$ d' < nis-tmp.h > nis.h
105	$(RM) $@
106	$(INS) -s -m $(FILEMODE) -f $(@D) nis.h
107	$(RM) nis.h nis-tmp.h
108
109$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_SRCDIR)/%.x
110	$(INS.file)
111
112$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_UTS_SRCDIR)/%.x
113	$(INS.file)
114
115#
116# Rules for building the derived files
117#
118# Derived header files
119#
120nis/gen/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
121	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-gen.h
122	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-gen.h |\
123	$(SED) -e 's/_3_svc/_svc/' |\
124	$(SED) -e 's/_3/_clnt/' > $@
125	$(RM) nis_clnt-gen.h
126
127#
128# Derived source files
129#
130
131# include library targets
132include ../Makefile.targ
133
134_msg: $(MSGDOMAIN) $(POFILE)
135	$(RM) $(MSGDOMAIN)/$(POFILE)
136	$(CP) $(POFILE) $(MSGDOMAIN)
137
138$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES)
139	$(RM) $@
140	$(CAT) $(POFILES) > $@
141
142_errlst.po:
143	$(RM) messages.po
144	$(XGETTEXT) -a nsl/_errlst.c
145	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
146	$(RM) messages.po
147
148generic.po:
149	$(RM) messages.po
150	$(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext */*.[ch] nis/*/*.[ch]*`
151	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
152	$(RM) messages.po
153
154$(MSGDOMAIN):
155	$(INS.dir)
156
157$(SUBDIRS):	FRC
158	@cd $@; pwd; $(MAKE) $(TARGET)
159
160FRC:
161