Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #
  2. # Copyright (C) 2011-2016 Intel Corporation. All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. #
  8. # * Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. # * Redistributions in binary form must reproduce the above copyright
  11. # notice, this list of conditions and the following disclaimer in
  12. # the documentation and/or other materials provided with the
  13. # distribution.
  14. # * Neither the name of Intel Corporation nor the names of its
  15. # contributors may be used to endorse or promote products derived
  16. # from this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. #
  30. #
  31. include ../../../buildenv.mk
  32. ifndef DEBUG
  33. CXXFLAGS += -DDISABLE_TRACE
  34. CFLAGS += -DDISABLE_TRACE
  35. endif
  36. CXXFLAGS += -fPIC -Werror
  37. CXXFLAGS += $(ADDED_INC)
  38. CFLAGS += -fPIC -Werror
  39. CFLAGS += $(ADDED_INC)
  40. VTUNE_DIR = $(LINUX_EXTERNAL_DIR)/vtune/linux
  41. INC += -I$(COMMON_DIR)/inc \
  42. -I$(COMMON_DIR)/inc/internal \
  43. -I$(COMMON_DIR)/inc/internal/linux \
  44. -I$(LINUX_PSW_DIR)/urts/ \
  45. -I$(LINUX_PSW_DIR)/urts/linux \
  46. -I$(LINUX_PSW_DIR)/urts/parser \
  47. -I$(VTUNE_DIR)/include \
  48. -I$(VTUNE_DIR)/sdk/src/ittnotify
  49. LDFLAGS := -lwrapper
  50. LDFLAGS += -Wl,-Bdynamic -lsgx_uae_service
  51. LDFLAGS += -L$(VTUNE_DIR)/sdk/src/ittnotify -littnotify -ldl
  52. DIR1 := $(LINUX_PSW_DIR)/urts/linux
  53. DIR2 := $(LINUX_PSW_DIR)/urts
  54. DIR3 := $(LINUX_PSW_DIR)/urts/parser
  55. DIR4 := $(LINUX_PSW_DIR)/urts/parser/linux
  56. LIB += -L$(COMMON_DIR)/se_wrapper \
  57. -L$(BUILD_DIR)
  58. OBJ1 := loader.o \
  59. node.o \
  60. se_detect.o \
  61. enclave.o \
  62. tcs.o \
  63. enclave_mutex.o \
  64. routine.o \
  65. urts_xsave.o \
  66. se_ocalls.o \
  67. cpu_features.o \
  68. launch_checker.o \
  69. urts_version.o \
  70. enclave_creator_hw_com.o
  71. OBJ2 := urts.o \
  72. enclave_creator_hw.o \
  73. misc.o \
  74. sig_handler.o \
  75. debugger_support.o \
  76. get_thread_id.o \
  77. prd_css_util.o
  78. OBJ3 := enter_enclave.o
  79. OBJ4 := section.o \
  80. elfparser.o
  81. OBJ5 := urts_internal.o
  82. CPP_OBJ := $(OBJ1) $(OBJ2) $(OBJ4) $(OBJ5)
  83. URTS_OBJ := $(OBJ3) $(OBJ1) $(OBJ2) $(OBJ4)
  84. INTERNAL_OBJ := $(OBJ3) $(CPP_OBJ)
  85. vpath %.cpp $(DIR1):$(DIR2):$(DIR3):$(DIR4)
  86. LIBWRAPPER := libwrapper.a
  87. LIBURTS := libsgx_urts.so
  88. LIBURTS_INTERNAL := liburts_internal.a
  89. .PHONY: all
  90. all: $(LIBWRAPPER) uae_service ittnotify $(LIBURTS) $(LIBURTS_INTERNAL) | $(BUILD_DIR)
  91. @$(CP) $(LIBURTS) $|
  92. @$(CP) $(LIBURTS_INTERNAL) $|
  93. $(LIBURTS_INTERNAL): $(INTERNAL_OBJ)
  94. $(CP) $(COMMON_DIR)/se_wrapper/libwrapper.a $@
  95. $(AR) rcs $@ $^
  96. $(LIBURTS): $(URTS_OBJ)
  97. $(CXX) $(CXXFLAGS) -shared -Wl,-soname=$@ $(LIB) -o $@ $^ $(LDFLAGS)
  98. $(CPP_OBJ): %.o: %.cpp
  99. $(CXX) -c $(CXXFLAGS) $(INC) $< -o $@
  100. $(OBJ3): %.o: %.S
  101. $(CC) -c $(CFLAGS) $(INC) $< -o $@
  102. $(LIBWRAPPER):
  103. $(MAKE) -C $(COMMON_DIR)/se_wrapper/
  104. .PHONY:uae_service
  105. uae_service:
  106. $(MAKE) -C $(LINUX_PSW_DIR)/uae_service/linux
  107. .PHONY: ittnotify
  108. ittnotify:
  109. $(MAKE) -C $(VTUNE_DIR)/sdk/src/ittnotify
  110. $(BUILD_DIR):
  111. @$(MKDIR) $@
  112. .PHONY: clean
  113. clean::
  114. @$(RM) *.o $(LIBURTS) $(LIBURTS_INTERNAL)
  115. @$(RM) $(BUILD_DIR)/$(LIBURTS) $(BUILD_DIR)/$(LIBURTS_INTERNAL)
  116. $(MAKE) -C $(COMMON_DIR)/se_wrapper/ clean
  117. $(MAKE) -C $(LINUX_PSW_DIR)/uae_service/linux/ clean
  118. $(MAKE) -C $(VTUNE_DIR)/sdk/src/ittnotify clean