xref: /btstack/test/maths/Makefile (revision 1d3bd1e51ca491d6783233c8d7431c44f06daa5a)
140e1e61cSMilanka Ringwald# Requirements: cpputest.github.io
240e1e61cSMilanka Ringwald
340e1e61cSMilanka RingwaldBTSTACK_ROOT =  ../..
440e1e61cSMilanka RingwaldCPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
540e1e61cSMilanka Ringwald
640e1e61cSMilanka RingwaldCFLAGS  = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
740e1e61cSMilanka RingwaldLDFLAGS += -lCppUTest -lCppUTestExt
840e1e61cSMilanka Ringwald
9cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
1071d52576SMatthias RingwaldCFLAGS_ASAN     = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
1140e1e61cSMilanka Ringwald
12cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt
13cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
14cd56fb44SMatthias RingwaldLDFLAGS_ASAN     = ${LDFLAGS} -fsanitize=address
1540e1e61cSMilanka Ringwald
16cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
17cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN     = $(addprefix build-asan/,    $(COMMON:.c=.o))
18cd56fb44SMatthias Ringwald
19cd56fb44SMatthias Ringwaldall: build-coverage/sqrt_test build-asan/sqrt_test
20cd56fb44SMatthias Ringwald
21cd56fb44SMatthias Ringwaldbuild-%:
22cd56fb44SMatthias Ringwald	mkdir -p $@
233d87570fSMatthias Ringwald
243d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage
25cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_COVERAGE) $< -o $@
263d87570fSMatthias Ringwald
27*1d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage
28*1d3bd1e5SMatthias Ringwald	${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
29*1d3bd1e5SMatthias Ringwald
30cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan
31cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_ASAN) $< -o $@
32cd56fb44SMatthias Ringwald
33*1d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan
34*1d3bd1e5SMatthias Ringwald	${CXX} -c $(CFLAGS_ASAN) $< -o $@
35*1d3bd1e5SMatthias Ringwald
36cd56fb44SMatthias Ringwald
37cd56fb44SMatthias Ringwaldbuild-coverage/sqrt_test: ${COMMON_OBJ_COVERAGE} build-coverage/sqrt_test.o | build-coverage
38*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
39cd56fb44SMatthias Ringwald
40cd56fb44SMatthias Ringwaldbuild-asan/sqrt_test: ${COMMON_OBJ_ASAN} build-asan/sqrt_test.o | build-asan
41*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_ASAN} -o $@
4240e1e61cSMilanka Ringwald
4340e1e61cSMilanka Ringwaldtest: all
44cd56fb44SMatthias Ringwald	build-asan/sqrt_test
453d87570fSMatthias Ringwald
463d87570fSMatthias Ringwaldcoverage: all
47cd56fb44SMatthias Ringwald	rm -f build-coverage/*.gcda
483d87570fSMatthias Ringwald	build-coverage/sqrt_test
4940e1e61cSMilanka Ringwald
5040e1e61cSMilanka Ringwaldclean:
51cd56fb44SMatthias Ringwald	rm -rf build-coverage build-asan
5240e1e61cSMilanka Ringwald
53