xref: /illumos-gate/usr/src/cmd/smbsrv/test-msgbuf/Makefile (revision 1e8d79d21400b4e47d64ce367181e7e5ce992649)
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=	test-msgbuf
28
29OBJS_LOCAL=	test_main.o test_misc.o test_conv.o \
30		test_mbmarshal.o test_msgbuf.o
31OBJS_SMBSRV=	smb_mbuf_marshaling.o smb_mbuf_util.o smb_alloc.o
32OBJS_SMBCMN=	smb_msgbuf.o smb_string.o smb_utf8.o
33
34OBJS=	${OBJS_LOCAL} ${OBJS_SMBSRV}  ${OBJS_SMBCMN}
35
36SMBSRV_SRCDIR=../../../uts/common/fs/smbsrv
37SMBSRV_CMNDIR=../../../common/smbsrv
38SRCS=	${OBJS_LOCAL:.o=.c} \
39	${OBJS_SMBSRV:%.o=${SMBSRV_SRCDIR}/%.c} \
40	${OBJS_SMBCMN:%.o=${SMBSRV_CMNDIR}/%.c}
41
42include ../../Makefile.cmd
43include ../../Makefile.ctf
44
45# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc.
46CPPFLAGS.first += -I.
47CPPFLAGS.first += -I../../../lib/libfakekernel/common
48CPPFLAGS.first += -I../../../lib/smbsrv/libfksmbsrv/common
49
50INCS +=	-I../../../uts/common
51INCS +=	-I../../../uts/common/smbsrv
52INCS +=	-I../../../common/smbsrv
53
54CSTD=		$(CSTD_GNU99)
55
56CFLAGS += $(CCVERBOSE)
57CFLAGS64 += $(CCVERBOSE)
58
59CERRWARN	+= -_gcc=-Wno-parentheses
60
61CPPFLAGS += -D_REENTRANT
62CPPFLAGS += -DTESTJIG
63CPPFLAGS += -Dsyslog=smb_syslog
64CPPFLAGS += -D_LARGEFILE64_SOURCE=1
65# Always debug here
66CPPFLAGS += -DDEBUG
67CPPFLAGS += $(INCS)
68
69LDFLAGS += $(ZNOLAZYLOAD)
70LDFLAGS += '-R$$ORIGIN/..'
71LDLIBS += -lfakekernel -lcmdutils
72
73ROOTSMBDDIR = $(ROOTLIB)/smbsrv
74ROOTSMBDFILE = $(PROG:%=$(ROOTSMBDDIR)/%)
75
76.KEEP_STATE:
77
78all: $(PROG)
79
80$(PROG): $(OBJS)
81	$(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
82	$(POST_PROCESS)
83
84clean:
85	-$(RM) $(OBJS)
86
87include ../../Makefile.targ
88
89install: all $(ROOTSMBDFILE)
90
91test_main.o : test_main.c
92	$(CC) $(CFLAGS) $(CPPFLAGS) -D_KMEMUSER -c test_main.c
93	$(POST_PROCESS_O)
94
95test_misc.o : test_misc.c
96	$(CC) $(CFLAGS) $(CPPFLAGS) -D_FAKE_KERNEL \
97	  -I../../../uts/common/smbsrv \
98	  -I../../../common/smbsrv -c test_misc.c
99	$(POST_PROCESS_O)
100
101# OBJS_SMBSRV
102%.o: ../../../uts/common/fs/smbsrv/%.c
103	$(CC) $(CFLAGS) $(CPPFLAGS) -D_FAKE_KERNEL \
104	  -I../../../uts/common/smbsrv \
105	  -I../../../common/smbsrv -c $<
106	$(POST_PROCESS_O)
107
108# OBJS_SMBCMN
109%.o: ../../../common/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$(ROOTSMBDDIR)/%: %
116	$(INS.file)
117