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