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