make file
CPPUTEST_USE_EXTENSIONS = Y
如果没有这一句定义,CppUTestExt/MockSupport.h和CppUTestExt/MockSupport_c.h文件中的定义就不能用,编译后提示未定义
#include "CppUTest/TestHarness.h" #include "CppUTestExt/MockSupport.h" extern"C" { #include "CppUTestExt/MockSupport_c.h" #include "Flash.h" #include "m28w160ect.h" #include "FakeMicroTime.h" }
$(CPPUTEST_HOME)/include/\
定义很简单,CPPUTEST_HOME = E:\cpputest
windows中地址用的是反斜杠,Linux中用的是斜杠
#include "CppUTestExt/MockSupport_c.h"
它的原地址是“E:\cpputest\include\CppUTest”
Set this to @ to keep the makefile quiet SILENCE = @ CPPUTEST_HOME = E:\cpputest #---- Outputs ----# COMPONENT_NAME = t1 TARGET_LIB = \ lib/lib$(COMPONENT_NAME).a TEST_TARGET = \ $(COMPONENT_NAME)_tests #--- Inputs ----# PROJECT_HOME_DIR = . CPP_PLATFORM = Gcc CPPUTEST_USE_EXTENSIONS = Y CPPUTEST_WARNINGFLAGS += -Wall CPPUTEST_WARNINGFLAGS += -Werror CPPUTEST_WARNINGFLAGS += -Wswitch-default CPPUTEST_WARNINGFLAGS += -Wswitch-enum CPPUTEST_WARNINGFLAGS += -Wno-self-assign //CPPUTEST_CFLAGS += -std=c89 CPPUTEST_CFLAGS += -Wextra CPPUTEST_CFLAGS += -pedantic CPPUTEST_CFLAGS += -Wstrict-prototypes SRC_DIRS = \ src/*\ src/MyOS/Acme\ TEST_SRC_DIRS = \ tests \ tests/IO \ mocks/IO \ mocks INCLUDE_DIRS =\ .\ $(CPPUTEST_HOME)/include/\ include/*\ mocks/IO \ mocks ifeq ($(CPPUTEST_HOME),) $(info CPPUTEST_HOME not set! See README.txt) else include $(CPPUTEST_HOME)/build/MakefileWorker.mk endif