xref: /aosp_15_r20/external/ltp/utils/sctp/func_tests/Makefile (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker# SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker# (C) Copyright IBM Corp. 2001, 2003
3*49cdfc7eSAndroid Build Coastguard Worker
4*49cdfc7eSAndroid Build Coastguard Workertop_srcdir	?= ../../..
5*49cdfc7eSAndroid Build Coastguard Worker
6*49cdfc7eSAndroid Build Coastguard Workerinclude $(top_srcdir)/include/mk/testcases.mk
7*49cdfc7eSAndroid Build Coastguard Worker
8*49cdfc7eSAndroid Build Coastguard WorkerCPPFLAGS	+= -I$(abs_srcdir)/../include -I$(abs_srcdir)/../testlib -DLTP
9*49cdfc7eSAndroid Build Coastguard Worker
10*49cdfc7eSAndroid Build Coastguard WorkerLDFLAGS		+= $(addprefix -L$(abs_builddir)/../,lib testlib)
11*49cdfc7eSAndroid Build Coastguard Worker
12*49cdfc7eSAndroid Build Coastguard WorkerLDLIBS		+= -lsctputil -lsctp -lpthread
13*49cdfc7eSAndroid Build Coastguard Worker
14*49cdfc7eSAndroid Build Coastguard WorkerV4_TARGETS	:= $(patsubst $(abs_srcdir)/%.c,%,$(sort $(wildcard $(abs_srcdir)/*.c)))
15*49cdfc7eSAndroid Build Coastguard Worker
16*49cdfc7eSAndroid Build Coastguard WorkerV6_TARGETS	:= test_basic_v6 test_fragments_v6 test_getname_v6 \
17*49cdfc7eSAndroid Build Coastguard Worker		   test_inaddr_any_v6 test_peeloff_v6 \
18*49cdfc7eSAndroid Build Coastguard Worker		   test_sctp_sendrecvmsg_v6 test_sockopt_v6 \
19*49cdfc7eSAndroid Build Coastguard Worker		   test_tcp_style_v6 test_timetolive_v6
20*49cdfc7eSAndroid Build Coastguard Worker
21*49cdfc7eSAndroid Build Coastguard Worker$(V6_TARGETS): CPPFLAGS += -DTEST_V6=1
22*49cdfc7eSAndroid Build Coastguard Worker
23*49cdfc7eSAndroid Build Coastguard Worker%_v6.o: %.c
24*49cdfc7eSAndroid Build Coastguard Worker	$(COMPILE.c) $(OUTPUT_OPTION) $<
25*49cdfc7eSAndroid Build Coastguard Worker
26*49cdfc7eSAndroid Build Coastguard WorkerMAKE_TARGETS	:= $(V4_TARGETS) $(V6_TARGETS)
27*49cdfc7eSAndroid Build Coastguard Worker
28*49cdfc7eSAndroid Build Coastguard Workerv4test: $(V4_TARGETS)
29*49cdfc7eSAndroid Build Coastguard Worker	@for a in $^;                           \
30*49cdfc7eSAndroid Build Coastguard Worker	do                                      \
31*49cdfc7eSAndroid Build Coastguard Worker		echo "./$$a";                   \
32*49cdfc7eSAndroid Build Coastguard Worker		if ./$$a; then                  \
33*49cdfc7eSAndroid Build Coastguard Worker			echo "$$a - passed";    \
34*49cdfc7eSAndroid Build Coastguard Worker			echo "";                \
35*49cdfc7eSAndroid Build Coastguard Worker		else                            \
36*49cdfc7eSAndroid Build Coastguard Worker			echo "$$a - failed";    \
37*49cdfc7eSAndroid Build Coastguard Worker			exit 1;                 \
38*49cdfc7eSAndroid Build Coastguard Worker		fi;                             \
39*49cdfc7eSAndroid Build Coastguard Worker	done
40*49cdfc7eSAndroid Build Coastguard Worker
41*49cdfc7eSAndroid Build Coastguard Workerv6test: $(V6_TARGETS)
42*49cdfc7eSAndroid Build Coastguard Worker	@for a in $^;                           \
43*49cdfc7eSAndroid Build Coastguard Worker	do                                      \
44*49cdfc7eSAndroid Build Coastguard Worker		echo "./$$a";                   \
45*49cdfc7eSAndroid Build Coastguard Worker		if ./$$a; then                  \
46*49cdfc7eSAndroid Build Coastguard Worker			echo "$$a - passed";    \
47*49cdfc7eSAndroid Build Coastguard Worker			echo "";                \
48*49cdfc7eSAndroid Build Coastguard Worker		else                            \
49*49cdfc7eSAndroid Build Coastguard Worker			echo "$$a - failed";    \
50*49cdfc7eSAndroid Build Coastguard Worker			exit 1;                 \
51*49cdfc7eSAndroid Build Coastguard Worker		fi;                             \
52*49cdfc7eSAndroid Build Coastguard Worker	done
53*49cdfc7eSAndroid Build Coastguard Worker
54*49cdfc7eSAndroid Build Coastguard Workerinclude $(top_srcdir)/include/mk/generic_leaf_target.mk
55