1 #!/usr/bin/make -f 2 3 #define variables 4 IPP_SRC_INCLUDE_DIR = ../../ext/ipp/sources/ippcp/src/ 5 IPP_INCLUDE_DIR = ../../ext/ipp/sources/include/ 6 GTEST_INCLUDE_DIR = ../../ext/ 7 8 LIB_INSTALL_DIR = $(epidinstalldir)/lib/posix-$(ARCH)/ 9 TEST_INSTALL_DIR = $(epidinstalldir)/test/ 10 HEADERS_INSTALL_DIR = $(epidinstalldir)/include/epid/verifier/ 11 HEADERS_11_INSTALL_DIR = $(epidinstalldir)/include/epid/verifier/1.1/ 12 13 API_HEADERS_INSTALL = ./api.h 14 15 API_11_HEADERS_INSTALL = ./1.1/api.h 16 17 VERIFIER_INCLUDE_DIR = ../../ 18 VERIFIER_11_INCLUDE_DIR = ../../1.1 19 20 VERIFIER_SRC = $(wildcard ./src/*.c) 21 VERIFIER_SRC += $(wildcard ./1.1/src/*.c) 22 VERIFIER_OBJ = $(VERIFIER_SRC:.c=.o) 23 VERIFIER_LIB = ./libverifier.a 24 25 VERIFIER_UTEST_EXE = ./verifier-utest$(EXE_EXTENSION) 26 VERIFIER_UTEST_SRC = $(wildcard ./unittests/*.cc) 27 VERIFIER_UTEST_SRC += $(wildcard ./1.1/unittests/*.cc) 28 VERIFIER_UTEST_OBJ = $(VERIFIER_UTEST_SRC:.cc=.o) 29 LIB_VERIFIER_DIR = . 30 LIB_COMMON_TESTHELPER_DIR = ../common-testhelper 31 LIB_COMMON_DIR = ../common 32 LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src 33 34 #set flags for linker 35 LDFLAGS += -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 40 ifneq ($(TSS_PATH),) 41 CFLAGS += -DTPM_TSS 42 endif 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 61 build: all 62 63 all: $(VERIFIER_LIB) 64 65 install: 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 73 ifneq (,$(wildcard $(VERIFIER_UTEST_EXE))) 74 mkdir -p '$(TEST_INSTALL_DIR)' 75 cp $(VERIFIER_UTEST_EXE) '$(TEST_INSTALL_DIR)' 76 endif 77 78 utest: $(VERIFIER_UTEST_EXE) 79 80 run_utest: 81 $(VERIFIER_UTEST_EXE) $(GTEST_FLAGS) 82 83 check: utest run_utest 84 85 clean: 86 rm -f $(VERIFIER_OBJ) \ 87 $(VERIFIER_LIB) \ 88 $(VERIFIER_UTEST_OBJ) \ 89 $(VERIFIER_UTEST_EXE) \ 90 *.xml 91