Files
intel-linux-sgx/sdk/Makefile.source
Zhang Lili 4d78a1a6cf Rebase to 2.13 & bug fix.
Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
2021-02-07 15:17:02 +00:00

297 lines
9.9 KiB
Makefile

#
# Copyright (C) 2011-2020 Intel Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# This Makefile will compile SDK to generate various components
# including:
# - Trusted libraries
# - tstdc: libsgx_tstdc.a
# - tcxx: libsgx_tcxx.a
# - tservice: libsgx_tservice.a
# - trts: libsgx_trts.a
# - tcrypto: libsgx_tcrypto.a
# - tkey_exchange: libsgx_tkey_exchange.a
# - tprotected_fs: libsgx_tprotected_fs.a
# - tcmalloc: libsgx_tcmalloc.a
# - sgx_pcl: libsgx_pcl.a
# - openmp: libsgx_omp.a
# - Untrtusted libraries
# - ukey_exchange: libsgx_ukey_exchange.a
# - uprotected_fs: libsgx_uprotected_fs.a
# - ptrace: libsgx_ptrace.so, gdb-sgx-plugin
# - sample_crypto: libsample_crypto.so (for sample code use)
# - Standalone, untrusted libraries
# - libcapable: libsgx_capable.a libsgx_capable.so
# - Tools
# - signtool: sgx_sign
# - edger8r: sgx_edger8r
# - sgx_encrypt: sgx_encrypt
# - Simulation libraries and tools
# - simulation: libsgx_trts_sim.a, libsgx_tservice_sim.a, libsgx_urts_sim.so, libsgx_uae_service_sim.so, sgx_config_cpusvn
#
LIBTLIBC := $(BUILD_DIR)/libsgx_tstdc.a
LIBTCXX := $(BUILD_DIR)/libsgx_tcxx.a
LIBTSE := $(BUILD_DIR)/libsgx_tservice.a
.PHONY: components
components: tstdc tcxx tservice trts tcrypto tkey_exchange ukey_exchange tprotected_fs uprotected_fs ptrace sample_crypto libcapable simulation signtool edger8r tcmalloc sgx_pcl sgx_encrypt sgx_tswitchless sgx_uswitchless pthread openmp
# ---------------------------------------------------
# tstdc
# includes: tlibc, tlibthread, compiler-rt, tsafecrt
# ---------------------------------------------------
.PHONY: tstdc
tstdc: $(LIBTLIBC)
$(LIBTLIBC): tlibthread compiler-rt tsafecrt tsetjmp tmm_rsrv
$(MAKE) -C tlibc/ -j4 2> /dev/null
@$(MKDIR) $(BUILD_DIR)/.compiler-rt $(BUILD_DIR)/.tlibthread $(BUILD_DIR)/.tsafecrt $(BUILD_DIR)/.tsetjmp $(BUILD_DIR)/.tmm_rsrv
@$(RM) -f $(BUILD_DIR)/.compiler-rt/* && cd $(BUILD_DIR)/.compiler-rt && $(AR) x $(LINUX_SDK_DIR)/compiler-rt/libcompiler-rt.a
@$(RM) -f $(BUILD_DIR)/.tlibthread/* && cd $(BUILD_DIR)/.tlibthread && $(AR) x $(LINUX_SDK_DIR)/tlibthread/libtlibthread.a
@$(RM) -f $(BUILD_DIR)/.tsafecrt/* && cd $(BUILD_DIR)/.tsafecrt && $(AR) x $(LINUX_SDK_DIR)/tsafecrt/libsgx_tsafecrt.a
@$(RM) -f $(BUILD_DIR)/.tsetjmp/*.o && cd $(BUILD_DIR)/.tsetjmp && $(AR) x $(LINUX_SDK_DIR)/tsetjmp/libsgx_tsetjmp.a
@$(RM) -f $(BUILD_DIR)/.tmm_rsrv/*.o && cd $(BUILD_DIR)/.tmm_rsrv && $(AR) x $(LINUX_SDK_DIR)/tmm_rsrv/libsgx_tmm_rsrv.a
$(CP) $(LINUX_SDK_DIR)/tlibc/libtlibc.a $@
$(AR) qD $@ $(BUILD_DIR)/.compiler-rt/*.o
$(AR) qD $@ $(BUILD_DIR)/.tlibthread/*.o
$(AR) qD $@ $(BUILD_DIR)/.tsafecrt/*.o
$(AR) qD $@ $(BUILD_DIR)/.tsetjmp/*.o
$(AR) qD $@ $(BUILD_DIR)/.tmm_rsrv/*.o
@$(RM) -rf $(BUILD_DIR)/.compiler-rt
@$(RM) -rf $(BUILD_DIR)/.tlibthread $(BUILD_DIR)/.tsafecrt
@$(RM) -rf $(BUILD_DIR)/.tsetjmp $(BUILD_DIR)/.tmm_rsrv
.PHONY: tlibthread
tlibthread:
$(MAKE) -C tlibthread/
.PHONY: tsafecrt
tsafecrt:
$(MAKE) -C tsafecrt/
.PHONY: compiler-rt
compiler-rt:
$(MAKE) -C compiler-rt/ 2> /dev/null
.PHONY: tsetjmp
tsetjmp:
$(MAKE) -C tsetjmp/
.PHONY: tmm_rsrv
tmm_rsrv:
$(MAKE) -C tmm_rsrv/
# ---------------------------------------------------
# pthread
# includes: pthread
# ---------------------------------------------------
.PHONY: pthread
pthread: edger8r
$(MAKE) -C pthread/
# ---------------------------------------------------
# tcxx
# includes: cpprt, tlibcxx
# ---------------------------------------------------
.PHONY: tcxx
tcxx: $(LIBTCXX)
$(LIBTCXX): cpprt tlibcxx
@$(MKDIR) $(BUILD_DIR)/.tlibcxx
@$(RM) -f $(BUILD_DIR)/.tlibcxx/*
@cd $(BUILD_DIR)/.tlibcxx && $(AR) x $(LINUX_SDK_DIR)/tlibcxx/libcxx.a
$(CP) $(LINUX_SDK_DIR)/cpprt/libcpprt.a $@
$(AR) qD $@ $(BUILD_DIR)/.tlibcxx/*.o
@$(RM) -rf $(BUILD_DIR)/.tlibcxx
.PHONY: cpprt
cpprt:
$(MAKE) -C cpprt
.PHONY: tlibcxx
tlibcxx: $(BUILD_DIR)
$(MAKE) -C tlibcxx/ 2> /dev/null
$(CP) tlibcxx/README.sgx $(BUILD_DIR)/libc++_Changes_SGX.txt
# ---------------------------------------------------
# tse
# includes: selib, tseal, ec_dh_lib
# ---------------------------------------------------
.PHONY: tservice
tservice: $(LIBTSE)
$(LIBTSE): selib tseal ec_dh_lib
@$(MKDIR) $(BUILD_DIR)/.tservice
@$(RM) -f $(BUILD_DIR)/.tservice/*
cd $(BUILD_DIR)/.tservice && $(AR) x $(LINUX_SDK_DIR)/tseal/linux/libtSeal.a
cd $(BUILD_DIR)/.tservice && $(AR) x $(LINUX_SDK_DIR)/ec_dh_lib/libsgx_dh.a
$(CP) $(LINUX_SDK_DIR)/selib/linux/libselib.a $@
$(AR) rsD $@ $(BUILD_DIR)/.tservice/*.o
@$(RM) -rf $(BUILD_DIR)/.tservice
.PHONY: selib
selib:
$(MAKE) -C selib/linux/
.PHONY: tseal
tseal:
$(MAKE) -C tseal/linux/
.PHONY: ec_dh_lib
ec_dh_lib:
$(MAKE) -C ec_dh_lib/
# ---------------------------------------------------
# Other trusted libraries
# ---------------------------------------------------
.PHONY: trts
trts:
$(MAKE) -C trts/
.PHONY: tcrypto
tcrypto: edger8r
$(MAKE) -C tlibcrypto/
.PHONY: tkey_exchange
tkey_exchange: edger8r
$(MAKE) -C tkey_exchange
.PHONY: tcmalloc
tcmalloc:
$(MAKE) -C gperftools/
.PHONY: tprotected_fs
tprotected_fs: edger8r
$(MAKE) -C protected_fs/sgx_tprotected_fs
.PHONY: sgx_pcl
sgx_pcl:
$(MAKE) -C protected_code_loader
.PHONY: openmp
openmp:
$(MAKE) -C $(LINUX_EXTERNAL_DIR)/openmp
# ---------------------------------------------------
# Untrusted libraries
# ---------------------------------------------------
.PHONY: ukey_exchange
ukey_exchange:
$(MAKE) -C ukey_exchange
.PHONY: uprotected_fs
uprotected_fs: edger8r
$(MAKE) -C protected_fs/sgx_uprotected_fs
.PHONY: ptrace
ptrace:
$(MAKE) -C debugger_interface/linux/
.PHONY: sample_crypto
sample_crypto:
$(MAKE) -C sample_libcrypto
# ---------------------------------------------------
# standalone, untrusted libraries
# ---------------------------------------------------
.PHONY: libcapable
libcapable:
$(MAKE) -C libcapable/linux/
# ---------------------------------------------------
# Switchless
# ---------------------------------------------------
.PHONY: sgx_tswitchless
sgx_tswitchless: trts tlibc edger8r
$(MAKE) -C switchless/sgx_tswitchless
.PHONY: sgx_uswitchless
sgx_uswitchless: edger8r
$(MAKE) -C switchless/sgx_uswitchless
# ---------------------------------------------------
# simualtion libraries and tools
# ---------------------------------------------------
.PHONY: simulation
simulation: edger8r
$(MAKE) -C simulation/
# ---------------------------------------------------
# tools
# ---------------------------------------------------
.PHONY: signtool
signtool:
$(MAKE) -C sign_tool/SignTool/
.PHONY: edger8r
edger8r:
$(MAKE) -C edger8r/linux/
.PHONY: sgx_encrypt
sgx_encrypt: tservice
$(MAKE) -C encrypt_enclave
$(BUILD_DIR):
$(MKDIR) $@
.PHONY: clean
clean:
$(MAKE) -C tlibc/ clean
$(MAKE) -C tlibthread/ clean
$(MAKE) -C compiler-rt/ clean
$(MAKE) -C cpprt clean
$(MAKE) -C tlibcxx/ clean
$(MAKE) -C tseal/linux/ clean
$(MAKE) -C selib/linux/ clean
$(MAKE) -C trts/ clean
$(MAKE) -C tsetjmp/ clean
$(MAKE) -C tsafecrt/ clean
$(MAKE) -C gperftools/ clean
$(MAKE) -C tlibcrypto/ clean
$(MAKE) -C tkey_exchange/ clean
$(MAKE) -C ukey_exchange/ clean
$(MAKE) -C protected_fs/sgx_tprotected_fs/ clean
$(MAKE) -C protected_fs/sgx_uprotected_fs/ clean
$(MAKE) -C debugger_interface/linux/ clean
$(MAKE) -C sample_libcrypto/ clean
$(MAKE) -C libcapable/linux/ clean
$(MAKE) -C simulation/ clean
$(MAKE) -C sign_tool/SignTool clean
$(MAKE) -C edger8r/linux clean
$(MAKE) -C protected_code_loader clean
$(MAKE) -C encrypt_enclave clean
$(MAKE) -C switchless/sgx_tswitchless clean
$(MAKE) -C switchless/sgx_uswitchless clean
$(MAKE) -C tmm_rsrv/ clean
$(MAKE) -C pthread clean
$(MAKE) -C $(LINUX_EXTERNAL_DIR)/openmp clean
@$(RM) $(LIBTLIBC) $(LIBTCXX) $(LIBTSE)
@$(RM) $(BUILD_DIR)/libc++_Changes_SGX.txt