123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- parent-dir = $(patsubst %/,%,$(dir $(1:%/=%)))
- my-dir = $(realpath $(call parent-dir,$(lastword $(MAKEFILE_LIST))))
- ROOT_DIR := $(call my-dir)
- COMMON_DIR := $(ROOT_DIR)/common
- LINUX_EXTERNAL_DIR := $(ROOT_DIR)/external
- LINUX_PSW_DIR := $(ROOT_DIR)/psw
- LINUX_SDK_DIR := $(ROOT_DIR)/sdk
- LINUX_UNITTESTS := $(ROOT_DIR)/unittests
- CP := /bin/cp -f
- MKDIR := mkdir -p
- STRIP := strip
- OBJCOPY := objcopy
- INCLUDE :=
- CUR_DIR := $(realpath $(call parent-dir,$(lastword $(wordlist 2,$(words $(MAKEFILE_LIST)),x $(MAKEFILE_LIST)))))
- CC_BELOW_4_9 := $(shell expr "`$(CC) -dumpversion`" \< "4.9")
- ifeq ($(CC_BELOW_4_9), 1)
- COMMON_FLAGS += -fstack-protector
- else
- COMMON_FLAGS += -fstack-protector-strong
- endif
- ifdef DEBUG
- COMMON_FLAGS += -ggdb -DDEBUG -UNDEBUG
- COMMON_FLAGS += -DSE_DEBUG_LEVEL=SE_TRACE_DEBUG
- else
- COMMON_FLAGS += -O2 -UDEBUG -DNDEBUG
- endif
- ifdef SE_SIM
- COMMON_FLAGS += -DSE_SIM
- endif
- COMMON_FLAGS += -ffunction-sections -fdata-sections
- COMMON_FLAGS += -Wall -Wextra -Winit-self -Wpointer-arith -Wreturn-type \
- -Waddress -Wsequence-point -Wformat-security \
- -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow \
- -Wcast-align -Wconversion -Wredundant-decls
- CFLAGS += -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants
- CXXFLAGS += -Wnon-virtual-dtor
- CXXFLAGS += -std=c++0x
- .DEFAULT_GOAL := all
- % : RCS/%,v
- % : RCS/%
- % : %,v
- % : s.%
- % : SCCS/s.%
- .DELETE_ON_ERROR:
- HOST_FILE_PROGRAM := file
- UNAME := $(shell uname -m)
- ifneq (,$(findstring 86,$(UNAME)))
- HOST_ARCH := x86
- ifneq (,$(shell $(HOST_FILE_PROGRAM) -L $(SHELL) | grep 'x86[_-]64'))
- HOST_ARCH := x86_64
- endif
- else
- $(info Unknown host CPU arhitecture $(UNAME))
- $(error Aborting)
- endif
- BUILD_DIR := $(ROOT_DIR)/build/linux
- ifeq "$(findstring __INTEL_COMPILER, $(shell $(CC) -E -dM -xc /dev/null))" "__INTEL_COMPILER"
- ifeq ($(shell test -f /usr/bin/dpkg; echo $$?), 0)
- ADDED_INC := -I /usr/include/$(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)
- endif
- endif
- ARCH := $(HOST_ARCH)
- ifeq "$(findstring -m32, $(CXXFLAGS))" "-m32"
- ARCH := x86
- endif
- ifeq ($(ARCH), x86)
- COMMON_FLAGS += -DITT_ARCH_IA32
- else
- COMMON_FLAGS += -DITT_ARCH_IA64
- endif
- CFLAGS += $(COMMON_FLAGS)
- CXXFLAGS += $(COMMON_FLAGS)
- ENCLAVE_CFLAGS = -ffreestanding -nostdinc -fvisibility=hidden -fpie
- ENCLAVE_CXXFLAGS = $(ENCLAVE_CFLAGS) -nostdinc++
- ENCLAVE_LDFLAGS = -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \
- -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \
- -Wl,--defsym,__ImageBase=0
- USE_OPT_LIBS ?= 1
- ifeq ($(ARCH), x86_64)
- IPP_SUBDIR = intel64
- else
- IPP_SUBDIR = ia32
- endif
- ifneq ($(USE_OPT_LIBS), 0)
- SGX_IPP_DIR := $(ROOT_DIR)/external/ippcp_internal
- SGX_IPP_INC := $(SGX_IPP_DIR)/inc
- IPP_LIBS_DIR := $(SGX_IPP_DIR)/lib/linux/$(IPP_SUBDIR)
- LD_IPP := -lippcp -lippcore
- else
- SGX_IPP_DIR := $(ROOT_DIR)/external/crypto_px
- SGX_IPP_INC := $(SGX_IPP_DIR)/include
- IPP_LIBS_DIR := $(SGX_IPP_DIR)
- LD_IPP := -lcrypto_px
- endif
|