diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-02 17:51:18 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-02 17:51:18 +0200 |
commit | f44a5b1549bc4c8a84d0dedf4a8b1e4220a34f42 (patch) | |
tree | 2368f764aa2f10bf9927096f5222dc4cab94a838 /CAN-binder/libs/isotp-c/Makefile | |
parent | d170c9faeae2cf29c19f3523714ecdf58be73bed (diff) | |
parent | ee24440b7c123ab1b0317e57be33e837a1cb51f1 (diff) |
Add 'CAN-binder/libs/isotp-c/' from commit 'ee24440b7c123ab1b0317e57be33e837a1cb51f1'
git-subtree-dir: CAN-binder/libs/isotp-c
git-subtree-mainline: d170c9faeae2cf29c19f3523714ecdf58be73bed
git-subtree-split: ee24440b7c123ab1b0317e57be33e837a1cb51f1
Diffstat (limited to 'CAN-binder/libs/isotp-c/Makefile')
-rw-r--r-- | CAN-binder/libs/isotp-c/Makefile | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/CAN-binder/libs/isotp-c/Makefile b/CAN-binder/libs/isotp-c/Makefile new file mode 100644 index 00000000..90165ba6 --- /dev/null +++ b/CAN-binder/libs/isotp-c/Makefile @@ -0,0 +1,56 @@ +CC = gcc +INCLUDES = -Isrc -Ideps/bitfield-c/src +CFLAGS = $(INCLUDES) -c -Wall -Werror -g -ggdb -std=gnu99 -coverage +LDFLAGS = -coverage +LDLIBS = -lcheck -lm -lrt -lpthread + +TEST_DIR = tests +TEST_OBJDIR = build + +# Guard against \r\n line endings only in Cygwin +OSTYPE := $(shell uname) +ifneq ($(OSTYPE),Darwin) + OSTYPE := $(shell uname -o) + ifeq ($(OSTYPE),Cygwin) + TEST_SET_OPTS = igncr + endif +endif + +LIBS_PATH = deps +SRC = $(wildcard src/**/*.c) +SRC += $(wildcard deps/bitfield-c/src/**/*.c) +OBJS = $(patsubst %,$(TEST_OBJDIR)/%,$(SRC:.c=.o)) +TEST_SRC = $(wildcard $(TEST_DIR)/test_*.c) +TESTS=$(patsubst %.c,$(TEST_OBJDIR)/%.bin,$(TEST_SRC)) +TEST_SUPPORT_SRC = $(TEST_DIR)/common.c +TEST_SUPPORT_OBJS = $(patsubst %,$(TEST_OBJDIR)/%,$(TEST_SUPPORT_SRC:.c=.o)) + +all: $(OBJS) + +test: $(TESTS) + @set -o $(TEST_SET_OPTS) >/dev/null 2>&1 + @export SHELLOPTS + @sh runtests.sh $(TEST_OBJDIR)/$(TEST_DIR) + +COVERAGE_INFO_FILENAME = coverage.info +COVERAGE_INFO_PATH = $(TEST_OBJDIR)/$(COVERAGE_INFO_FILENAME) +coverage: + @lcov --base-directory . --directory src --zerocounters -q + @make clean + @make test + @lcov --base-directory . --directory $(TEST_OBJDIR) -c -o $(TEST_OBJDIR)/coverage.info + @lcov --remove $(COVERAGE_INFO_PATH) "$(LIBS_PATH)/bitfield-c/*" -o $(COVERAGE_INFO_PATH) + @genhtml -o $(TEST_OBJDIR)/coverage -t "isotp-c test coverage" --num-spaces 4 $(COVERAGE_INFO_PATH) + @$(BROWSER) $(TEST_OBJDIR)/coverage/index.html + @echo "$(GREEN)Coverage information generated in $(TEST_OBJDIR)/coverage/index.html.$(COLOR_RESET)" + +$(TEST_OBJDIR)/%.o: %.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) $(CC_SYMBOLS) $(INCLUDES) -o $@ $< + +$(TEST_OBJDIR)/%.bin: $(TEST_OBJDIR)/%.o $(OBJS) $(TEST_SUPPORT_OBJS) + @mkdir -p $(dir $@) + $(CC) $(LDFLAGS) $(CC_SYMBOLS) $(INCLUDES) -o $@ $^ $(LDLIBS) + +clean: + rm -rf $(TEST_OBJDIR) |