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