Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 = $(sort $(COMMON_TESTHELPER_SRC:.cc=.o))
  11. COMMON_TESTHELPER_UTEST_OBJ = $(sort $(COMMON_TESTHELPER_UTEST_SRC:.cc=.o))
  12. COMMON_TESTHELPER_LIB = ./libcommon-testhelper.a
  13. COMMON_TESTHELPER_UTEST_EXE = ./unittests/common-testhelper-utest
  14. LIB_COMMON_TESTHELPER_DIR = .
  15. LIB_COMMON_DIR = ../common
  16. LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src
  17. LIB_IPPCPEPID_DIR = ../../ext/ipp/sources/ippcpepid/src
  18. #set flags for linker
  19. LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
  20. -L$(LIB_COMMON_DIR) -L$(LIB_IPPCPEPID_DIR) -L$(LIB_IPPCP_DIR) \
  21. -lgtest -lcommon-testhelper -lcommon -lippcpepid -lippcp
  22. #target part
  23. $(COMMON_TESTHELPER_LIB): $(COMMON_TESTHELPER_OBJ)
  24. $(AR) rc $(COMMON_TESTHELPER_LIB) $(COMMON_TESTHELPER_OBJ)
  25. ranlib $(COMMON_TESTHELPER_LIB)
  26. $(COMMON_TESTHELPER_OBJ): %.o: %.cc
  27. $(CXX) -o $@ $(CXXFLAGS) -I$(COMMON_TESTHELPER_INCLUDE_DIR) -c $^
  28. $(COMMON_TESTHELPER_UTEST_EXE): $(COMMON_TESTHELPER_UTEST_OBJ)
  29. $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
  30. $(COMMON_TESTHELPER_UTEST_OBJ): %.o: %.cc
  31. $(CXX) -o $@ $(CXXFLAGS) -I$(COMMON_TESTHELPER_INCLUDE_DIR) \
  32. -I$(COMMON_TESTHELPER_11_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
  33. build: all
  34. all: $(COMMON_TESTHELPER_LIB)
  35. install:
  36. #install tests if they exist
  37. ifneq (,$(wildcard $(COMMON_TESTHELPER_UTEST_EXE)))
  38. mkdir -p '$(TEST_INSTALL_DIR)'
  39. cp $(COMMON_TESTHELPER_UTEST_EXE) '$(TEST_INSTALL_DIR)'
  40. endif
  41. check: $(COMMON_TESTHELPER_UTEST_EXE) run
  42. run:
  43. $(COMMON_TESTHELPER_UTEST_EXE) $(GTEST_FLAGS)
  44. clean:
  45. rm -f $(COMMON_TESTHELPER_OBJ) \
  46. $(COMMON_TESTHELPER_LIB) \
  47. $(COMMON_TESTHELPER_UTEST_OBJ) \
  48. $(COMMON_TESTHELPER_UTEST_EXE) \
  49. *.xml