Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 = $(VERIFIER_SRC:.c=.o)
  17. VERIFIER_LIB = ./libverifier.a
  18. VERIFIER_UTEST_EXE = ./verifier-utest$(EXE_EXTENSION)
  19. VERIFIER_UTEST_SRC = $(wildcard ./unittests/*.cc)
  20. VERIFIER_UTEST_SRC += $(wildcard ./1.1/unittests/*.cc)
  21. VERIFIER_UTEST_OBJ = $(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. #set flags for linker
  27. LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
  28. -L$(LIB_VERIFIER_DIR) -L$(LIB_COMMON_DIR) \
  29. -L$(LIB_IPPCP_DIR) -lgtest -lcommon-testhelper -lverifier -lcommon \
  30. -lippcp
  31. ifneq ($(TSS_PATH),)
  32. CFLAGS += -DTPM_TSS
  33. endif
  34. #target part
  35. $(VERIFIER_OBJ): %.o: %.c
  36. $(CC) $(CFLAGS) -I$(IPP_INCLUDE_DIR) -I$(IPP_SRC_INCLUDE_DIR) \
  37. -I$(VERIFIER_INCLUDE_DIR) -I$(VERIFIER_11_INCLUDE_DIR) -c $^ -o $@
  38. $(VERIFIER_LIB): $(VERIFIER_OBJ)
  39. $(AR) rc $(VERIFIER_LIB) $(VERIFIER_OBJ)
  40. $(RANLIB) $(VERIFIER_LIB)
  41. $(VERIFIER_UTEST_EXE): $(VERIFIER_UTEST_OBJ)
  42. $(CXX) -o $@ $^ $(LDFLAGS)
  43. $(VERIFIER_UTEST_OBJ): %.o: %.cc
  44. $(CXX) -o $@ $(CXXFLAGS) $(GTEST_DEFINES) -I$(VERIFIER_INCLUDE_DIR) \
  45. -I$(VERIFIER_11_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
  46. build: all
  47. all: $(VERIFIER_LIB)
  48. install:
  49. mkdir -p '$(LIB_INSTALL_DIR)'
  50. mkdir -p '$(HEADERS_INSTALL_DIR)'
  51. mkdir -p '$(HEADERS_11_INSTALL_DIR)'
  52. cp $(VERIFIER_LIB) '$(LIB_INSTALL_DIR)'
  53. cp $(API_HEADERS_INSTALL) '$(HEADERS_INSTALL_DIR)'
  54. cp $(API_11_HEADERS_INSTALL) '$(HEADERS_11_INSTALL_DIR)'
  55. #install tests if they exist
  56. ifneq (,$(wildcard $(VERIFIER_UTEST_EXE)))
  57. mkdir -p '$(TEST_INSTALL_DIR)'
  58. cp $(VERIFIER_UTEST_EXE) '$(TEST_INSTALL_DIR)'
  59. endif
  60. utest: $(VERIFIER_UTEST_EXE)
  61. run_utest:
  62. $(VERIFIER_UTEST_EXE) $(GTEST_FLAGS)
  63. check: utest run_utest
  64. clean:
  65. rm -f $(VERIFIER_OBJ) \
  66. $(VERIFIER_LIB) \
  67. $(VERIFIER_UTEST_OBJ) \
  68. $(VERIFIER_UTEST_EXE) \
  69. *.xml