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