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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23 # Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  24 #
  25 
  26 
  27 PROG=   test-msgbuf
  28 
  29 OBJS_LOCAL=     test_main.o test_misc.o test_conv.o \
  30                 test_mbmarshal.o test_msgbuf.o
  31 OBJS_SMBSRV=    smb_mbuf_marshaling.o smb_mbuf_util.o smb_alloc.o
  32 OBJS_SMBCMN=    smb_msgbuf.o smb_string.o smb_utf8.o
  33 
  34 OBJS=   ${OBJS_LOCAL} ${OBJS_SMBSRV}  ${OBJS_SMBCMN}
  35 
  36 SMBSRV_SRCDIR=../../../uts/common/fs/smbsrv
  37 SMBSRV_CMNDIR=../../../common/smbsrv
  38 SRCS=   ${OBJS_LOCAL:.o=.c} \
  39         ${OBJS_SMBSRV:%.o=${SMBSRV_SRCDIR}/%.c} \
  40         ${OBJS_SMBCMN:%.o=${SMBSRV_CMNDIR}/%.c}
  41 
  42 include ../../Makefile.cmd
  43 include ../../Makefile.ctf
  44 
  45 # Note: need our sys includes _before_ ENVCPPFLAGS, proto etc.
  46 CPPFLAGS.first += -I.
  47 CPPFLAGS.first += -I../../../lib/libfakekernel/common
  48 CPPFLAGS.first += -I../../../lib/smbsrv/libfksmbsrv/common
  49 
  50 INCS += -I../../../uts/common
  51 INCS += -I../../../uts/common/smbsrv
  52 INCS += -I../../../common/smbsrv
  53 
  54 CSTD=           $(CSTD_GNU99)
  55 C99LMODE=       -Xc99=%all
  56 
  57 CFLAGS += $(CCVERBOSE)
  58 CFLAGS64 += $(CCVERBOSE)
  59 
  60 CERRWARN        += -_gcc=-Wno-parentheses
  61 
  62 CPPFLAGS += -D_REENTRANT
  63 CPPFLAGS += -DTESTJIG
  64 CPPFLAGS += -Dsyslog=smb_syslog
  65 CPPFLAGS += -D_LARGEFILE64_SOURCE=1
  66 # Always debug here
  67 CPPFLAGS += -DDEBUG
  68 CPPFLAGS += $(INCS)
  69 
  70 LDFLAGS += $(ZNOLAZYLOAD)
  71 LDFLAGS += '-R$$ORIGIN' '-R$$ORIGIN/..'
  72 LDLIBS += -lfakekernel -lcmdutils
  73 
  74 LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
  75 LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
  76 LINTFLAGS += -xerroff=E_INCONS_ARG_DECL2
  77 LINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_DECL2
  78 
  79 ROOTSMBDDIR = $(ROOTLIB)/smbsrv
  80 ROOTSMBDFILE = $(PROG:%=$(ROOTSMBDDIR)/%)
  81 
  82 .KEEP_STATE:
  83 
  84 all: $(PROG)
  85 
  86 $(PROG): $(OBJS)
  87         $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
  88         $(POST_PROCESS)
  89 
  90 clean:
  91         -$(RM) $(OBJS)
  92 
  93 lint:   # lint_SRCS
  94 
  95 include ../../Makefile.targ
  96 
  97 install: all $(ROOTSMBDFILE)
  98 
  99 test_main.o : test_main.c
 100         $(CC) $(CFLAGS) $(CPPFLAGS) -D_KMEMUSER -c test_main.c
 101         $(POST_PROCESS_O)
 102 
 103 test_misc.o : test_misc.c
 104         $(CC) $(CFLAGS) $(CPPFLAGS) -D_FAKE_KERNEL \
 105           -I../../../uts/common/smbsrv \
 106           -I../../../common/smbsrv -c test_misc.c
 107         $(POST_PROCESS_O)
 108 
 109 # OBJS_SMBSRV
 110 %.o: ../../../uts/common/fs/smbsrv/%.c
 111         $(CC) $(CFLAGS) $(CPPFLAGS) -D_FAKE_KERNEL \
 112           -I../../../uts/common/smbsrv \
 113           -I../../../common/smbsrv -c $<
 114         $(POST_PROCESS_O)
 115 
 116 # OBJS_SMBCMN
 117 %.o: ../../../common/smbsrv/%.c
 118         $(CC) $(CFLAGS) $(CPPFLAGS) -D_FAKE_KERNEL \
 119           -I../../../uts/common/smbsrv \
 120           -I../../../common/smbsrv -c $<
 121         $(POST_PROCESS_O)
 122 
 123 $(ROOTSMBDDIR)/%: %
 124         $(INS.file)