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