Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. CXX = g++
  2. RM = rm -f
  3. CXX_FLAGS = -Wall -O2 -std=c++11 -fpic -fdata-sections -ffunction-sections
  4. LD = ${CXX} -v
  5. LD_FLAGS = -Wall -O2
  6. all_non_sgx_obj := $(system_obj) $(protobuf_obj) #$(patsubst %.cpp,%.o,$(all_non_sgx_cpp)}
  7. all_non_sgx_cpp := $(patsubst %.o,%.cpp,$(all_non_sgx_obj))
  8. sgx_protobuf_obj := $(patsubst %.cpp,%.o,$(wildcard SgxProtobuf*))
  9. sgx_obj := $(patsubst %.cpp,%.o,$(wildcard Sgx*))
  10. protobuf_obj := $(patsubst %.cpp,%.o,$(wildcard Protobuf*))
  11. system_obj := $(patsubst %.cpp,%.o,$(wildcard system*))
  12. OBJECTS := systemMain.o systemSealerWrapper.o SgxSealer.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o
  13. SGX_SDK := /home/m2mazmud/sgx2.1_installation/sgxsdk
  14. SGX_COMMON_CFLAGS := -m64
  15. SGX_LIBRARY_PATH := $(SGX_SDK)/lib64
  16. Trts_Library_Name := sgx_trts
  17. Service_Library_Name := sgx_tservice
  18. Crypto_Library_Name := sgx_tcrypto
  19. SGX_INCLUDE_PATHS := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx
  20. Openssl_Path := /home/m2mazmud/plain-openssl
  21. Uae_Library_Name := sgx_uae_service
  22. all: verifier ${OBJECTS}
  23. clean:
  24. ${RM} *.obj *~* ${OBJECTS} verifier #${LocalAttestationCode_objects} ${LocalAttestationCode_ipc_objects} ${LocalAttestationCode_serialization_objects}
  25. Sgx%.o: Sgx%.cpp
  26. ${CXX} -I./include -I$(SGX_SDK)/include ${CXX_FLAGS} -c $^ -o $@
  27. Protobuf%.o: Protobuf%.cpp
  28. ${CXX} -I./include ${CXX_FLAGS} -c $^ -o $@
  29. system%.o: system%.cpp
  30. gcc -I./include ${CXX_FLAGS} -c $^ -o $@
  31. crypto.o: crypto.cpp
  32. gcc -I${Openssl_Path}/include ${CXX_FLAGS} -c $^ -o $@
  33. verifier: systemMain.o systemSealerWrapper.o SgxSealer.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o
  34. # echo $(system_obj)
  35. ${CXX} ${CXX_FLAGS} -Wl,--no-undefined -Wl,-rpath,$(SGX_SDK)/lib64 systemMain.o systemSealerWrapper.o SgxSealer.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o -L./ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive -L$(SGX_LIBRARY_PATH) -l$(Service_Library_Name) -l$(Crypto_Library_Name) -l$(Uae_Library_Name) -lsgx_tstdc -lsgx_urts -lprotobuf -lsgx_tstdcxx -L${Openssl_Path}/lib -lssl -lcrypto -Wl,--verbose -o $@