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