Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/make -f
  2. #define variables
  3. IPP_SRC_INCLUDE_DIR = ../../ext/ipp/sources/ippcp/src/
  4. IPP_INCLUDE_DIR = ../../ext/ipp/sources/include/
  5. GTEST_INCLUDE_DIR = ../../ext/
  6. LIB_INSTALL_DIR = $(epidinstalldir)/lib/posix-$(ARCH)/
  7. TEST_INSTALL_DIR = $(epidinstalldir)/test/
  8. HEADERS_INSTALL_DIR = $(epidinstalldir)/include/epid/verifier/
  9. HEADERS_11_INSTALL_DIR = $(epidinstalldir)/include/epid/verifier/1.1/
  10. API_HEADERS_INSTALL = ./api.h
  11. API_11_HEADERS_INSTALL = ./1.1/api.h
  12. VERIFIER_INCLUDE_DIR = ../../
  13. VERIFIER_11_INCLUDE_DIR = ../../1.1
  14. VERIFIER_SRC = $(wildcard ./src/*.c)
  15. VERIFIER_SRC += $(wildcard ./1.1/src/*.c)
  16. VERIFIER_OBJ = $(sort $(VERIFIER_SRC:.c=.o))
  17. VERIFIER_LIB = ./libverifier.a
  18. VERIFIER_UTEST_EXE = ./verifier-utest
  19. VERIFIER_UTEST_SRC = $(wildcard ./unittests/*.cc)
  20. VERIFIER_UTEST_SRC += $(wildcard ./1.1/unittests/*.cc)
  21. VERIFIER_UTEST_OBJ = $(sort $(VERIFIER_UTEST_SRC:.cc=.o))
  22. LIB_VERIFIER_DIR = .
  23. LIB_COMMON_TESTHELPER_DIR = ../common-testhelper
  24. LIB_COMMON_DIR = ../common
  25. LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src
  26. LIB_IPPCPEPID_DIR = ../../ext/ipp/sources/ippcpepid/src
  27. #set flags for linker
  28. LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
  29. -L$(LIB_VERIFIER_DIR) -L$(LIB_COMMON_DIR) -L$(LIB_IPPCPEPID_DIR) \
  30. -L$(LIB_IPPCP_DIR) -lgtest -lcommon-testhelper -lverifier -lcommon \
  31. -lippcpepid -lippcp
  32. #target part
  33. $(VERIFIER_OBJ): %.o: %.c
  34. $(CC) $(CFLAGS) -I$(IPP_INCLUDE_DIR) -I$(IPP_SRC_INCLUDE_DIR) \
  35. -I$(VERIFIER_INCLUDE_DIR) -I$(VERIFIER_11_INCLUDE_DIR) -c $^ -o $@
  36. $(VERIFIER_LIB): $(VERIFIER_OBJ)
  37. $(AR) rc $(VERIFIER_LIB) $(VERIFIER_OBJ)
  38. ranlib $(VERIFIER_LIB)
  39. $(VERIFIER_UTEST_EXE): $(VERIFIER_UTEST_OBJ)
  40. $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
  41. $(VERIFIER_UTEST_OBJ): %.o: %.cc
  42. $(CXX) -o $@ $(CXXFLAGS) -I$(VERIFIER_INCLUDE_DIR) \
  43. -I$(VERIFIER_11_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
  44. build: all
  45. all: $(VERIFIER_LIB)
  46. install:
  47. mkdir -p '$(LIB_INSTALL_DIR)'
  48. mkdir -p '$(HEADERS_INSTALL_DIR)'
  49. mkdir -p '$(HEADERS_11_INSTALL_DIR)'
  50. cp $(VERIFIER_LIB) '$(LIB_INSTALL_DIR)'
  51. cp $(API_HEADERS_INSTALL) '$(HEADERS_INSTALL_DIR)'
  52. cp $(API_11_HEADERS_INSTALL) '$(HEADERS_11_INSTALL_DIR)'
  53. #install tests if they exist
  54. ifneq (,$(wildcard $(VERIFIER_UTEST_EXE)))
  55. mkdir -p '$(TEST_INSTALL_DIR)'
  56. cp $(VERIFIER_UTEST_EXE) '$(TEST_INSTALL_DIR)'
  57. endif
  58. check: $(VERIFIER_UTEST_EXE) run
  59. run:
  60. $(VERIFIER_UTEST_EXE) $(GTEST_FLAGS)
  61. clean:
  62. rm -f $(VERIFIER_OBJ) \
  63. $(VERIFIER_LIB) \
  64. $(VERIFIER_UTEST_OBJ) \
  65. $(VERIFIER_UTEST_EXE) \
  66. *.xml