xref: /illumos-gate/usr/src/cmd/smbsrv/test-msgbuf/Makefile (revision e75b2cb046700ccab0100afdcd81f2b860fcca87)
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)
55C99LMODE=	-Xc99=%all
56
57CFLAGS += $(CCVERBOSE)
58CFLAGS64 += $(CCVERBOSE)
59
60CERRWARN	+= -_gcc=-Wno-parentheses
61
62CPPFLAGS += -D_REENTRANT
63CPPFLAGS += -DTESTJIG
64CPPFLAGS += -Dsyslog=smb_syslog
65CPPFLAGS += -D_LARGEFILE64_SOURCE=1
66# Always debug here
67CPPFLAGS += -DDEBUG
68CPPFLAGS += $(INCS)
69
70LDFLAGS += $(ZNOLAZYLOAD)
71LDFLAGS += '-R$$ORIGIN/..'
72LDLIBS += -lfakekernel -lcmdutils
73
74LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
75LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
76LINTFLAGS += -xerroff=E_INCONS_ARG_DECL2
77LINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_DECL2
78
79ROOTSMBDDIR = $(ROOTLIB)/smbsrv
80ROOTSMBDFILE = $(PROG:%=$(ROOTSMBDDIR)/%)
81
82.KEEP_STATE:
83
84all: $(PROG)
85
86$(PROG): $(OBJS)
87	$(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
88	$(POST_PROCESS)
89
90clean:
91	-$(RM) $(OBJS)
92
93lint:	# lint_SRCS
94
95include ../../Makefile.targ
96
97install: all $(ROOTSMBDFILE)
98
99test_main.o : test_main.c
100	$(CC) $(CFLAGS) $(CPPFLAGS) -D_KMEMUSER -c test_main.c
101	$(POST_PROCESS_O)
102
103test_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)
125