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