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