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# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright 2014-2021 Tintri by DDN, Inc. All rights reserved.
26#
27# Copyright (c) 2018, Joyent, Inc.
28#
29# Copyright 2020 RackTop Systems, Inc.
30
31LIBRARY =	libfksmbsrv.a
32VERS =		.1
33
34OBJS_LOCAL = \
35		fksmb_cred.o \
36		fksmb_encrypt_pkcs.o \
37		fksmb_fem.o \
38		fksmb_idmap.o \
39		fksmb_init.o \
40		fksmb_kdoor.o \
41		fksmb_preauth_pkcs.o \
42		fksmb_sign_pkcs.o \
43		fake_ksocket.o \
44		fake_lookup.o \
45		fake_nblk.o \
46		fake_stream.o \
47		fake_vfs.o \
48		fake_vnode.o \
49		fake_vop.o \
50		fake_xattr.o \
51		reparse.o \
52		vncache.o
53
54# See also: $SRC/uts/common/Makefile.files
55# NB: Intentionally ommitted, compared w/ the above:
56#   smb_cred, smb_fem, smb_idmap, smb_init, smb_kdoor
57#
58OBJS_FS_SMBSRV = \
59		smb_acl.o				\
60		smb_alloc.o				\
61		smb_authenticate.o			\
62		smb_close.o				\
63		smb_cmn_oplock.o			\
64		smb_cmn_rename.o			\
65		smb_cmn_setfile.o			\
66		smb_common_open.o			\
67		smb_common_transact.o			\
68		smb_create.o				\
69		smb_delete.o				\
70		smb_dfs.o				\
71		smb_directory.o				\
72		smb_dispatch.o				\
73		smb_echo.o				\
74		smb_errno.o				\
75		smb_find.o				\
76		smb_flush.o				\
77		smb_fsinfo.o				\
78		smb_fsops.o				\
79		smb_kshare.o				\
80		smb_kutil.o				\
81		smb_lock.o				\
82		smb_lock_byte_range.o			\
83		smb_locking_andx.o			\
84		smb_logoff_andx.o			\
85		smb_mangle_name.o			\
86		smb_mbuf_marshaling.o			\
87		smb_mbuf_util.o				\
88		smb_negotiate.o				\
89		smb_net.o				\
90		smb_node.o				\
91		smb_notify.o				\
92		smb_nt_cancel.o				\
93		smb_nt_create_andx.o			\
94		smb_nt_transact_create.o		\
95		smb_nt_transact_ioctl.o			\
96		smb_nt_transact_notify_change.o		\
97		smb_nt_transact_quota.o			\
98		smb_nt_transact_security.o		\
99		smb_odir.o				\
100		smb_ofile.o				\
101		smb_open_andx.o				\
102		smb_opipe.o				\
103		smb_oplock.o				\
104		smb_pathname.o				\
105		smb_print.o				\
106		smb_process_exit.o			\
107		smb_query_fileinfo.o			\
108		smb_quota.o				\
109		smb_read.o				\
110		smb_rename.o				\
111		smb_sd.o				\
112		smb_seek.o				\
113		smb_server.o				\
114		smb_session.o				\
115		smb_session_setup_andx.o		\
116		smb_set_fileinfo.o			\
117		smb_signing.o				\
118		smb_srv_oplock.o			\
119		smb_thread.o				\
120		smb_tree.o				\
121		smb_trans2_create_directory.o		\
122		smb_trans2_dfs.o			\
123		smb_trans2_find.o			\
124		smb_tree_connect.o			\
125		smb_unlock_byte_range.o			\
126		smb_user.o				\
127		smb_vops.o				\
128		smb_vss.o				\
129		smb_write.o				\
130		\
131		smb2_aapl.o \
132		smb2_dispatch.o \
133		smb2_durable.o \
134		smb2_cancel.o \
135		smb2_change_notify.o \
136		smb2_close.o \
137		smb2_create.o \
138		smb2_echo.o \
139		smb2_flush.o \
140		smb2_fsctl_copychunk.o \
141		smb2_fsctl_fs.o \
142		smb2_fsctl_odx.o \
143		smb2_fsctl_sparse.o \
144		smb2_ioctl.o \
145		smb2_lease.o \
146		smb2_lock.o \
147		smb2_logoff.o \
148		smb2_negotiate.o \
149		smb2_ofile.o \
150		smb2_oplock.o \
151		smb2_qinfo_file.o \
152		smb2_qinfo_fs.o \
153		smb2_qinfo_sec.o \
154		smb2_qinfo_quota.o \
155		smb2_query_dir.o \
156		smb2_query_info.o \
157		smb2_read.o \
158		smb2_session_setup.o \
159		smb2_set_info.o \
160		smb2_setinfo_file.o \
161		smb2_setinfo_fs.o \
162		smb2_setinfo_quota.o \
163		smb2_setinfo_sec.o \
164		smb2_signing.o \
165		smb2_tree_connect.o \
166		smb2_tree_disconn.o \
167		smb2_write.o \
168	        \
169	        smb3_kdf.o \
170	        smb3_encrypt.o
171
172# Can't just link with -lsmb because of user vs kernel API
173# i.e. can't call free with mem from kmem_alloc, which is
174# what happens if we just link with -lsmb
175OBJS_CMN_SMBSRV = \
176		smb_cfg_util.o \
177		smb_inet.o \
178		smb_match.o \
179		smb_msgbuf.o \
180		smb_native.o \
181		smb_netbios_util.o \
182		smb_oem.o \
183		smb_sid.o \
184		smb_string.o \
185		smb_token.o \
186		smb_token_xdr.o \
187		smb_utf8.o \
188		smb_xdr.o
189
190OBJS_MISC = \
191		acl_common.o \
192		pathname.o \
193		refstr.o \
194		smb_status2winerr.o \
195		xattr_common.o
196
197# This one can't be in OBJECTS, as it has to depend on
198# all of those for the COMPILE.d rule (which processes
199# all those objects collecting probe instances).
200DTRACE_OBJS = fksmb_dt.o
201
202OBJECTS = \
203	$(OBJS_LOCAL) \
204	$(OBJS_FS_SMBSRV) \
205	$(OBJS_CMN_SMBSRV) \
206	$(OBJS_MISC)
207
208include ../../../Makefile.lib
209include ../../Makefile.lib
210
211# Force SOURCEDEBUG
212CSOURCEDEBUGFLAGS	= $(CCGDEBUG)
213CCSOURCEDEBUGFLAGS	= $(CCGDEBUG)
214STRIP_STABS	= :
215
216
217# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc.
218# Also, like Makefile.uts, reset CPPFLAGS
219CPPFLAGS.first += -I../../../libfakekernel/common
220CPPFLAGS.first += -I../common
221CPPFLAGS	= $(CPPFLAGS.first)
222
223INCS += -I$(SRC)/uts/common
224INCS += -I$(SRC)/common/smbsrv
225INCS += -I$(SRC)/common
226
227LDLIBS +=	$(MACH_LDLIBS)
228LDLIBS +=	-lfakekernel -lidmap -lcmdutils
229LDLIBS +=	-lavl -lnvpair -lnsl -lpkcs11 -lreparse -lc
230
231CPPFLAGS += $(INCS) -D_REENTRANT -D_FAKE_KERNEL
232CPPFLAGS += -D_FILE_OFFSET_BITS=64
233# Always want DEBUG here
234CPPFLAGS += -DDEBUG
235
236CERRWARN += -_gcc=-Wno-switch
237
238# not linted
239SMATCH=off
240
241SRCS=   $(OBJS_LOCAL:%.o=$(SRCDIR)/%.c) \
242	$(OBJS_FS_SMBSRV:%.o=$(SRC)/uts/common/fs/smbsrv/%.c) \
243	$(OBJS_CMN_SMBSRV:%.o=$(SRC)/common/smbsrv/%.c)
244
245all:
246
247pics/%.o:	$(SRC)/uts/common/fs/smbsrv/%.c
248	$(COMPILE.c) -o $@ $<
249	$(POST_PROCESS_O)
250
251pics/acl_common.o:	   $(SRC)/common/acl/acl_common.c
252	$(COMPILE.c) -o $@ $(SRC)/common/acl/acl_common.c
253	$(POST_PROCESS_O)
254
255pics/pathname.o:	   $(SRC)/uts/common/fs/pathname.c
256	$(COMPILE.c) -o $@ $(SRC)/uts/common/fs/pathname.c
257	$(POST_PROCESS_O)
258
259pics/refstr.o:		   $(SRC)/uts/common/os/refstr.c
260	$(COMPILE.c) -o $@ $(SRC)/uts/common/os/refstr.c
261	$(POST_PROCESS_O)
262
263pics/smb_status2winerr.o:  $(SRC)/common/smbclnt/smb_status2winerr.c
264	$(COMPILE.c) -o $@ $(SRC)/common/smbclnt/smb_status2winerr.c
265	$(POST_PROCESS_O)
266
267pics/xattr_common.o:	   $(SRC)/common/xattr/xattr_common.c
268	$(COMPILE.c) -o $@ $(SRC)/common/xattr/xattr_common.c
269	$(POST_PROCESS_O)
270
271# Makefile.targ has rule for $(SRC)/common/smbsrv/%.c
272
273.KEEP_STATE:
274
275include ../../Makefile.targ
276include ../../../Makefile.targ
277
278EXTPICS= $(DTRACE_OBJS:%=pics/%)
279CLEANFILES += $(EXTPICS)
280
281$(OBJS) $(PICS) : ../common/fksmb_dt.h
282
283pics/fksmb_dt.o: ../common/fksmb_dt.d $(PICS)
284	$(COMPILE.d) -C -s ../common/fksmb_dt.d -o $@ $(PICS)
285	$(POST_PROCESS_O)
286