forked from apache/incubator-teaclave-trustzone-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (73 loc) · 2.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
ifeq ($(O),)
out-dir := $(CURDIR)/out
else
out-dir := $(O)
endif
bindir ?= /usr/bin
libdir ?= /usr/lib
ifneq ($V,1)
q := @
echo := @echo
else
q :=
echo := @:
endif
# export 'q', used by sub-makefiles.
export q
EXAMPLES = $(wildcard examples/*)
EXAMPLES_CLEAN = $(EXAMPLES:%=%-clean)
TARGET ?= aarch64-unknown-linux-gnu
CROSS_COMPILE ?= aarch64-linux-gnu-
# If _HOST or _TA specific compiler/target are not specified, then use common
# compiler/target for both
CROSS_COMPILE_HOST ?= $(CROSS_COMPILE)
CROSS_COMPILE_TA ?= $(CROSS_COMPILE)
TARGET_HOST ?= $(TARGET)
TARGET_TA ?= $(TARGET)
.PHONY: all examples $(EXAMPLES) install clean
ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),)
all: examples
else
all:
$(q)echo "TA_DEV_KIT_DIR is not correctly defined" && false
endif
examples: $(EXAMPLES)
$(EXAMPLES):
$(q)make -C $@ TARGET_HOST=$(TARGET_HOST) \
TARGET_TA=$(TARGET_TA) \
CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) \
CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) \
TA_DEV_KIT_DIR=$(TA_DEV_KIT_DIR) \
OPTEE_CLIENT_EXPORT=$(OPTEE_CLIENT_EXPORT)
install: examples
$(echo) ' INSTALL ${out-dir}/lib/optee_armtz'
$(q)mkdir -p ${out-dir}/lib/optee_armtz
$(q)find examples/*/ta/target/$(TARGET_TA)/ -name *.ta -exec cp {} ${out-dir}/lib/optee_armtz \;
$(echo) ' INSTALL ${out-dir}${bindir}'
$(q)mkdir -p ${out-dir}${bindir}
$(q)cp examples/*/host/target/$(TARGET_HOST)/release/*-rs ${out-dir}${bindir}
$(echo) ' INSTALL ${out-dir}${libdir}/tee-supplicant/plugins/'
$(q)mkdir -p ${out-dir}${libdir}/tee-supplicant/plugins/
$(q)find examples/*/plugin/target/$(TARGET_HOST)/ -name *.plugin.so -exec cp {} ${out-dir}${libdir}/tee-supplicant/plugins/ \;
examples-clean: $(EXAMPLES_CLEAN) out-clean
$(EXAMPLES_CLEAN):
$(q)make -C $(@:-clean=) clean
out-clean:
rm -rf out
clean: $(EXAMPLES_CLEAN) out-clean