Makefile 1.9 KB

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