1#!/usr/bin/make -f 2 3#define path variables 4IPP_INCLUDE_DIR = ../../ext/ipp/sources/ippcp/src 5GTEST_INCLUDE_DIR = ../../ext 6 7LIB_INSTALL_DIR = $(epidinstalldir)/lib/posix-$(ARCH)/ 8TEST_INSTALL_DIR = $(epidinstalldir)/test/ 9HEADERS_INSTALL_DIR := $(epidinstalldir)/include/epid/common/ 10HEADERS_11_INSTALL_DIR := $(epidinstalldir)/include/epid/common/1.1 11 12API_HEADERS_INSTALL = $(wildcard ./*.h) 13 14API_11_HEADERS_INSTALL = $(wildcard ./1.1/*.h) 15 16COMMON_INCLUDE_DIR = ../../ 17COMMON_MATH_INCLUDE_DIR = ./math 18COMMON_SRC = $(wildcard ./src/*.c) 19COMMON_SRC += $(wildcard ./math/src/*.c) 20COMMON_SRC += $(wildcard ./1.1/src/*.c) 21COMMON_OBJ = $(COMMON_SRC:.c=.o) 22COMMON_LIB = ./libcommon.a 23 24COMMON_UTEST_EXE = ./common-utest$(EXE_EXTENSION) 25COMMON_UTEST_SRC = $(wildcard ./math/unittests/*.cc) 26COMMON_UTEST_SRC += $(wildcard ./unittests/*.cc) 27COMMON_UTEST_SRC += $(wildcard ./1.1/unittests/*.cc) 28COMMON_UTEST_OBJ = $(COMMON_UTEST_SRC:.cc=.o) 29LIB_COMMON_DIR = . 30LIB_COMMON_TESTHELPER_DIR = ../common-testhelper 31LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src 32 33#set flags for linker 34LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \ 35 -L$(LIB_COMMON_DIR) -L$(LIB_IPPCP_DIR) \ 36 -lgtest -lcommon-testhelper -lcommon -lippcp 37 38#target part 39$(COMMON_OBJ): %.o: %.c 40 $(CC) $(CFLAGS) -I$(IPP_INCLUDE_DIR) -I$(COMMON_MATH_INCLUDE_DIR) -I$(COMMON_INCLUDE_DIR) -c $^ -o $@ 41 42$(COMMON_LIB): $(COMMON_OBJ) 43 $(AR) rc $(COMMON_LIB) $(COMMON_OBJ) 44 $(RANLIB) $(COMMON_LIB) 45 46$(COMMON_UTEST_EXE): $(COMMON_UTEST_OBJ) 47 $(CXX) -o $@ $^ $(LDFLAGS) 48 49$(COMMON_UTEST_OBJ): %.o: %.cc 50 $(CXX) -o $@ $(CXXFLAGS) $(GTEST_DEFINES) -I$(COMMON_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^ 51 52build: all 53 54all: $(COMMON_LIB) 55 56install: 57 mkdir -p '$(LIB_INSTALL_DIR)' 58 mkdir -p '$(HEADERS_INSTALL_DIR)' 59 mkdir -p '$(HEADERS_11_INSTALL_DIR)' 60 cp $(COMMON_LIB) '$(LIB_INSTALL_DIR)' 61 cp $(API_HEADERS_INSTALL) '$(HEADERS_INSTALL_DIR)' 62 cp $(API_11_HEADERS_INSTALL) '$(HEADERS_11_INSTALL_DIR)' 63#install tests if they exist 64ifneq (,$(wildcard $(COMMON_UTEST_EXE))) 65 mkdir -p '$(TEST_INSTALL_DIR)' 66 cp $(COMMON_UTEST_EXE) '$(TEST_INSTALL_DIR)' 67endif 68 69utest: $(COMMON_UTEST_EXE) 70 71run_utest: 72 $(COMMON_UTEST_EXE) $(GTEST_FLAGS) 73 74check: utest run_utest 75 76clean: 77 rm -f $(COMMON_OBJ) \ 78 $(COMMON_LIB) \ 79 $(COMMON_UTEST_OBJ) \ 80 $(COMMON_UTEST_EXE) \ 81 *.xml 82