Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/make -f
  2. #define path 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/member/
  9. API_HEADERS_INSTALL = ./api.h
  10. MEMBER_INCLUDE_DIR = ../../
  11. MEMBER_SRC = $(wildcard ./src/*.c)
  12. MEMBER_OBJ = $(sort $(MEMBER_SRC:.c=.o))
  13. MEMBER_LIB = ./libmember.a
  14. MEMBER_UTEST_EXE = ./member-utest
  15. MEMBER_UTEST_SRC = $(wildcard ./unittests/*.cc)
  16. MEMBER_UTEST_OBJ = $(sort $(MEMBER_UTEST_SRC:.cc=.o))
  17. LIB_MEMBER_DIR = .
  18. LIB_VERIFIER_DIR = ../verifier
  19. LIB_COMMON_TESTHELPER_DIR = ../common-testhelper
  20. LIB_COMMON_DIR = ../common
  21. LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src
  22. LIB_IPPCPEPID_DIR = ../../ext/ipp/sources/ippcpepid/src
  23. #set flags for linker
  24. LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
  25. -L$(LIB_MEMBER_DIR) -L$(LIB_VERIFIER_DIR) -L$(LIB_COMMON_DIR) \
  26. -L$(LIB_IPPCPEPID_DIR) -L$(LIB_IPPCP_DIR) -lgtest -lcommon-testhelper \
  27. -lmember -lverifier -lcommon -lippcpepid -lippcp
  28. $(MEMBER_OBJ): %.o: %.c
  29. $(CC) $(CFLAGS) -I$(IPP_INCLUDE_DIR) -I$(IPP_SRC_INCLUDE_DIR) \
  30. -I$(MEMBER_INCLUDE_DIR) -c $^ -o $@
  31. $(MEMBER_LIB): $(MEMBER_OBJ)
  32. $(AR) rc $(MEMBER_LIB) $(MEMBER_OBJ)
  33. ranlib $(MEMBER_LIB)
  34. $(MEMBER_UTEST_EXE): $(MEMBER_UTEST_OBJ)
  35. $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
  36. $(MEMBER_UTEST_OBJ): %.o: %.cc
  37. $(CXX) -o $@ $(CXXFLAGS) -I$(MEMBER_INCLUDE_DIR) \
  38. -I$(GTEST_INCLUDE_DIR) -c $^
  39. build: all
  40. all: $(MEMBER_LIB)
  41. install:
  42. mkdir -p '$(LIB_INSTALL_DIR)'
  43. mkdir -p '$(HEADERS_INSTALL_DIR)'
  44. cp $(MEMBER_LIB) '$(LIB_INSTALL_DIR)'
  45. cp $(API_HEADERS_INSTALL) '$(HEADERS_INSTALL_DIR)'
  46. #install tests if they exist
  47. ifneq (,$(wildcard $(MEMBER_UTEST_EXE)))
  48. mkdir -p '$(TEST_INSTALL_DIR)'
  49. cp $(MEMBER_UTEST_EXE) '$(TEST_INSTALL_DIR)'
  50. endif
  51. check: $(MEMBER_UTEST_EXE) run
  52. run:
  53. $(MEMBER_UTEST_EXE) $(GTEST_FLAGS)
  54. clean:
  55. rm -f $(MEMBER_OBJ) \
  56. $(MEMBER_LIB) \
  57. $(MEMBER_UTEST_OBJ) \
  58. $(MEMBER_UTEST_EXE) \
  59. *.xml