Makefile 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 -shared -O2
  6. #all_non_sgx_cpp := $(filter-out((wildcard *.cpp), $(sgx_cpp))) #main.cpp ipc.cpp SealerWrapper.cpp ProtobufLAMessages.cpp ProtobufSealerMessages.cpp
  7. all_non_sgx_obj := $(system_obj) $(protobuf_obj) #$(patsubst %.cpp,%.o,$(all_non_sgx_cpp)}
  8. #main_system_and_wrapper_cpp = $(filter-out(wildcard *.cpp, $(sgx_cpp) $(protobuf_cpp) $(protobuf_sgx_cpp)))
  9. #sgx_cpp = $(wildcard Sgx*)
  10. all_non_sgx_cpp := $(patsubst %.o,%.cpp,$(all_non_sgx_obj))
  11. sgx_protobuf_obj := $(patsubst %.cpp,%.o,$(wildcard SgxProtobuf*))
  12. sgx_obj := $(patsubst %.cpp,%.o,$(wildcard Sgx*))
  13. #sgx_only_obj := $(filter-out($(sgx_obj), $(sgx_protobuf_obj)))
  14. protobuf_obj := $(patsubst %.cpp,%.o,$(wildcard Protobuf*))
  15. system_obj := $(patsubst %.cpp,%.o,$(wildcard system*))
  16. OBJECTS := systemMain.o systemIpc.o systemSealerWrapper.o SgxCrypto.o SgxSealer.o SgxLAInitiator.o ${sgx_protobuf_obj} ${protobuf_obj} #$(system_obj) $(sgx_only_obj) $(sgx_protobuf_obj) $(protobuf_obj)
  17. SGX_SDK ?= /opt/intel/sgxsdk#/home/m2mazmud/sgx2.1_installation/sgxsdk
  18. SGX_COMMON_CFLAGS := -m64
  19. SGX_LIBRARY_PATH := $(SGX_SDK)/lib64
  20. Trts_Library_Name := sgx_trts
  21. Service_Library_Name := sgx_tservice
  22. Crypto_Library_Name := sgx_tcrypto
  23. SGX_INCLUDE_PATHS := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx
  24. Uae_Library_Name := sgx_uae_service
  25. all: verifier ${OBJECTS}
  26. #${RESULT}: ${OBJECTS} ${LocalAttestationCode_objects} ${LocalAttestationCode_ipc_objects} ${LocalAttestationCode_serialization_objects}
  27. # $(LD) $(LD_FLAGS) -o $@ $^ -Wl,--no-undefined -lphpcpp -lprotobuf -L./ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive -L$(SGX_LIBRARY_PATH) -l$(Service_Library_Name) -l$(Crypto_Library_Name) -lsgx_tstdc -Wl,-Bsymbolic -Wl,-pie,-eenclave_entry -Wl,--export-dynamic -Wl,--defsym,__ImageBase=0 -Wl,--gc-sections
  28. clean:
  29. ${RM} *.obj *~* ${OBJECTS} verifier #${LocalAttestationCode_objects} ${LocalAttestationCode_ipc_objects} ${LocalAttestationCode_serialization_objects}
  30. #SgxLAInititator.o and SgxSealer.o
  31. #SgxLAInititator.o: SgxLAInititator.cpp
  32. # ${CXX} -I./include -I$(SGX_SDK)/include ${CXX_FLAGS} -c $^ -o $@ #TODO: Else try sgx_include_paths
  33. #SgxSealer.o: SgxSealer.cpp
  34. # ${CXX} -I./include -I$(SGX_SDK)/include ${CXX_FLAGS} -c $^ -o $@
  35. #ProtobufSgxLATransforms_Inititator.o and ProtobufSgxSealerTransforms.o
  36. #ProtobufSgxLATransforms_Inititator.o: ProtobufSgxLATransforms_Inititator.cpp
  37. # ${CXX} -I./include -I$(SGX_SDK)/include ${CXX_FLAGS} -c $^ -o $@
  38. #ProtobufSgxSealerTransforms.o: ProtobufSgxSealerTransforms.cpp
  39. # ${CXX} -I./include -I$(SGX_SDK)/include ${CXX_FLAGS} -c $^ -o $@
  40. Sgx%.o: Sgx%.cpp
  41. ${CXX} -I./include -I$(SGX_SDK)/include ${CXX_FLAGS} -c $^ -o $@
  42. #SgxSealer.o: SgxSealer.cpp
  43. # ${CXX} -I./include -I$(SGX_SDK)/include ${CXX_FLAGS} -c $^ -o $@
  44. #SgxLAInititator.o: SgxLAInititator
  45. #$(all_non_sgx_obj): $(all_non_sgx_cpp)
  46. # ${CXX} -I./include ${CXX_FLAGS} -c $^ -o $@
  47. Protobuf%.o: Protobuf%.cpp
  48. ${CXX} -I./include ${CXX_FLAGS} -c $^ -o $@
  49. system%.o: system%.cpp
  50. gcc -I./include ${CXX_FLAGS} -c $^ -o $@
  51. #system%.o: system%.s
  52. # gcc ${CXX_FLAGS} -o $@ $^
  53. verifier: systemMain.o systemIpc.o systemSealerWrapper.o SgxSealer.o SgxLAInitiator.o ${sgx_protobuf_obj} ${protobuf_obj}
  54. # echo $(system_obj)
  55. ${CXX} ${CXX_FLAGS} -Wl,--no-undefined systemMain.o systemIpc.o systemSealerWrapper.o SgxSealer.o SgxLAInitiator.o ${sgx_protobuf_obj} -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 ${protobuf_obj} -lprotobuf -Wl,--verbose -o $@