blob: ff497cc57fbe32d8bf42f7acabe66b08990c297e [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
Jerome Forissiere3688342015-09-24 10:45:17 -070059ifdef CFG_GP_PACKAGE_PATH
60CFLAGS += -DWITH_GP_TESTS
Pascal Brand8a74e362015-09-10 12:41:52 +020061
Pascal Brandc639ac82015-07-02 08:53:34 +020062srcs += xtest_7500.c \
63 xtest_8000.c \
64 xtest_8500.c \
65 xtest_9000.c
66endif
67
Etienne Carriere3ddc3622017-03-13 15:31:15 +010068objs := $(patsubst %.c,$(out-dir)/xtest/%.o, $(srcs))
Pascal Brandc639ac82015-07-02 08:53:34 +020069
70CFLAGS += -I./
71CFLAGS += -I./adbg/include
72CFLAGS += -I./xml/include
73
74CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
75CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
76
77CFLAGS += -I../../ta/create_fail_test/include
78CFLAGS += -I../../ta/crypt/include
79CFLAGS += -I../../ta/enc_fs/include
80CFLAGS += -I../../ta/os_test/include
81CFLAGS += -I../../ta/rpc_test/include
82CFLAGS += -I../../ta/sims/include
83CFLAGS += -I../../ta/storage/include
James Kungdf1e6cf2015-09-14 22:42:24 +080084CFLAGS += -I../../ta/storage_benchmark/include
Jens Wiklanderac27ec12015-07-15 15:23:14 +020085CFLAGS += -I../../ta/concurrent/include
Jens Wiklander70672972016-04-06 00:01:45 +020086CFLAGS += -I../../ta/concurrent_large/include
Igor Opaniuk136644a2016-09-13 13:40:56 +030087CFLAGS += -I../../ta/sha_perf/include
Igor Opaniuk44aff4b2016-09-16 10:18:00 +030088CFLAGS += -I../../ta/aes_perf/include
Jens Wiklander02389a92016-12-16 11:13:38 +010089CFLAGS += -I../../ta/socket/include
Jerome Forissiere3688342015-09-24 10:45:17 -070090ifdef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020091CFLAGS += -I../../ta/GP_TTA_Arithmetical
92CFLAGS += -I../../ta/GP_TTA_Crypto
93CFLAGS += -I../../ta/GP_TTA_DS
94CFLAGS += -I../../ta/GP_TTA_TCF
95CFLAGS += -I../../ta/GP_TTA_TCF_ICA
96CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
97CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
98CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
99CFLAGS += -I../../ta/GP_TTA_Time
100CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
101CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
102CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
103CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
104CFLAGS += -I../../ta/GP_TTA_testingClientAPI
105
106# need more include: openssl
107CFLAGS += -Ifor_gp/include
108
Pascal Brandbaa291f2016-02-26 10:14:22 +0100109# by default, the client application is compiled as the kernel of optee-os
Pascal Brandfd1596a2015-07-10 15:02:17 +0200110ifeq ($(CFG_ARM32),y)
Pascal Brandbaa291f2016-02-26 10:14:22 +0100111COMPILE_NS_USER ?= 32
112else
113COMPILE_NS_USER ?= 64
114endif
115
116ifeq ($(COMPILE_NS_USER),32)
Pascal Brandfd1596a2015-07-10 15:02:17 +0200117LDFLAGS += ../lib/armv7/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200118else
Pascal Brandfd1596a2015-07-10 15:02:17 +0200119LDFLAGS += ../lib/armv8/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200120endif
121
Pascal Brandc639ac82015-07-02 08:53:34 +0200122endif
123
Jerome Forissierf9b89252016-08-23 18:30:43 +0200124# Include configuration file generated by OP-TEE OS (CFG_* macros)
125CFLAGS += -include conf.h
Pascal Brandc639ac82015-07-02 08:53:34 +0200126
Jerome Forissiere3688342015-09-24 10:45:17 -0700127ifndef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +0200128CFLAGS += -Wall -Wcast-align -Werror \
129 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
130 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
131 -Wmissing-declarations -Wmissing-format-attribute \
132 -Wmissing-include-dirs -Wmissing-noreturn \
133 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
134 -Wshadow -Wstrict-prototypes -Wswitch-default \
135 -Wwrite-strings \
136 -Wno-missing-field-initializers -Wno-format-zero-length
137endif
138
Jerome Forissiera8b78f12016-08-17 09:40:59 +0200139CFLAGS += -g3
140
Pascal Brandc639ac82015-07-02 08:53:34 +0200141LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
Igor Opaniuk136644a2016-09-13 13:40:56 +0300142LDFLAGS += -lpthread -lm
Pascal Brandc639ac82015-07-02 08:53:34 +0200143
144.PHONY: all
145all: xtest
146
147xtest: $(objs)
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100148 @echo " LD $(out-dir)/xtest/$@"
149 $(q)@$(CC) -o $(out-dir)/xtest/$@ $+ $(LDFLAGS)
Pascal Brandc639ac82015-07-02 08:53:34 +0200150
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100151$(out-dir)/xtest/%.o: $(CURDIR)/%.c
152 $(q)mkdir -p $(out-dir)/xtest/adbg/src
Pascal Brandc639ac82015-07-02 08:53:34 +0200153 @echo ' CC $<'
154 $(q)$(CC) $(CFLAGS) -c $< -o $@
155
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100156RMDIR := rmdir --ignore-fail-on-non-empty
157define rm-build-dirs
158 $(q)for d in $1; do $(RMDIR) $(out-dir)/xtest/$$d 2> /dev/null; true; done
159 $(q)$(RMDIR) $(out-dir)/xtest 2> /dev/null; true
160 $(q)$(RMDIR) $(out-dir) 2> /dev/null; true
161endef
162
Pascal Brandc639ac82015-07-02 08:53:34 +0200163.PHONY: clean
164clean:
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100165 @echo ' CLEAN $(out-dir)'
166 $(q)rm -f $(out-dir)/xtest/xtest
Pascal Brandc639ac82015-07-02 08:53:34 +0200167 $(q)$(foreach obj,$(objs), rm -f $(obj))
Etienne Carriere3ddc3622017-03-13 15:31:15 +0100168 $(call rm-build-dirs,adbg/src adbg)