Build options for building with coverage support.

This commit is contained in:
Roger A. Light 2018-10-16 13:54:50 +01:00
parent a7fff2ad2e
commit 5edc87bcdf
2 changed files with 14 additions and 1 deletions

View File

@ -95,6 +95,9 @@ WITH_EPOLL:=yes
# Build with bundled uthash.h # Build with bundled uthash.h
WITH_BUNDLED_DEPS:=yes WITH_BUNDLED_DEPS:=yes
# Build with coverage options
WITH_COVERAGE:=no
# ============================================================================= # =============================================================================
# End of user configuration # End of user configuration
# ============================================================================= # =============================================================================
@ -131,6 +134,7 @@ LIB_CXXFLAGS:=$(CFLAGS) ${CPPFLAGS} -I. -I.. -I../lib
LIB_LDFLAGS:=${LDFLAGS} LIB_LDFLAGS:=${LDFLAGS}
BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER
BROKER_LDFLAGS:=${LDFLAGS}
CLIENT_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I.. -I../lib -DVERSION="\"${VERSION}\"" CLIENT_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I.. -I../lib -DVERSION="\"${VERSION}\""
ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),) ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),)
@ -295,3 +299,12 @@ endif
ifeq ($(WITH_BUNDLED_DEPS),yes) ifeq ($(WITH_BUNDLED_DEPS),yes)
BROKER_CFLAGS:=$(BROKER_CFLAGS) -Ideps BROKER_CFLAGS:=$(BROKER_CFLAGS) -Ideps
endif endif
ifeq ($(WITH_COVERAGE),yes)
BROKER_CFLAGS:=$(BROKER_CFLAGS) -coverage
BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -coverage
LIB_CFLAGS:=$(LIB_CFLAGS) -coverage
LIB_LDFLAGS:=$(LIB_LDFLAGS) -coverage
CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -coverage
CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) -coverage
endif

View File

@ -59,7 +59,7 @@ OBJS= mosquitto.o \
will_mosq.o will_mosq.o
mosquitto : ${OBJS} mosquitto : ${OBJS}
${CROSS_COMPILE}${CC} $^ -o $@ ${LDFLAGS} $(BROKER_LIBS) ${CROSS_COMPILE}${CC} $^ -o $@ ${BROKER_LDFLAGS} $(BROKER_LIBS)
mosquitto.o : mosquitto.c mosquitto_broker_internal.h mosquitto.o : mosquitto.c mosquitto_broker_internal.h
${CROSS_COMPILE}${CC} $(BROKER_CFLAGS) -c $< -o $@ ${CROSS_COMPILE}${CC} $(BROKER_CFLAGS) -c $< -o $@