xref: /btstack/test/linked_list/Makefile (revision 1d3bd1e51ca491d6783233c8d7431c44f06daa5a)
18e8dfe94SMatthias Ringwald# Requirements: cpputest.github.io
22412778bSmatthias.ringwald
32412778bSmatthias.ringwaldBTSTACK_ROOT =  ../..
42412778bSmatthias.ringwaldCPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
52412778bSmatthias.ringwald
6e0ff5d41SMatthias RingwaldCFLAGS  = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null
7e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/src
8e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/include
9e0ff5d41SMatthias RingwaldCFLAGS += -I..
1057fe2af8SMatthias Ringwald
113edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble
1257fe2af8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src
13dd9e275cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix
142412778bSmatthias.ringwald
152412778bSmatthias.ringwaldCOMMON = \
164fd23d47SMatthias Ringwald    btstack_linked_list.c \
1769cb6dafSMatthias Ringwald    hci_dump.c \
1869cb6dafSMatthias Ringwald    btstack_util.c \
192412778bSmatthias.ringwald
20cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
2171d52576SMatthias RingwaldCFLAGS_ASAN     = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
222412778bSmatthias.ringwald
23cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt
24cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
25cd56fb44SMatthias RingwaldLDFLAGS_ASAN     = ${LDFLAGS} -fsanitize=address
262412778bSmatthias.ringwald
27cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
28cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN     = $(addprefix build-asan/,    $(COMMON:.c=.o))
29cd56fb44SMatthias Ringwald
30cd56fb44SMatthias Ringwaldall: build-coverage/btstack_linked_list_test build-asan/btstack_linked_list_test
31cd56fb44SMatthias Ringwald
32cd56fb44SMatthias Ringwaldbuild-%:
33cd56fb44SMatthias Ringwald	mkdir -p $@
343d87570fSMatthias Ringwald
353d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage
36cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_COVERAGE) $< -o $@
373d87570fSMatthias Ringwald
38*1d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage
39*1d3bd1e5SMatthias Ringwald	${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
40*1d3bd1e5SMatthias Ringwald
41cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan
42cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_ASAN) $< -o $@
43cd56fb44SMatthias Ringwald
44*1d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan
45*1d3bd1e5SMatthias Ringwald	${CXX} -c $(CFLAGS_ASAN) $< -o $@
46*1d3bd1e5SMatthias Ringwald
47cd56fb44SMatthias Ringwaldbuild-coverage/btstack_linked_list_test: ${COMMON_OBJ_COVERAGE} build-coverage/btstack_linked_list_test.o | build-coverage
48*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
49cd56fb44SMatthias Ringwald
50cd56fb44SMatthias Ringwaldbuild-asan/btstack_linked_list_test: ${COMMON_OBJ_ASAN} build-asan/btstack_linked_list_test.o | build-asan
51*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_ASAN} -o $@
522412778bSmatthias.ringwald
538e8dfe94SMatthias Ringwaldtest: all
54cd56fb44SMatthias Ringwald	build-asan/btstack_linked_list_test
553d87570fSMatthias Ringwald
563d87570fSMatthias Ringwaldcoverage: all
57cd56fb44SMatthias Ringwald	rm -f build-coverage/*.gcda
583d87570fSMatthias Ringwald	build-coverage/btstack_linked_list_test
5957fe2af8SMatthias Ringwald
602412778bSmatthias.ringwaldclean:
61cd56fb44SMatthias Ringwald	rm -rf build-coverage build-asan
62