xref: /illumos-gate/usr/src/lib/libnsl/Makefile (revision f808c858)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
545916cd2Sjpk# Common Development and Distribution License (the "License").
645916cd2Sjpk# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
22e8031f0aSraf# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
267c478bd9Sstevel@tonic-gate#
27*f808c858Sraf
2845916cd2SjpkPROTOCOL_DIR= $(ROOTHDRDIR)/rpcsvc
297c478bd9Sstevel@tonic-gatePROTOCOL_SRCDIR= $(SRC)/head/rpcsvc
307c478bd9Sstevel@tonic-gatePROTOCOL_UTS_SRCDIR= $(SRC)/uts/common/rpc
317c478bd9Sstevel@tonic-gate
32*f808c858SrafSUBDIRS =	$(MACH)
33*f808c858Sraf$(BUILD64)SUBDIRS += $(MACH64)
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gate# objects are listed by source directory
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate# common utility code used in more than one directory
3861961e0fSrobinsonRPC_DERIVED_FILES=
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gateGEN_DERIVED_FILES= \
417c478bd9Sstevel@tonic-gate	nis/gen/nis_clnt.h      \
4261961e0fSrobinson	nis/gen/nis_clnt.c
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gateCACHE_DERIVED_FILES= \
457c478bd9Sstevel@tonic-gate	nis/cache/nis_clnt.h	\
467c478bd9Sstevel@tonic-gate	nis/cache/nis_cache.h	\
477c478bd9Sstevel@tonic-gate	nis/cache/nis_cache_clnt.cc \
487c478bd9Sstevel@tonic-gate	nis/cache/nis_cache_xdr.cc
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gatePROTOCOL_FILES= \
517c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/daemon_utils.h	\
527c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/nis.x		\
537c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/nis.h		\
547c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/nis_object.x	\
557c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/nis_callback.x	\
567c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/nis_callback.h	\
577c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/nis_cache.x	\
587c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/nis_cache.h
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gatePROTOCOL_FILES_UTS= \
617c478bd9Sstevel@tonic-gate	$(PROTOCOL_DIR)/key_prot.x
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gateDERIVED_FILES= $(GEN_DERIVED_FILES) $(CACHE_DERIVED_FILES) $(RPC_DERIVED_FILES)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate#
667c478bd9Sstevel@tonic-gate# Make sure they get cleaned when necessary
677c478bd9Sstevel@tonic-gate#
687c478bd9Sstevel@tonic-gateCLEANFILES += $(DERIVED_FILES)
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate# include library definitions
717c478bd9Sstevel@tonic-gateinclude ../Makefile.lib
727c478bd9Sstevel@tonic-gate
7345916cd2Sjpk# header file delivered to /usr/include; internal to ON build process
7445916cd2SjpkHDRS =		nss.h
7545916cd2SjpkHDRDIR =	nss
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateLIBRARY= libnsl.a
787c478bd9Sstevel@tonic-gateTEXT_DOMAIN= SUNW_OST_NETRPC
797c478bd9Sstevel@tonic-gatePOFILE= $(LIBRARY:.a=.po)
807c478bd9Sstevel@tonic-gatePOFILES= generic.po _errlst.po
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gateall :=		TARGET= all
837c478bd9Sstevel@tonic-gateclean :=	TARGET= clean
847c478bd9Sstevel@tonic-gateclobber :=	TARGET= clobber
857c478bd9Sstevel@tonic-gatedelete :=	TARGET= delete
867c478bd9Sstevel@tonic-gateinstall :=	TARGET= install
877c478bd9Sstevel@tonic-gatelint :=		TARGET= lint
887c478bd9Sstevel@tonic-gate_msg :=		TARGET= _msg
897c478bd9Sstevel@tonic-gatepackage :=	TARGET= package
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gate.KEEP_STATE:
937c478bd9Sstevel@tonic-gate
9433ec2264Sthall:		$(PROTOCOL_DIR) $(DERIVED_FILES) .WAIT $(SUBDIRS)
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gateheaders:	$(PROTOCOL_DIR) .WAIT $(PROTOCOL_FILES) $(PROTOCOL_FILES_UTS) \
977c478bd9Sstevel@tonic-gate		$(DERIVED_FILES)
987c478bd9Sstevel@tonic-gate
99*f808c858Srafinstall:	all .WAIT $(SUBDIRS)
1007c478bd9Sstevel@tonic-gate
10145916cd2Sjpkinstall_h:	$(ROOTHDRS)
10245916cd2Sjpk
10345916cd2Sjpk# nss.h isn't delivered; no reason to check
10445916cd2Sjpkcheck:
10545916cd2Sjpk
1067c478bd9Sstevel@tonic-gateclean clobber delete lint package:	$(SUBDIRS)
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate$(PROTOCOL_DIR):
1097c478bd9Sstevel@tonic-gate	$(INS.dir)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate$(PROTOCOL_DIR)/%.h:	$(PROTOCOL_SRCDIR)/%.h
1127c478bd9Sstevel@tonic-gate	$(INS.file)
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate$(PROTOCOL_DIR)/nis.h:	$(PROTOCOL_SRCDIR)/nis.x $(PROTOCOL_SRCDIR)/nis_object.x
1157c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis.x > nis-tmp.h
1167c478bd9Sstevel@tonic-gate	$(SED) -e '/EDIT_START/,$$ d' < nis-tmp.h > nis.h
1177c478bd9Sstevel@tonic-gate	$(RM) $@
1187c478bd9Sstevel@tonic-gate	$(INS) -s -m $(FILEMODE) -f $(@D) nis.h
1197c478bd9Sstevel@tonic-gate	$(RM) nis.h nis-tmp.h
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate$(PROTOCOL_DIR)/nis_callback.h:	$(PROTOCOL_SRCDIR)/nis_callback.x
1227c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_callback.x -o nis_callback.h
1237c478bd9Sstevel@tonic-gate	$(RM) $@
1247c478bd9Sstevel@tonic-gate	$(INS) -s -m $(FILEMODE) -f $(@D) nis_callback.h
1257c478bd9Sstevel@tonic-gate	$(RM) nis_callback.h
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate$(PROTOCOL_DIR)/nis_cache.h:	$(PROTOCOL_SRCDIR)/nis_cache.x
1287c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -h $(PROTOCOL_SRCDIR)/nis_cache.x -o nis_cache.h
1297c478bd9Sstevel@tonic-gate	$(RM) $@
1307c478bd9Sstevel@tonic-gate	$(INS) -s -m $(FILEMODE) -f $(@D) nis_cache.h
1317c478bd9Sstevel@tonic-gate	$(RM) nis_cache.h
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_SRCDIR)/%.x
1347c478bd9Sstevel@tonic-gate	$(INS.file)
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate$(PROTOCOL_DIR)/%.x:	$(PROTOCOL_UTS_SRCDIR)/%.x
1377c478bd9Sstevel@tonic-gate	$(INS.file)
1387c478bd9Sstevel@tonic-gate
1397c478bd9Sstevel@tonic-gate#
1407c478bd9Sstevel@tonic-gate# Rules for building the derived files
1417c478bd9Sstevel@tonic-gate#
1427c478bd9Sstevel@tonic-gate# Derived header files
1437c478bd9Sstevel@tonic-gate#
1447c478bd9Sstevel@tonic-gatenis/gen/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
1457c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-gen.h
1467c478bd9Sstevel@tonic-gate	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-gen.h |\
1477c478bd9Sstevel@tonic-gate	$(SED) -e 's/_3_svc/_svc/' |\
1487c478bd9Sstevel@tonic-gate	$(SED) -e 's/_3/_clnt/' > $@
1497c478bd9Sstevel@tonic-gate	$(RM) nis_clnt-gen.h
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gatenis/cache/nis_clnt.h: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
1527c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis.x > nis_clnt-cache.h
1537c478bd9Sstevel@tonic-gate	$(SED) -n -e '/EDIT_START/,$$ p' < nis_clnt-cache.h |\
1547c478bd9Sstevel@tonic-gate	$(SED) -e 's/_3_svc/_svc/' |\
1557c478bd9Sstevel@tonic-gate	$(SED) -e 's/_3/_clnt/' > $@
1567c478bd9Sstevel@tonic-gate	$(RM) nis_clnt-cache.h
1577c478bd9Sstevel@tonic-gate
1587c478bd9Sstevel@tonic-gate#
1597c478bd9Sstevel@tonic-gate# Derived source files
1607c478bd9Sstevel@tonic-gate#
1617c478bd9Sstevel@tonic-gatenis/gen/nis_clnt.c: $(PROTOCOL_DIR)/nis.x $(PROTOCOL_DIR)/nis_object.x
1627c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis.x > nis_clnt-tmp.c
1637c478bd9Sstevel@tonic-gate	$(SED) -e 's!\"$(PROTOCOL_DIR)/nis.h\"!\<rpcsvc/nis.h\>!' \
1647c478bd9Sstevel@tonic-gate	    < nis_clnt-tmp.c |\
165e8031f0aSraf	$(SED) -e '/#include <memory.h>/i\
166e8031f0aSraf#include "mt.h"' |\
1677c478bd9Sstevel@tonic-gate	$(SED) -e 's/_3/_clnt/' > $@
1687c478bd9Sstevel@tonic-gate	$(RM) nis_clnt-tmp.c
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gatenis/cache/nis_cache_xdr.cc: $(PROTOCOL_DIR)/nis_cache.x
1717c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -c $(PROTOCOL_DIR)/nis_cache.x |\
1727c478bd9Sstevel@tonic-gate        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
1737c478bd9Sstevel@tonic-gate
1747c478bd9Sstevel@tonic-gatenis/cache/nis_cache_clnt.cc: $(PROTOCOL_DIR)/nis_cache.x
1757c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -l $(PROTOCOL_DIR)/nis_cache.x |\
176e8031f0aSraf	$(SED) -e '/#include <memory.h>/i\
177e8031f0aSraf#include "mt.h"' |\
1787c478bd9Sstevel@tonic-gate        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gatenis/cache/nis_cache.h: $(PROTOCOL_DIR)/nis_cache.x
1817c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -h $(PROTOCOL_DIR)/nis_cache.x |\
1827c478bd9Sstevel@tonic-gate        $(SED) -e 's!\"$(PROTOCOL_DIR)/nis_cache.h\"!"nis_cache.h"!' > $@
1837c478bd9Sstevel@tonic-gate
1847c478bd9Sstevel@tonic-gate# include library targets
1857c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
1867c478bd9Sstevel@tonic-gate
1877c478bd9Sstevel@tonic-gate# EXPORT DELETE START
1887c478bd9Sstevel@tonic-gate# CRYPT DELETE START
1897c478bd9Sstevel@tonic-gate# Special target to clean up the source tree for export distribution
1907c478bd9Sstevel@tonic-gate# Warning: This target changes the source tree
1917c478bd9Sstevel@tonic-gateEXPORT_SRC:
1927c478bd9Sstevel@tonic-gate	$(RM) Makefile+ des/des_crypt.c+ des/des_soft.c+ key/xcrypt.c+
1937c478bd9Sstevel@tonic-gate	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
1947c478bd9Sstevel@tonic-gate		< des/des_crypt.c > des/des_crypt.c+
1957c478bd9Sstevel@tonic-gate	$(MV) des/des_crypt.c+ des/des_crypt.c
1967c478bd9Sstevel@tonic-gate	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
1977c478bd9Sstevel@tonic-gate		< des/des_soft.c > des/des_soft.c+
1987c478bd9Sstevel@tonic-gate	$(MV) des/des_soft.c+ des/des_soft.c
1997c478bd9Sstevel@tonic-gate	$(SED) -e "/EXPORT DELETE START/,/EXPORT DELETE END/d" \
2007c478bd9Sstevel@tonic-gate		< key/xcrypt.c > key/xcrypt.c+
2017c478bd9Sstevel@tonic-gate	$(MV) key/xcrypt.c+ key/xcrypt.c
2027c478bd9Sstevel@tonic-gate	$(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
2037c478bd9Sstevel@tonic-gate		< Makefile > Makefile+
2047c478bd9Sstevel@tonic-gate	$(MV) Makefile+ Makefile
2057c478bd9Sstevel@tonic-gate	$(CHMOD) 444 Makefile des/des_crypt.c des/des_soft.c key/xcrypt.c
2067c478bd9Sstevel@tonic-gate
2077c478bd9Sstevel@tonic-gateCRYPT_SRC:
2087c478bd9Sstevel@tonic-gate	$(RM) Makefile+
2097c478bd9Sstevel@tonic-gate	$(SED) -e "/^# CRYPT DELETE START/,/^# CRYPT DELETE END/d"	\
2107c478bd9Sstevel@tonic-gate			< Makefile 				\
2117c478bd9Sstevel@tonic-gate	   | $(SED) -e "/EXPORT DELETE/d"				\
2127c478bd9Sstevel@tonic-gate			> Makefile+
2137c478bd9Sstevel@tonic-gate	$(MV) Makefile+ Makefile
2147c478bd9Sstevel@tonic-gate	$(CHMOD) 444 Makefile
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate# CRYPT DELETE END
2177c478bd9Sstevel@tonic-gate# EXPORT DELETE END
2187c478bd9Sstevel@tonic-gate
2197c478bd9Sstevel@tonic-gate_msg: $(MSGDOMAIN) $(POFILE)
2207c478bd9Sstevel@tonic-gate	$(RM) $(MSGDOMAIN)/$(POFILE)
2217c478bd9Sstevel@tonic-gate	$(CP) $(POFILE) $(MSGDOMAIN)
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate$(POFILE): $(DERIVED_FILES) .WAIT $(POFILES)
2247c478bd9Sstevel@tonic-gate	$(RM) $@
2257c478bd9Sstevel@tonic-gate	$(CAT) $(POFILES) > $@
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate_errlst.po:
2287c478bd9Sstevel@tonic-gate	$(RM) messages.po
2297c478bd9Sstevel@tonic-gate	$(XGETTEXT) -a nsl/_errlst.c
2307c478bd9Sstevel@tonic-gate	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
2317c478bd9Sstevel@tonic-gate	$(RM) messages.po
2327c478bd9Sstevel@tonic-gate
2337c478bd9Sstevel@tonic-gategeneric.po:
2347c478bd9Sstevel@tonic-gate	$(RM) messages.po
2357c478bd9Sstevel@tonic-gate	$(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext */*.[ch] nis/*/*.[ch]*`
2367c478bd9Sstevel@tonic-gate	$(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
2377c478bd9Sstevel@tonic-gate	$(RM) messages.po
2387c478bd9Sstevel@tonic-gate
2397c478bd9Sstevel@tonic-gate$(MSGDOMAIN):
2407c478bd9Sstevel@tonic-gate	$(INS.dir)
2417c478bd9Sstevel@tonic-gate
242*f808c858Sraf$(SUBDIRS):	FRC
2437c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(TARGET)
2447c478bd9Sstevel@tonic-gate
2457c478bd9Sstevel@tonic-gateFRC:
246