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