xref: /illumos-gate/usr/src/cmd/fs.d/autofs/Makefile (revision f63f7506be0210195779706f51c58646e568cc40)
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 2006 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 -lcmd
89$(MOUNT):=	LDLIBS += -lnsl
90$(TYPEPROG) :=	LDLIBS += -lrpcsvc -lsocket -lnsl -lsldap -lcmd \
91		-lkstat
92$(TYPEPROG) :=	LDFLAGS += -R/usr/lib/fs/$(FSTYPE)
93
94CFLAGS +=	$(CCVERBOSE) -D_FILE_OFFSET_BITS=64
95CPPFLAGS=	-I. -I.. -I../nfs/lib $(CPPFLAGS.master) -D_REENTRANT \
96			$(MALLOC_DEBUG)
97OBJS=		$(AUTOOBJS) $(MOUNTOBJS) $(TYPEOBJS) \
98		$(SHAREOBJS) $(UNSHAREOBJS)
99
100AUTOSRCS=	automount.c $(COMMON:%.o=%.c) $(FSLIBSRC)
101MOUNTSRCS=	mount.c $(FSLIBSRC)
102TYPESRCS=	$(LOCAL:%.o=%.c) $(COMMON:%.o=%.c) \
103		../nfs/lib/replica.c ../nfs/lib/nfs_sec.c \
104		../nfs/lib/nfs_subr.c $(FSLIBSRC) ../nfs/lib/selfcheck.c
105SHARESRCS=	$(SHARE:%=%.c)
106UNSHARESRCS=	$(UNSHARE:%=%.c)
107DFSHARESSRCS=	$(DFSHARES:%=%.sh)
108SRCS=		$(OBJS:%.o=%.c)
109
110nfs_sec.o :=	CPPFLAGS += -DWNFS_SEC_NEGO
111
112$(AUTO):	$(AUTOOBJS)
113		$(LINK.c) -o $@ $(AUTOOBJS) $(LDLIBS)
114		$(POST_PROCESS)
115
116$(MOUNT):	$(MOUNTOBJS)
117		$(LINK.c) -o $@ $(MOUNTOBJS) $(LDLIBS)
118		$(POST_PROCESS)
119
120$(TYPEPROG):	webnfs.h $(TYPEOBJS)
121		$(LINK.c) -o $@ $(TYPEOBJS) $(LDLIBS)
122		$(POST_PROCESS)
123
124$(SHARE):	$(SHAREOBJS)
125		$(LINK.c) -o $@ $(SHAREOBJS)
126		$(POST_PROCESS)
127
128$(UNSHARE):	$(UNSHAREOBJS)
129		$(LINK.c) -o $@ $(UNSHAREOBJS)
130		$(POST_PROCESS)
131
132$(ROOTSVCSYSTEM)/filesystem/%: %
133		$(INS.file)
134
135DUMP_PROG=malloc_dump
136BUILDDIR=tmp
137DUMP_PROTO=$(BUILDDIR)/$(DUMP_PROG)_client
138XFILE=$(BUILDDIR)/malloc_dump.x
139XLINE= "program DUMP { version VERS \
140	{ void DUMP_IT(void) = 1000000; } = 2; } = 100099;"
141
142$(XFILE):	$(BUILDDIR)
143		$(RM) $(XFILE)
144		echo $(XLINE) > $(XFILE)
145
146$(BUILDDIR):
147		$(RM) -r $(BUILDDIR)
148		mkdir $(BUILDDIR)
149
150$(DUMP_PROTO):	$(BUILDDIR) $(XFILE)
151		cd $(BUILDDIR); $(RM) *.[ch] makefile.malloc_dump ; rpcgen -a `basename $(XFILE)
152		cd $(BUILDDIR); $(MAKE) -f makefile.malloc_dump `basename $@`
153
154$(DUMP_PROG):	$(DUMP_PROTO)
155		$(RM) $@
156		cp $(DUMP_PROTO) $@
157
158clean_dump:
159		$(RM) -r $(BUILDDIR)
160		$(RM) $(DUMP_PROG)
161$(ROOTUSRSBIN)/$(AUTO):
162		$(RM) $@; $(SYMLINK) $(LINKVALUE) $@
163
164replica.o:	../nfs/lib/replica.c
165		$(COMPILE.c) ../nfs/lib/replica.c
166
167nfs_sec.o:	../nfs/lib/nfs_sec.c
168		$(COMPILE.c) ../nfs/lib/nfs_sec.c
169
170nfs_subr.o:	../nfs/lib/nfs_subr.c
171		$(COMPILE.c) ../nfs/lib/nfs_subr.c
172
173selfcheck.o:	../nfs/lib/selfcheck.c
174		$(COMPILE.c) ../nfs/lib/selfcheck.c
175
176
177webnfs_xdr.c:	webnfs.x
178	$(RPCGEN) -C -c -o $@ webnfs.x
179
180webnfs_client.c:	webnfs.x
181	$(RPCGEN) -C -l -o $@ webnfs.x
182
183webnfs.h:	webnfs.x
184	$(RPCGEN) -C -h -o $@ webnfs.x
185
186webnfs.x:	../nfs/lib/webnfs.x
187	$(RM) webnfs.x
188	cp ../nfs/lib/webnfs.x .
189
190catalog: $(POFILE)
191
192$(POFILE):
193	$(RM) messages.po
194	$(SED) -e 's/pr_msg/gettext/' `$(GREP) -l "pr_msg|gettext" *.[ch]` | \
195	$(XGETTEXT) $(XGETFLAGS) -
196	$(SED) -e '/^# msg/d' -e '/^domain/d' < messages.po > $@
197	$(RM) messages.po
198
199lint:
200	$(LINT.c) $(AUTOSRCS)
201	$(LINT.c) $(MOUNTSRCS)
202	$(LINT.c) $(TYPESRCS)
203
204clean:	clean_dump
205	$(RM) $(OBJS) webnfs_xdr.c webnfs_client.c webnfs.h webnfs.x
206
207check:	$(CHKMANIFEST)
208