blob: bed62d0baf2206b8e742b15f9c0a2708734ebe18 [file] [log] [blame]
Pascal Brandc639ac82015-07-02 08:53:34 +02001# Normally this makefile shouldn't be called directly and we expect the output
2# path to be on a certain location to fit together with the other OP-TEE
3# gits and helper scripts.
Etienne Carriere3ddc3622017-03-13 15:31:15 +01004
5include ../../scripts/common.mk
6out-dir := $(call strip-trailing-slashes-and-dots,$(O))
7ifeq ($(out-dir),)
8$(error invalid output directory (O=$(O)))
Pascal Brandc639ac82015-07-02 08:53:34 +02009endif
10
Cedric Chaumont1390f3a2015-08-31 13:55:16 +020011include $(TA_DEV_KIT_DIR)/host_include/conf.mk
12
Pascal Brandc639ac82015-07-02 08:53:34 +020013# By default we expect optee_client exported folder to be on a certain relative
14# path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will
15# be used instead.
16OPTEE_CLIENT_EXPORT ?= ../../../optee_client/out/export
17
Sumit Garg0e009142015-11-04 15:34:07 -050018CC ?= $(CROSS_COMPILE)gcc
19CPP ?= $(CROSS_COMPILE)cpp
20LD ?= $(CROSS_COMPILE)ld
21AR ?= $(CROSS_COMPILE)ar
22NM ?= $(CROSS_COMPILE)nm
23OBJCOPY ?= $(CROSS_COMPILE)objcopy
24OBJDUMP ?= $(CROSS_COMPILE)objdump
25READELF ?= $(CROSS_COMPILE)readelf
Pascal Brandc639ac82015-07-02 08:53:34 +020026
Jerome Forissierc6aac932015-09-24 17:45:08 -070027ifdef CFG_GP_PACKAGE_PATH
28GP := _gp
29endif
30
Jens Wiklander02389a92016-12-16 11:13:38 +010031srcs := xtest_1000.c
32
33ifeq ($(CFG_GP_SOCKETS),y)
34srcs += xtest_2000.c \
35 sock_server.c \
36 rand_stream.c
37endif
38
39srcs += xtest_4000.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020040 xtest_5000.c \
41 xtest_6000.c \
Jerome Forissierc6aac932015-09-24 17:45:08 -070042 xtest_7000$(GP).c \
Pascal Brandc639ac82015-07-02 08:53:34 +020043 xtest_10000.c \
Cedric Chaumont1390f3a2015-08-31 13:55:16 +020044 xtest_20000.c \
James Kung35b352d2015-09-07 18:01:16 +080045 xtest_benchmark_1000.c \
Igor Opaniuk136644a2016-09-13 13:40:56 +030046 xtest_benchmark_2000.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020047 xtest_helpers.c \
48 xtest_main.c \
49 xtest_test.c \
Igor Opaniuk136644a2016-09-13 13:40:56 +030050 sha_perf.c \
Igor Opaniuk44aff4b2016-09-16 10:18:00 +030051 aes_perf.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020052 adbg/src/adbg_case.c \
53 adbg/src/adbg_enum.c \
54 adbg/src/adbg_expect.c \
55 adbg/src/adbg_log.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020056 adbg/src/adbg_run.c \
Jens Wiklandercbebdcf2016-12-27 22:06:51 +010057 adbg/src/security_utils_hex.c
Pascal Brandc639ac82015-07-02 08:53:34 +020058
Etienne Carriere41343db2017-03-17 15:38:52 +010059ifeq ($(CFG_SECURE_DATA_PATH),y)
60srcs += sdp_basic.c
61endif
62
Jerome Forissiere3688342015-09-24 10:45:17 -070063ifdef CFG_GP_PACKAGE_PATH
64CFLAGS += -DWITH_GP_TESTS
Pascal Brand8a74e362015-09-10 12:41:52 +020065
Pascal Brandc639ac82015-07-02 08:53:34 +020066srcs += xtest_7500.c \
67 xtest_8000.c \
68 xtest_8500.c \
69 xtest_9000.c
70endif
71
Etienne Carriere3ddc3622017-03-13 15:31:15 +010072objs := $(patsubst %.c,$(out-dir)/xtest/%.o, $(srcs))
Pascal Brandc639ac82015-07-02 08:53:34 +020073
74CFLAGS += -I./
75CFLAGS += -I./adbg/include
76CFLAGS += -I./xml/include
77
78CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
79CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
80
81CFLAGS += -I../../ta/create_fail_test/include
82CFLAGS += -I../../ta/crypt/include
83CFLAGS += -I../../ta/enc_fs/include
84CFLAGS += -I../../ta/os_test/include
85CFLAGS += -I../../ta/rpc_test/include
86CFLAGS += -I../../ta/sims/include
87CFLAGS += -I../../ta/storage/include
James Kungdf1e6cf2015-09-14 22:42:24 +080088CFLAGS += -I../../ta/storage_benchmark/include
Jens Wiklanderac27ec12015-07-15 15:23:14 +020089CFLAGS += -I../../ta/concurrent/include
Jens Wiklander70672972016-04-06 00:01:45 +020090CFLAGS += -I../../ta/concurrent_large/include
Igor Opaniuk136644a2016-09-13 13:40:56 +030091CFLAGS += -I../../ta/sha_perf/include
Igor Opaniuk44aff4b2016-09-16 10:18:00 +030092CFLAGS += -I../../ta/aes_perf/include
Jens Wiklander02389a92016-12-16 11:13:38 +010093CFLAGS += -I../../ta/socket/include
Etienne Carriere41343db2017-03-17 15:38:52 +010094CFLAGS += -I../../ta/sdp_basic/include
95
Jerome Forissiere3688342015-09-24 10:45:17 -070096ifdef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020097CFLAGS += -I../../ta/GP_TTA_Arithmetical
98CFLAGS += -I../../ta/GP_TTA_Crypto
99CFLAGS += -I../../ta/GP_TTA_DS
100CFLAGS += -I../../ta/GP_TTA_TCF
101CFLAGS += -I../../ta/GP_TTA_TCF_ICA
102CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
103CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
104CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
105CFLAGS += -I../../ta/GP_TTA_Time
106CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
107CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
108CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
109CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
110CFLAGS += -I../../ta/GP_TTA_testingClientAPI
111
112# need more include: openssl
113CFLAGS += -Ifor_gp/include
114
Pascal Brandbaa291f2016-02-26 10:14:22 +0100115# by default, the client application is compiled as the kernel of optee-os
Pascal Brandfd1596a2015-07-10 15:02:17 +0200116ifeq ($(CFG_ARM32),y)
Pascal Brandbaa291f2016-02-26 10:14:22 +0100117COMPILE_NS_USER ?= 32
118else
119COMPILE_NS_USER ?= 64
120endif
121
122ifeq ($(COMPILE_NS_USER),32)
Pascal Brandfd1596a2015-07-10 15:02:17 +0200123LDFLAGS += ../lib/armv7/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200124else
Pascal Brandfd1596a2015-07-10 15:02:17 +0200125LDFLAGS += ../lib/armv8/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200126endif
127
Pascal Brandc639ac82015-07-02 08:53:34 +0200128endif
129
Jerome Forissierf9b89252016-08-23 18:30:43 +0200130# Include configuration file generated by OP-TEE OS (CFG_* macros)
131CFLAGS += -include conf.h
Pascal Brandc639ac82015-07-02 08:53:34 +0200132
Jerome Forissiere3688342015-09-24 10:45:17 -0700133ifndef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +0200134CFLAGS += -Wall -Wcast-align -Werror \
135 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
136 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
137 -Wmissing-declarations -Wmissing-format-attribute \
138 -Wmissing-include-dirs -Wmissing-noreturn \
139 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
140 -Wshadow -Wstrict-prototypes -Wswitch-default \
141 -Wwrite-strings \
142 -Wno-missing-field-initializers -Wno-format-zero-length
143endif
144
Jerome Forissiera8b78f12016-08-17 09:40:59 +0200145CFLAGS += -g3
146
Pascal Brandc639ac82015-07-02 08:53:34 +0200147LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
Igor Opaniuk136644a2016-09-13 13:40:56 +0300148LDFLAGS += -lpthread -lm
Pascal Brandc639ac82015-07-02 08:53:34 +0200149
150.PHONY: all
151all: xtest
152
153xtest: $(objs)
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100154 @echo " LD $(out-dir)/xtest/$@"
155 $(q)@$(CC) -o $(out-dir)/xtest/$@ $+ $(LDFLAGS)
Pascal Brandc639ac82015-07-02 08:53:34 +0200156
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100157$(out-dir)/xtest/%.o: $(CURDIR)/%.c
158 $(q)mkdir -p $(out-dir)/xtest/adbg/src
Pascal Brandc639ac82015-07-02 08:53:34 +0200159 @echo ' CC $<'
160 $(q)$(CC) $(CFLAGS) -c $< -o $@
161
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100162RMDIR := rmdir --ignore-fail-on-non-empty
163define rm-build-dirs
164 $(q)for d in $1; do $(RMDIR) $(out-dir)/xtest/$$d 2> /dev/null; true; done
165 $(q)$(RMDIR) $(out-dir)/xtest 2> /dev/null; true
166 $(q)$(RMDIR) $(out-dir) 2> /dev/null; true
167endef
168
Pascal Brandc639ac82015-07-02 08:53:34 +0200169.PHONY: clean
170clean:
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100171 @echo ' CLEAN $(out-dir)'
172 $(q)rm -f $(out-dir)/xtest/xtest
Pascal Brandc639ac82015-07-02 08:53:34 +0200173 $(q)$(foreach obj,$(objs), rm -f $(obj))
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100174 $(call rm-build-dirs,adbg/src adbg)