1 #!/usr/bin/make -f 2 3 #define variables 4 GTEST_INCLUDE_DIR = ../../ext 5 TEST_INSTALL_DIR = $(epidinstalldir)/test/ 6 7 COMMON_TESTHELPER_INCLUDE_DIR = ../.. 8 COMMON_TESTHELPER_11_INCLUDE_DIR = ../../1.1 9 COMMON_TESTHELPER_SRC = $(wildcard ./*.cc) 10 COMMON_TESTHELPER_SRC += $(wildcard ./1.1/*.cc) 11 COMMON_TESTHELPER_UTEST_SRC = $(wildcard ./unittests/*.cc) 12 COMMON_TESTHELPER_OBJ = $(COMMON_TESTHELPER_SRC:.cc=.o) 13 COMMON_TESTHELPER_UTEST_OBJ = $(COMMON_TESTHELPER_UTEST_SRC:.cc=.o) 14 COMMON_TESTHELPER_LIB = ./libcommon-testhelper.a 15 COMMON_TESTHELPER_UTEST_EXE = ./unittests/common-testhelper-utest$(EXE_EXTENSION) 16 17 LIB_COMMON_TESTHELPER_DIR = . 18 LIB_COMMON_DIR = ../common 19 LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src 20 21 #set flags for linker 22 LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \ 23 -L$(LIB_COMMON_DIR) -L$(LIB_IPPCP_DIR) \ 24 -lgtest -lcommon-testhelper -lcommon -lippcp 25 26 ifneq ($(TSS_PATH),) 27 CXXFLAGS += -DTPM_TSS 28 endif 29 30 #target part 31 $(COMMON_TESTHELPER_LIB): $(COMMON_TESTHELPER_OBJ) 32 $(AR) rc $(COMMON_TESTHELPER_LIB) $(COMMON_TESTHELPER_OBJ) 33 $(RANLIB) $(COMMON_TESTHELPER_LIB) 34 35 $(COMMON_TESTHELPER_OBJ): %.o: %.cc 36 $(CXX) -o $@ $(CXXFLAGS) -I$(COMMON_TESTHELPER_INCLUDE_DIR) -c $^ 37 38 $(COMMON_TESTHELPER_UTEST_EXE): $(COMMON_TESTHELPER_UTEST_OBJ) 39 $(CXX) -o $@ $^ $(LDFLAGS) 40 41 $(COMMON_TESTHELPER_UTEST_OBJ): %.o: %.cc 42 $(CXX) -o $@ $(CXXFLAGS) $(GTEST_DEFINES) -I$(COMMON_TESTHELPER_INCLUDE_DIR) \ 43 -I$(COMMON_TESTHELPER_11_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^ 44 45 build: all 46 47 all: $(COMMON_TESTHELPER_LIB) 48 49 install: 50 #install tests if they exist 51 ifneq (,$(wildcard $(COMMON_TESTHELPER_UTEST_EXE))) 52 mkdir -p '$(TEST_INSTALL_DIR)' 53 cp $(COMMON_TESTHELPER_UTEST_EXE) '$(TEST_INSTALL_DIR)' 54 endif 55 56 utest: $(COMMON_TESTHELPER_UTEST_EXE) 57 58 run_utest: 59 $(COMMON_TESTHELPER_UTEST_EXE) $(GTEST_FLAGS) 60 61 check: utest run_utest 62 63 clean: 64 rm -f $(COMMON_TESTHELPER_OBJ) \ 65 $(COMMON_TESTHELPER_LIB) \ 66 $(COMMON_TESTHELPER_UTEST_OBJ) \ 67 $(COMMON_TESTHELPER_UTEST_EXE) \ 68 *.xml 69