xref: /illumos-gate/usr/src/cmd/fs.d/autofs/Makefile (revision 613b28719c10e84c1202c1045df44d77767de21d)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# cmd/fs.d/autofs/Makefile
28
29FSTYPE=		autofs
30AUTO=		automount
31MOUNT=		mount
32VERS=		.2
33DFSHARES=	dfshares
34SHARE=		share
35UNSHARE=	unshare
36LIBPROG=	$(AUTO) $(MOUNT) $(DFSHARES) $(SHARE) $(UNSHARE)
37TYPEPROG=	automountd
38
39LINKINSTALL=	$(ROOTUSRSBIN)/$(AUTO)
40LINKVALUE=	../lib/fs/$(FSTYPE)/$(AUTO)
41MAPS=		auto_master auto_home
42MAPINSTALL=	$(MAPS:%=$(ROOTETC)/%)
43AUTOFS=		autofs
44DEFAULTFILES=	autofs.dfl
45SMFMANIFEST=	autofs.xml
46SMFMETHOD=	svc-autofs
47MFSTINSTALL=	$(SMFMANIFEST:%=$(ROOTSVCSYSTEM)/filesystem/%)
48METHODINSTALL=	$(SMFMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
49
50OTHERINSTALL=	$(MAPINSTALL) $(LINKINSTALL) $(ROOTETCDEFAULTFILES) \
51		$(MFSTINSTALL) $(METHODINSTALL)
52
53UNCHECKED_HDRS=	webnfs.h
54
55MANIFEST=	autofs.xml
56SVCMETHOD=	svc-autofs
57
58include		../Makefile.fstype
59
60$(MAPINSTALL)	:= OWNER= root
61$(MAPINSTALL)	:= FILEMODE= 0644
62
63$(MFSTINSTALL)	:= FILEMODE = 0444
64
65REAL_COMMON=	debug_alloc.o
66COMMON=		ns_generic.o ns_files.o ns_nisplus.o ns_nis.o \
67		ns_ldap.o auto_mnttab.o auto_subr.o $(REAL_COMMON)
68
69AUTOOBJS=	automount.o $(COMMON) $(FSLIB)
70
71MOUNTOBJS=	mount.o $(FSLIB) $(REAL_COMMON)
72
73LOCAL=		autod_main.o \
74		autod_parse.o autod_mount.o autod_nfs.o nfs_cast.o \
75		autod_autofs.o autod_xdr.o autod_readdir.o autod_lookup.o
76
77TYPEOBJS=	$(LOCAL) $(COMMON) replica.o nfs_sec.o nfs_subr.o $(FSLIB) \
78		webnfs_xdr.o webnfs_client.o selfcheck.o
79
80SHAREOBJS=	$(SHARESRCS:%.c=%.o)
81
82UNSHAREOBJS=	$(UNSHARESRCS:%.c=%.o)
83
84POFILE= autofs.po
85GREP= egrep
86SED= sed
87
88$(AUTO) := 	LDLIBS += -lnsl -lsldap  -ldoor
89$(MOUNT):=	LDLIBS += -lnsl
90$(TYPEPROG) :=	LDLIBS += -lrpcsvc -lsocket -lnsl -lsldap -lkstat -ldoor
91
92CFLAGS +=	$(CCVERBOSE) -D_FILE_OFFSET_BITS=64
93CPPFLAGS=	-I. -I.. -I../nfs/lib $(CPPFLAGS.master) -D_REENTRANT \
94			$(MALLOC_DEBUG)
95OBJS=		$(AUTOOBJS) $(MOUNTOBJS) $(TYPEOBJS) \
96		$(SHAREOBJS) $(UNSHAREOBJS)
97
98AUTOSRCS=	automount.c $(COMMON:%.o=%.c) $(FSLIBSRC)
99MOUNTSRCS=	mount.c $(FSLIBSRC)
100TYPESRCS=	$(LOCAL:%.o=%.c) $(COMMON:%.o=%.c) \
101		../nfs/lib/replica.c ../nfs/lib/nfs_sec.c \
102		../nfs/lib/nfs_subr.c $(FSLIBSRC) ../nfs/lib/selfcheck.c
103SHARESRCS=	$(SHARE:%=%.c)
104UNSHARESRCS=	$(UNSHARE:%=%.c)
105DFSHARESSRCS=	$(DFSHARES:%=%.sh)
106SRCS=		$(OBJS:%.o=%.c)
107
108nfs_sec.o :=	CPPFLAGS += -DWNFS_SEC_NEGO
109
110$(AUTO):	$(AUTOOBJS)
111		$(LINK.c) -o $@ $(AUTOOBJS) $(LDLIBS)
112		$(POST_PROCESS)
113
114$(MOUNT):	$(MOUNTOBJS)
115		$(LINK.c) -o $@ $(MOUNTOBJS) $(LDLIBS)
116		$(POST_PROCESS)
117
118$(TYPEPROG):	webnfs.h $(TYPEOBJS)
119		$(LINK.c) -o $@ $(TYPEOBJS) $(LDLIBS)
120		$(POST_PROCESS)
121
122$(SHARE):	$(SHAREOBJS)
123		$(LINK.c) -o $@ $(SHAREOBJS)
124		$(POST_PROCESS)
125
126$(UNSHARE):	$(UNSHAREOBJS)
127		$(LINK.c) -o $@ $(UNSHAREOBJS)
128		$(POST_PROCESS)
129
130$(ROOTSVCSYSTEM)/filesystem/%: %
131		$(INS.file)
132
133DUMP_PROG=malloc_dump
134BUILDDIR=tmp
135DUMP_PROTO=$(BUILDDIR)/$(DUMP_PROG)_client
136XFILE=$(BUILDDIR)/malloc_dump.x
137XLINE= "program DUMP { version VERS \
138	{ void DUMP_IT(void) = 1000000; } = 2; } = 100099;"
139
140$(XFILE):	$(BUILDDIR)
141		$(RM) $(XFILE)
142		echo $(XLINE) > $(XFILE)
143
144$(BUILDDIR):
145		$(RM) -r $(BUILDDIR)
146		mkdir $(BUILDDIR)
147
148$(DUMP_PROTO):	$(BUILDDIR) $(XFILE)
149		cd $(BUILDDIR); $(RM) *.[ch] makefile.malloc_dump ; rpcgen -a `basename $(XFILE)
150		cd $(BUILDDIR); $(MAKE) -f makefile.malloc_dump `basename $@`
151
152$(DUMP_PROG):	$(DUMP_PROTO)
153		$(RM) $@
154		cp $(DUMP_PROTO) $@
155
156clean_dump:
157		$(RM) -r $(BUILDDIR)
158		$(RM) $(DUMP_PROG)
159$(ROOTUSRSBIN)/$(AUTO):
160		$(RM) $@; $(SYMLINK) $(LINKVALUE) $@
161
162replica.o:	../nfs/lib/replica.c
163		$(COMPILE.c) ../nfs/lib/replica.c
164
165nfs_sec.o:	../nfs/lib/nfs_sec.c
166		$(COMPILE.c) ../nfs/lib/nfs_sec.c
167
168nfs_subr.o:	../nfs/lib/nfs_subr.c
169		$(COMPILE.c) ../nfs/lib/nfs_subr.c
170
171selfcheck.o:	../nfs/lib/selfcheck.c
172		$(COMPILE.c) ../nfs/lib/selfcheck.c
173
174
175webnfs_xdr.c:	webnfs.x
176	$(RPCGEN) -C -c -o $@ webnfs.x
177
178webnfs_client.c:	webnfs.x
179	$(RPCGEN) -C -l -o $@ webnfs.x
180
181webnfs.h:	webnfs.x
182	$(RPCGEN) -C -h -o $@ webnfs.x
183
184webnfs.x:	../nfs/lib/webnfs.x
185	$(RM) webnfs.x
186	cp ../nfs/lib/webnfs.x .
187
188catalog: $(POFILE)
189
190$(POFILE):
191	$(RM) messages.po
192	$(SED) -e 's/pr_msg/gettext/' `$(GREP) -l "pr_msg|gettext" *.[ch]` | \
193	$(XGETTEXT) $(XGETFLAGS) -
194	$(SED) -e '/^# msg/d' -e '/^domain/d' < messages.po > $@
195	$(RM) messages.po
196
197lint:
198	$(LINT.c) $(AUTOSRCS)
199	$(LINT.c) $(MOUNTSRCS)
200	$(LINT.c) $(TYPESRCS)
201
202clean:	clean_dump
203	$(RM) $(OBJS) webnfs_xdr.c webnfs_client.c webnfs.h webnfs.x
204
205check:	$(CHKMANIFEST)
206