btstack/test/maths/Makefile

56 lines
1.4 KiB
Makefile
Raw Normal View History

2016-11-14 13:59:29 +00:00
# Requirements: cpputest.github.io
BTSTACK_ROOT = ../..
# CppuTest from pkg-config
CFLAGS += ${shell pkg-config --cflags CppuTest}
LDFLAGS += ${shell pkg-config --libs CppuTest}
CFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null -Ibuild-coverage -I./
2016-11-14 13:59:29 +00:00
LDFLAGS += -lCppUTest -lCppUTestExt
CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
CFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
2016-11-14 13:59:29 +00:00
LDFLAGS += -lCppUTest -lCppUTestExt
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
2016-11-14 13:59:29 +00:00
all: build-coverage/sqrt_test build-asan/sqrt_test
build-%:
mkdir -p $@
build-coverage/%.o: %.c | build-coverage
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
build-coverage/%.o: %.cpp | build-coverage
${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
build-asan/%.o: %.c | build-asan
${CC} -c $(CFLAGS_ASAN) $< -o $@
build-asan/%.o: %.cpp | build-asan
${CXX} -c $(CFLAGS_ASAN) $< -o $@
build-coverage/sqrt_test: ${COMMON_OBJ_COVERAGE} build-coverage/sqrt_test.o | build-coverage
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
build-asan/sqrt_test: ${COMMON_OBJ_ASAN} build-asan/sqrt_test.o | build-asan
${CXX} $^ ${LDFLAGS_ASAN} -o $@
2016-11-14 13:59:29 +00:00
test: all
build-asan/sqrt_test
2016-11-14 13:59:29 +00:00
coverage: all
rm -f build-coverage/*.gcda
build-coverage/sqrt_test
2016-11-14 13:59:29 +00:00
clean:
rm -rf build-coverage build-asan
2016-11-14 13:59:29 +00:00