xref: /illumos-gate/usr/src/lib/smbsrv/libfksmbsrv/Makefile.com (revision aaceae985c2e78cadef76bf0b7b50ed887ccb3a6)
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# Copyright (c) 2018, Joyent, Inc.
27# Copyright 2020-2024 RackTop Systems, Inc.
28#
29
30LIBRARY =	libfksmbsrv.a
31VERS =		.1
32
33OBJS_LOCAL = \
34		fksmb_cred.o \
35		fksmb_encrypt_pkcs.o \
36		fksmb_fem.o \
37		fksmb_idmap.o \
38		fksmb_init.o \
39		fksmb_kdoor.o \
40		fksmb_preauth_pkcs.o \
41		fksmb_sign_pkcs.o \
42		fake_ksocket.o \
43		fake_lookup.o \
44		fake_nblk.o \
45		fake_stream.o \
46		fake_vfs.o \
47		fake_vnode.o \
48		fake_vop.o \
49		fake_xattr.o \
50		reparse.o \
51		vncache.o
52
53# See also: $SRC/uts/common/Makefile.files
54# NB: Intentionally ommitted, compared w/ the above:
55#   smb_cred, smb_fem, smb_idmap, smb_init, smb_kdoor
56#
57OBJS_FS_SMBSRV = \
58		smb_acl.o				\
59		smb_alloc.o				\
60		smb_authenticate.o			\
61		smb_close.o				\
62		smb_cmn_oplock.o			\
63		smb_cmn_rename.o			\
64		smb_cmn_setfile.o			\
65		smb_common_open.o			\
66		smb_common_transact.o			\
67		smb_create.o				\
68		smb_delete.o				\
69		smb_dfs.o				\
70		smb_directory.o				\
71		smb_dispatch.o				\
72		smb_echo.o				\
73		smb_errno.o				\
74		smb_find.o				\
75		smb_flush.o				\
76		smb_fsinfo.o				\
77		smb_fsops.o				\
78		smb_kshare.o				\
79		smb_kutil.o				\
80		smb_lock.o				\
81		smb_lock_byte_range.o			\
82		smb_locking_andx.o			\
83		smb_logoff_andx.o			\
84		smb_mangle_name.o			\
85		smb_mbuf_marshaling.o			\
86		smb_mbuf_util.o				\
87		smb_negotiate.o				\
88		smb_net.o				\
89		smb_node.o				\
90		smb_notify.o				\
91		smb_nt_cancel.o				\
92		smb_nt_create_andx.o			\
93		smb_nt_transact_create.o		\
94		smb_nt_transact_ioctl.o			\
95		smb_nt_transact_notify_change.o		\
96		smb_nt_transact_quota.o			\
97		smb_nt_transact_security.o		\
98		smb_odir.o				\
99		smb_ofile.o				\
100		smb_open_andx.o				\
101		smb_opipe.o				\
102		smb_oplock.o				\
103		smb_pathname.o				\
104		smb_print.o				\
105		smb_process_exit.o			\
106		smb_query_fileinfo.o			\
107		smb_quota.o				\
108		smb_read.o				\
109		smb_rename.o				\
110		smb_sd.o				\
111		smb_seek.o				\
112		smb_server.o				\
113		smb_session.o				\
114		smb_session_setup_andx.o		\
115		smb_set_fileinfo.o			\
116		smb_signing.o				\
117		smb_srv_oplock.o			\
118		smb_thread.o				\
119		smb_tree.o				\
120		smb_trans2_create_directory.o		\
121		smb_trans2_dfs.o			\
122		smb_trans2_find.o			\
123		smb_tree_connect.o			\
124		smb_unlock_byte_range.o			\
125		smb_user.o				\
126		smb_vops.o				\
127		smb_vss.o				\
128		smb_write.o				\
129		\
130		smb2_aapl.o \
131		smb2_dispatch.o \
132		smb2_durable.o \
133		smb2_cancel.o \
134		smb2_change_notify.o \
135		smb2_close.o \
136		smb2_create.o \
137		smb2_echo.o \
138		smb2_flush.o \
139		smb2_fsctl_copychunk.o \
140		smb2_fsctl_fs.o \
141		smb2_fsctl_odx.o \
142		smb2_fsctl_sparse.o \
143		smb2_ioctl.o \
144		smb2_lease.o \
145		smb2_lock.o \
146		smb2_logoff.o \
147		smb2_negotiate.o \
148		smb2_ofile.o \
149		smb2_oplock.o \
150		smb2_qinfo_file.o \
151		smb2_qinfo_fs.o \
152		smb2_qinfo_sec.o \
153		smb2_qinfo_quota.o \
154		smb2_query_dir.o \
155		smb2_query_info.o \
156		smb2_read.o \
157		smb2_session_setup.o \
158		smb2_set_info.o \
159		smb2_setinfo_file.o \
160		smb2_setinfo_fs.o \
161		smb2_setinfo_quota.o \
162		smb2_setinfo_sec.o \
163		smb2_signing.o \
164		smb2_tree_connect.o \
165		smb2_tree_disconn.o \
166		smb2_write.o \
167	        \
168	        smb3_kdf.o \
169	        smb3_encrypt.o
170
171# Can't just link with -lsmb because of user vs kernel API
172# i.e. can't call free with mem from kmem_alloc, which is
173# what happens if we just link with -lsmb
174OBJS_CMN_SMBSRV = \
175		smb_cfg_util.o \
176		smb_inet.o \
177		smb_match.o \
178		smb_msgbuf.o \
179		smb_native.o \
180		smb_netbios_util.o \
181		smb_oem.o \
182		smb_sid.o \
183		smb_string.o \
184		smb_token.o \
185		smb_token_xdr.o \
186		smb_utf8.o \
187		smb_xdr.o
188
189OBJS_MISC = \
190		acl_common.o \
191		avl.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 +=	-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
255# build avl instead of using -lavl so we get debugging
256pics/avl.o:	   $(SRC)/common/avl/avl.c
257	$(COMPILE.c) -o $@ $(SRC)/common/avl/avl.c
258	$(POST_PROCESS_O)
259
260pics/pathname.o:	   $(SRC)/uts/common/fs/pathname.c
261	$(COMPILE.c) -o $@ $(SRC)/uts/common/fs/pathname.c
262	$(POST_PROCESS_O)
263
264pics/refstr.o:		   $(SRC)/uts/common/os/refstr.c
265	$(COMPILE.c) -o $@ $(SRC)/uts/common/os/refstr.c
266	$(POST_PROCESS_O)
267
268pics/smb_status2winerr.o:  $(SRC)/common/smbclnt/smb_status2winerr.c
269	$(COMPILE.c) -o $@ $(SRC)/common/smbclnt/smb_status2winerr.c
270	$(POST_PROCESS_O)
271
272pics/xattr_common.o:	   $(SRC)/common/xattr/xattr_common.c
273	$(COMPILE.c) -o $@ $(SRC)/common/xattr/xattr_common.c
274	$(POST_PROCESS_O)
275
276# Makefile.targ has rule for $(SRC)/common/smbsrv/%.c
277
278.KEEP_STATE:
279
280include ../../Makefile.targ
281include ../../../Makefile.targ
282
283EXTPICS= $(DTRACE_OBJS:%=pics/%)
284CLEANFILES += $(EXTPICS)
285
286$(OBJS) $(PICS) : ../common/fksmb_dt.h
287
288pics/fksmb_dt.o: ../common/fksmb_dt.d $(PICS)
289	$(COMPILE.d) -C -s ../common/fksmb_dt.d -o $@ $(PICS)
290	$(POST_PROCESS_O)
291