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