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= testoplock
28
29 OBJS_LOCAL= tol_main.o tol_misc.o
30 OBJS_SMBSRV= smb_cmn_oplock.o
31 OBJS_LIBSMB= smb_status_tbl.o
32
33 OBJS= ${OBJS_LOCAL} ${OBJS_SMBSRV} ${OBJS_LIBSMB}
34
35 SMBSRV_SRCDIR=../../../uts/common/fs/smbsrv
36 SRCS= ${OBJS_LOCAL:.o=.c} \
37 ${OBJS_SMBSRV:%.o=${SMBSRV_SRCDIR}/%.c}
38
39 include ../../Makefile.cmd
40 include ../../Makefile.ctf
41
42 # Note: need our sys includes _before_ ENVCPPFLAGS, proto etc.
43 CPPFLAGS.first += -I.
44 CPPFLAGS.first += -I../../../lib/libfakekernel/common
45 CPPFLAGS.first += -I../../../lib/smbsrv/libfksmbsrv/common
46
47 INCS += -I../../../uts/common
48
49 CSTD= $(CSTD_GNU99)
50 C99LMODE= -Xc99=%all
51
52 CFLAGS += $(CCVERBOSE)
53 CFLAGS64 += $(CCVERBOSE)
54
55 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO)
56
57 # CPPFLAGS is deliberatly set with a "=" and not a "+="...
58 CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
59
60 CPPFLAGS += -D_REENTRANT
61 CPPFLAGS += -DTESTJIG
62 CPPFLAGS += -Dsyslog=smb_syslog
63 CPPFLAGS += -D_LARGEFILE64_SOURCE=1
64 # Always debug here
65 CPPFLAGS += -DDEBUG
66 CPPFLAGS += $(INCS)
67
68 LDFLAGS += $(ZNOLAZYLOAD)
69 LDFLAGS += '-R$$ORIGIN' '-R$$ORIGIN/..'
70 LDLIBS += -L$(ROOT)/usr/lib/smbsrv
71 LDLIBS += -lfakekernel -lcmdutils
72
73 LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
74 LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
75 LINTFLAGS += -xerroff=E_INCONS_ARG_DECL2
76 LINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_DECL2
77
78 ROOTSMBDDIR = $(ROOTLIB)/smbsrv
79 ROOTSMBDFILE = $(PROG:%=$(ROOTSMBDDIR)/%)
80
81 .KEEP_STATE:
82
83 all: $(PROG)
84
85 $(PROG): $(OBJS)
86 $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
87 $(POST_PROCESS)
88
89 clean:
90 -$(RM) $(OBJS)
91
92 lint: # lint_SRCS
93
94 include ../../Makefile.targ
95
96 install: all $(ROOTSMBDFILE)
97
98
99 tol_main.o : tol_main.c
100 $(CC) $(CFLAGS) $(CPPFLAGS) -D_KMEMUSER -c tol_main.c
101 $(POST_PROCESS_O)
102
103 tol_misc.o : tol_misc.c
104 $(CC) $(CFLAGS) $(CPPFLAGS) -D_FAKE_KERNEL \
105 -I../../../uts/common/smbsrv \
106 -I../../../common/smbsrv -c tol_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_LIBSMB
117 %.o: ../../../lib/smbsrv/libsmb/common/%.c
118 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
119 $(POST_PROCESS_O)
120
121
122 $(ROOTSMBDDIR)/%: %
123 $(INS.file)