|
@ -6,18 +6,18 @@ |
|
|
|
|
|
|
|
|
#We try to detect the OS we are running on, and adjust commands as needed
|
|
|
#We try to detect the OS we are running on, and adjust commands as needed
|
|
|
ifeq ($(OS),Windows_NT) |
|
|
ifeq ($(OS),Windows_NT) |
|
|
CLEANUP = del /F /Q |
|
|
|
|
|
MKDIR = mkdir |
|
|
|
|
|
TARGET_EXTENSION=.exe |
|
|
|
|
|
|
|
|
CLEANUP := del /F /Q |
|
|
|
|
|
MKDIR := mkdir |
|
|
|
|
|
TARGET_EXTENSION := .exe |
|
|
else |
|
|
else |
|
|
CLEANUP = rm -rf |
|
|
|
|
|
MKDIR = mkdir -p |
|
|
|
|
|
TARGET_EXTENSION= |
|
|
|
|
|
|
|
|
CLEANUP := rm -rf |
|
|
|
|
|
MKDIR := mkdir -p |
|
|
|
|
|
TARGET_EXTENSION := |
|
|
endif |
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UNITY_ROOT=../../../../../Git/Unity |
|
|
|
|
|
C_COMPILER=gcc |
|
|
|
|
|
|
|
|
UNITY_ROOT := ../../../../Unity |
|
|
|
|
|
C_COMPILER := gcc |
|
|
|
|
|
|
|
|
CFLAGS = -std=c11 |
|
|
CFLAGS = -std=c11 |
|
|
CFLAGS += -Wall |
|
|
CFLAGS += -Wall |
|
@ -40,9 +40,10 @@ CFLAGS += -g |
|
|
CFLAGS += -ftest-coverage |
|
|
CFLAGS += -ftest-coverage |
|
|
CFLAGS += -fprofile-arcs |
|
|
CFLAGS += -fprofile-arcs |
|
|
|
|
|
|
|
|
TARGET_BASE=test_leddriver |
|
|
|
|
|
TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) |
|
|
|
|
|
SRC_FILES=\
|
|
|
|
|
|
|
|
|
TARGET_BASE := test_leddriver |
|
|
|
|
|
TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) |
|
|
|
|
|
|
|
|
|
|
|
SRC_FILES = \
|
|
|
$(UNITY_ROOT)/extras/fixture/src/unity_fixture.c \
|
|
|
$(UNITY_ROOT)/extras/fixture/src/unity_fixture.c \
|
|
|
$(UNITY_ROOT)/src/unity.c \
|
|
|
$(UNITY_ROOT)/src/unity.c \
|
|
|
../test/LedDriverTest.c \
|
|
|
../test/LedDriverTest.c \
|
|
@ -50,19 +51,24 @@ SRC_FILES=\ |
|
|
../test/AllTests.c \
|
|
|
../test/AllTests.c \
|
|
|
../src/LedDriver.c |
|
|
../src/LedDriver.c |
|
|
|
|
|
|
|
|
INC_DIRS=-I$(UNITY_ROOT)/src -I$(UNITY_ROOT)/extras/fixture/src |
|
|
|
|
|
SYMBOLS= |
|
|
|
|
|
|
|
|
INC_DIRS = -I$(UNITY_ROOT)/src -I$(UNITY_ROOT)/extras/fixture/src |
|
|
|
|
|
SYMBOLS = |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all: clean tests |
|
|
|
|
|
|
|
|
all: clean tests cover |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: tests |
|
|
|
|
|
tests: build/$(TARGET) |
|
|
|
|
|
|
|
|
|
|
|
build/$(TARGET): test/*.c src/*.h src/*.c |
|
|
build/$(TARGET): test/*.c src/*.h src/*.c |
|
|
|
|
|
@$(MKDIR) build |
|
|
|
|
|
@$(MKDIR) build/cover |
|
|
@echo "Compiling"; cd build; $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(TARGET) |
|
|
@echo "Compiling"; cd build; $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(TARGET) |
|
|
|
|
|
|
|
|
|
|
|
.PHONY: tests |
|
|
|
|
|
tests: build/$(TARGET) |
|
|
@echo "Running tests"; ./build/$(TARGET) |
|
|
@echo "Running tests"; ./build/$(TARGET) |
|
|
|
|
|
|
|
|
|
|
|
.PHONY: cover |
|
|
|
|
|
cover: tests |
|
|
@echo "Preparing coverage"; cp build/LedDriver.gc* src/ |
|
|
@echo "Preparing coverage"; cp build/LedDriver.gc* src/ |
|
|
@echo "Running coverage"; cd src; gcovr -r . -b -p --html --html-details -o ../build/cover/test.html |
|
|
@echo "Running coverage"; cd src; gcovr -r . -b -p --html --html-details -o ../build/cover/test.html |
|
|
@echo "Clearing intermediate files"; rm src/*.gc* build/*.gc* |
|
|
@echo "Clearing intermediate files"; rm src/*.gc* build/*.gc* |
|
@ -70,5 +76,4 @@ build/$(TARGET): test/*.c src/*.h src/*.c |
|
|
|
|
|
|
|
|
.PHONY: clean |
|
|
.PHONY: clean |
|
|
clean: |
|
|
clean: |
|
|
@echo "Cleaning $<"; $(CLEANUP) build/$(TARGET) build/*.* build/cover/* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@echo "Cleaning $<"; $(CLEANUP) build |