Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. include ../../../../Scripts/Makefile.configs
  2. include Makefile.am
  3. ias_cert_url ?= https://certificates.trustedservices.intel.com/Intel_SGX_Attestation_RootCA.pem
  4. ias_cert_sha256 ?= e7b9113b647bc6bd421d4f140076a3acc31e410e01bf12883841e824cdaf1564
  5. ias_cert_file = quote/$(notdir $(ias_cert_url))
  6. CFLAGS += -I. -Iinclude -I../.. -I../../../include -I../../../include/pal \
  7. -I../../../lib/crypto/mbedtls/include -I../../../include/host/Linux-SGX \
  8. -I../../../include/host/Linux-common \
  9. -I../../../include/lib -Isgx-driver
  10. ASFLAGS += -I. -I../.. -I../../../include
  11. host_files = libpal-Linux-SGX.a pal-sgx debugger/sgx_gdb.so pal.map generated_offsets.py
  12. defs = -DIN_PAL -DPAL_DIR=$(PAL_DIR) -DRUNTIME_DIR=$(RUNTIME_DIR)
  13. CFLAGS += $(defs)
  14. ASFLAGS += $(defs)
  15. commons_objs = bogomips.o
  16. enclave-objs = \
  17. db_devices.o \
  18. db_eventfd.o \
  19. db_events.o \
  20. db_exception.o \
  21. db_files.o \
  22. db_main.o \
  23. db_memory.o \
  24. db_misc.o \
  25. db_mutex.o \
  26. db_object.o \
  27. db_pipes.o \
  28. db_process.o \
  29. db_rtld.o \
  30. db_sockets.o \
  31. db_streams.o \
  32. db_threading.o \
  33. enclave_ecalls.o \
  34. enclave_framework.o \
  35. enclave_ocalls.o \
  36. enclave_pages.o \
  37. enclave_platform.o \
  38. enclave_untrusted.o \
  39. enclave_xstate.o \
  40. $(commons_objs)
  41. enclave-asm-objs = enclave_entry.o
  42. urts-objs = \
  43. clone-x86_64.o \
  44. sgx_enclave.o \
  45. sgx_exception.o \
  46. sgx_framework.o \
  47. sgx_graphene.o \
  48. sgx_main.o \
  49. sgx_platform.o \
  50. sgx_process.o \
  51. sgx_rtld.o \
  52. sgx_thread.o \
  53. quote/aesm.pb-c.o
  54. urts-asm-objs = sgx_entry.o
  55. graphene_lib = .lib/graphene-lib.a
  56. .PHONY: all
  57. all: sgx-driver/sgx.h $(host_files)
  58. libpal-Linux-SGX.a: $(enclave-objs) $(enclave-asm-objs)
  59. $(call cmd,ar_a_o)
  60. $(enclave-objs): CFLAGS += -DIN_ENCLAVE
  61. $(patsubst %.o,%.i,$(enclave-objs)): CFLAGS += -DIN_ENCLAVE
  62. $(patsubst %.o,%.s,$(enclave-objs)): CFLAGS += -DIN_ENCLAVE
  63. $(enclave-asm-objs): ASFLAGS += -DIN_ENCLAVE
  64. $(patsubst %.o,%.s,$(enclave-asm-objs)): ASFLAGS += -DIN_ENCLAVE
  65. $(urts-objs): quote/aesm.pb-c.h
  66. $(enclave-objs): quote/generated-cacert.h
  67. $(commons_objs): %.o: ../Linux-common/%.c
  68. $(call cmd,cc_o_c)
  69. %.o: %.c
  70. $(call cmd,cc_o_c)
  71. %.i: %.c
  72. $(call cmd,cpp_i_c)
  73. %.s: %.c
  74. $(call cmd,cc_s_c)
  75. %.o: %.S
  76. $(call cmd,as_o_S)
  77. %.s: %.S
  78. $(call cmd,cpp_s_S)
  79. CFLAGS-pal-sgx = -Wl,-z,relro,-z,now -pie
  80. LDLIBS-pal-sgx += -lprotobuf-c
  81. pal-sgx: $(urts-objs) $(urts-asm-objs) $(graphene_lib)
  82. $(call cmd,cmulti)
  83. quote/aesm.pb-c.o: quote/aesm.pb-c.c quote/aesm.pb-c.h
  84. quote/aesm.pb-c.c quote/aesm.pb-c.h: quote/aesm.proto
  85. @echo [ host/Linux-SGX/quote/aesm.pb-c.c ]
  86. @echo [ host/Linux-SGX/quote/aesm.pb-c.h ]
  87. @protoc-c --c_out=. $<
  88. quote/generated-cacert.h: $(ias_cert_file)
  89. @echo "#define IAS_CA_CERT \"$(shell cat $< | tr -d '[\r\n]')\"" > $@
  90. $(ias_cert_file):
  91. @../../../../Scripts/download --output $@ --url $(ias_cert_url) --sha256 $(ias_cert_sha256)
  92. debugger/sgx_gdb.so: CFLAGS =
  93. CFLAGS-debugger/sgx_gdb.so = -shared -Wall -fPIC -O2 -std=c11
  94. debugger/sgx_gdb.so: debugger/sgx_gdb.c
  95. $(call cmd,csingle)
  96. enclave_entry.o sgx_entry.o: asm-offsets.h
  97. sgx-driver/sgx.h:
  98. $(MAKE) -C sgx-driver $(notdir $@)
  99. ifeq ($(filter %clean,$(MAKECMDGOALS)),)
  100. include $(wildcard *.d) $(wildcard debugger/*.d)
  101. endif
  102. include ../../../../Scripts/Makefile.rules
  103. CLEAN_FILES += $(notdir $(pal_static) $(pal_lib) $(pal_loader))
  104. CLEAN_FILES += debugger/sgx_gdb.so
  105. CLEAN_FILES += quote/aesm.pb-c.c quote/aesm.pb-c.h quote/aesm.pb-c.d quote/aesm.pb-c.o
  106. CLEAN_FILES += quote/generated-cacert.h
  107. .PHONY: clean_
  108. clean_:
  109. $(RM) -r *.o *.e *.i *.s $(host_files) $(CLEAN_FILES) *.d debugger/*.d signer/*.pyc __pycache__ \
  110. signer/__pycache__
  111. .PHONY: clean
  112. clean: clean_
  113. $(MAKE) -C sgx-driver $@
  114. .PHONY: distclean
  115. distclean: clean_
  116. $(RM) $(ias_cert_file)
  117. $(MAKE) -C sgx-driver $@
  118. .PHONY: test
  119. test: