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