1# Copyright (C) 2022 Huawei Technologies Co., Ltd. 2# Licensed under the Mulan PSL v2. 3# You can use this software according to the terms and conditions of the Mulan PSL v2. 4# You may obtain a copy of Mulan PSL v2 at: 5# http://license.coscl.org.cn/MulanPSL2 6# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 7# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 8# PURPOSE. 9# See the Mulan PSL v2 for more details. 10 11# 12# FILE: project.mk 13# 14 15# ramdisk tools, run on host 16# compile libs rules 17 18include $(BUILD_CONFIG)/arch_config.mk 19libtee_shared_a32: libteeconfig libtimer libteeagentcommon_client libcrypto_hal libswcrypto_engine $(crypto_lib) libteedynsrv libtee_stub 20libtee_shared: libteeconfig libtimer libteeagentcommon_client libcrypto_hal libswcrypto_engine $(crypto_lib) libteedynsrv libtee_stub 21 22libdrv_shared_a32: libteeconfig_a32 23libdrv_shared: libteeconfig 24 25teelib := libcrypto_hal libtimer libagent libagent_base libdrv libteeos libpermission_service \ 26 libswcrypto_engine libtaentry libteeagentcommon_client libcrypto libteeconfig libteemem \ 27 libssa libhuk libteedynsrv libopenssl libipc_hal libtee_stub 28syslib := libelf_verify libspawn_common libelf_verify_key libdynconfmgr libdynconfbuilder 29drvlib := libdrv_frame 30 31libs: libtee_shared $(syslib) libdrv_shared 32 @echo "libsok" 33 34$(teelib): 35 @echo "building teelibs=$@ target" 36 $(if $(findstring false, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(TEELIB)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all) 37 $(if $(findstring true, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(TEELIB)/$@ ARCH=arm TARG=_a32 USE_GNU_CXX=y -f $(PREBUILD_HEADER)/.config -f Makefile all) 38 39$(drvlib): 40 @echo "building drvlibs=$@ target" 41 $(if $(findstring false, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(DRVLIB)/common/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all) 42 $(if $(findstring true, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(DRVLIB)/common/$@ ARCH=arm TARG=_a32 USE_GNU_CXX=y -f $(PREBUILD_HEADER)/.config -f Makefile all) 43 44$(syslib): 45 @echo "bulding syslibs=$@ target" 46 $(if $(findstring false, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(SYSLIB)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all) 47 $(if $(findstring true, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(SYSLIB)/$@ ARCH=arm TARG=_a32 USE_GNU_CXX=y -f $(PREBUILD_HEADER)/.config -f Makefile all) 48 49libtee_shared: $(teelib) 50 @echo "building libtee_shared target" 51 $(if $(findstring false, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(TEELIB)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all) 52 $(if $(findstring true, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(TEELIB)/$@ ARCH=arm TARG=_a32 USE_GNU_CXX=y -f $(PREBUILD_HEADER)/.config -f Makefile all) 53 54libdrv_shared: $(drvlib) 55 @echo "building libdrv_shared target" 56 $(if $(findstring false, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(DRVLIB)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all) 57 $(if $(findstring true, $(CONFIG_SUPPORT_64BIT)), ,$(VER) $(MAKE) -C $(DRVLIB)/$@ ARCH=arm TARG=_a32 USE_GNU_CXX=y -f $(PREBUILD_HEADER)/.config -f Makefile all) 58 59# compile drivers rules 60 61frameworks := gtask teesmcmgr tarunner drvmgr 62service := huk_service 63 64ifdef CONFIG_SSA_64BIT 65service += ssa 66endif 67 68ifdef CONFIG_PERMSRV_64BIT 69service += permission_service 70endif 71 72drivers := crypto_mgr 73platform_drivers := 74 75ifdef CONFIG_TEE_MISC_DRIVER_64BIT 76drivers += tee_misc_driver 77endif 78 79ifdef CONFIG_HADRWARE_CRYPTO_ENABLE 80platform_drivers += libhardware_crypto_drv 81endif 82 83$(platform_drivers): 84 @echo "building platform_drivers=$@ target path $(PLATFORM_DRIVERS_PATH)/$@" 85 $(VER) LDFLAGS= $(MAKE) -C $(PLATFORM_DRIVERS_PATH)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all 86 87$(drivers): 88 @echo "building ARCH=arm driver=$@ target" 89 $(VER) LDFLAGS= $(MAKE) -C $(DRIVERS_PATH)/$@ ARCH=arm TARG=_a32 -f $(PREBUILD_HEADER)/.config -f Makefile all 90 $(VER) LDFLAGS= $(MAKE) -C $(DRIVERS_PATH)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all 91 92$(frameworks): 93 @echo "tee_os_framework framework compile $@" 94 $(if $(findstring true, $(CONFIG_SUPPORT_64BIT)), ,$(VER) LDFLAGS= $(MAKE) -C $(FRAMEWORK_PATH)/$@ ARCH=arm TARG=_a32 USE_GNU_CXX=y -f $(PREBUILD_HEADER)/.config -f Makefile all) 95 $(if $(findstring false, $(CONFIG_SUPPORT_64BIT)), ,$(VER) LDFLAGS= $(MAKE) -C $(FRAMEWORK_PATH)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all) 96 97$(service): 98 @echo "tee_os_framework service compile $@" 99 $(if $(findstring true, $(CONFIG_SUPPORT_64BIT)), ,$(VER) LDFLAGS= $(MAKE) -C $(SERVICES_PATH)/$@ ARCH=arm TARG=_a32 USE_GNU_CXX=y -f $(PREBUILD_HEADER)/.config -f Makefile all) 100 $(if $(findstring false, $(CONFIG_SUPPORT_64BIT)), ,$(VER) LDFLAGS= $(MAKE) -C $(SERVICES_PATH)/$@ ARCH=aarch64 -f $(PREBUILD_HEADER)/.config -f Makefile all) 101 102ifneq ($(VERSION_DDK),y) 103 $(VER) rm -rf $(BUILD_TOOLS)/generate_img/cpio-strip/cpio-strip 104endif 105 106include $(BUILD_SERVICE)/svc-flags.mk 107 108# export for tools/gen_boot_image.sh 109ifeq (${HM_ARCH}, aarch32) 110 HM_TARGET_ARCH := $(TARGET_ARCH_32) 111else 112 HM_TARGET_ARCH := $(TARGET_ARCH_64) 113endif 114GENERAL_OPTIONS := -Wdate-time -Wfloat-equal -Wshadow -fsigned-char -fno-strict-aliasing \ 115 -pipe -fno-common 116uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) 117