Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/make -f
  2. #define path variables
  3. IPP_INCLUDE_DIR = ../../ext/ipp/sources/ippcp/src
  4. GTEST_INCLUDE_DIR = ../../ext
  5. LIB_INSTALL_DIR = $(epidinstalldir)/lib/posix-$(ARCH)/
  6. TEST_INSTALL_DIR = $(epidinstalldir)/test/
  7. HEADERS_INSTALL_DIR := $(epidinstalldir)/include/epid/common/
  8. HEADERS_11_INSTALL_DIR := $(epidinstalldir)/include/epid/common/1.1
  9. API_HEADERS_INSTALL = $(wildcard ./*.h)
  10. API_11_HEADERS_INSTALL = $(wildcard ./1.1/*.h)
  11. COMMON_INCLUDE_DIR = ../../
  12. COMMON_MATH_INCLUDE_DIR = ./math
  13. COMMON_SRC = $(wildcard ./src/*.c)
  14. COMMON_SRC += $(wildcard ./math/src/*.c)
  15. COMMON_SRC += $(wildcard ./1.1/src/*.c)
  16. COMMON_OBJ = $(sort $(COMMON_SRC:.c=.o))
  17. COMMON_LIB = ./libcommon.a
  18. COMMON_UTEST_EXE = ./common-utest
  19. COMMON_UTEST_SRC = $(wildcard ./math/unittests/*.cc)
  20. COMMON_UTEST_SRC += $(wildcard ./unittests/*.cc)
  21. COMMON_UTEST_SRC += $(wildcard ./1.1/unittests/*.cc)
  22. COMMON_UTEST_OBJ = $(sort $(COMMON_UTEST_SRC:.cc=.o))
  23. LIB_COMMON_DIR = .
  24. LIB_COMMON_TESTHELPER_DIR = ../common-testhelper
  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_COMMON_DIR) -L$(LIB_IPPCPEPID_DIR) -L$(LIB_IPPCP_DIR) \
  30. -lgtest -lcommon-testhelper -lcommon -lippcpepid -lippcp
  31. #target part
  32. $(COMMON_OBJ): %.o: %.c
  33. $(CC) $(CFLAGS) -I$(IPP_INCLUDE_DIR) -I$(COMMON_MATH_INCLUDE_DIR) -I$(COMMON_INCLUDE_DIR) -c $^ -o $@
  34. $(COMMON_LIB): $(COMMON_OBJ)
  35. $(AR) rc $(COMMON_LIB) $(COMMON_OBJ)
  36. ranlib $(COMMON_LIB)
  37. $(COMMON_UTEST_EXE): $(COMMON_UTEST_OBJ)
  38. $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
  39. $(COMMON_UTEST_OBJ): %.o: %.cc
  40. $(CXX) -o $@ $(CXXFLAGS) -I$(COMMON_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
  41. build: all
  42. all: $(COMMON_LIB)
  43. install:
  44. mkdir -p '$(LIB_INSTALL_DIR)'
  45. mkdir -p '$(HEADERS_INSTALL_DIR)'
  46. mkdir -p '$(HEADERS_11_INSTALL_DIR)'
  47. cp $(COMMON_LIB) '$(LIB_INSTALL_DIR)'
  48. cp $(API_HEADERS_INSTALL) '$(HEADERS_INSTALL_DIR)'
  49. cp $(API_11_HEADERS_INSTALL) '$(HEADERS_11_INSTALL_DIR)'
  50. #install tests if they exist
  51. ifneq (,$(wildcard $(COMMON_UTEST_EXE)))
  52. mkdir -p '$(TEST_INSTALL_DIR)'
  53. cp $(COMMON_UTEST_EXE) '$(TEST_INSTALL_DIR)'
  54. endif
  55. check: $(COMMON_UTEST_EXE) run
  56. run:
  57. $(COMMON_UTEST_EXE) $(GTEST_FLAGS)
  58. clean:
  59. rm -f $(COMMON_OBJ) \
  60. $(COMMON_LIB) \
  61. $(COMMON_UTEST_OBJ) \
  62. $(COMMON_UTEST_EXE) \
  63. *.xml