blob: 8342e3cf647179685a7a5ebab6d5e3ffb6b2fdd6 [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.
4ifeq ($O,)
5$(error output path should be specified when calling this makefile)
6endif
7
Cedric Chaumont1390f3a2015-08-31 13:55:16 +02008include $(TA_DEV_KIT_DIR)/host_include/conf.mk
9
Pascal Brandc639ac82015-07-02 08:53:34 +020010# By default we expect optee_client exported folder to be on a certain relative
11# path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will
12# be used instead.
13OPTEE_CLIENT_EXPORT ?= ../../../optee_client/out/export
14
Sumit Garg0e009142015-11-04 15:34:07 -050015CC ?= $(CROSS_COMPILE)gcc
16CPP ?= $(CROSS_COMPILE)cpp
17LD ?= $(CROSS_COMPILE)ld
18AR ?= $(CROSS_COMPILE)ar
19NM ?= $(CROSS_COMPILE)nm
20OBJCOPY ?= $(CROSS_COMPILE)objcopy
21OBJDUMP ?= $(CROSS_COMPILE)objdump
22READELF ?= $(CROSS_COMPILE)readelf
Pascal Brandc639ac82015-07-02 08:53:34 +020023
Jerome Forissierc6aac932015-09-24 17:45:08 -070024ifdef CFG_GP_PACKAGE_PATH
25GP := _gp
26endif
27
Jens Wiklander02389a92016-12-16 11:13:38 +010028srcs := xtest_1000.c
29
30ifeq ($(CFG_GP_SOCKETS),y)
31srcs += xtest_2000.c \
32 sock_server.c \
33 rand_stream.c
34endif
35
36srcs += xtest_4000.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020037 xtest_5000.c \
38 xtest_6000.c \
Jerome Forissierc6aac932015-09-24 17:45:08 -070039 xtest_7000$(GP).c \
Pascal Brandc639ac82015-07-02 08:53:34 +020040 xtest_10000.c \
Cedric Chaumont1390f3a2015-08-31 13:55:16 +020041 xtest_20000.c \
James Kung35b352d2015-09-07 18:01:16 +080042 xtest_benchmark_1000.c \
Igor Opaniuk136644a2016-09-13 13:40:56 +030043 xtest_benchmark_2000.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020044 xtest_helpers.c \
45 xtest_main.c \
46 xtest_test.c \
Igor Opaniuk136644a2016-09-13 13:40:56 +030047 sha_perf.c \
Igor Opaniuk44aff4b2016-09-16 10:18:00 +030048 aes_perf.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020049 adbg/src/adbg_case.c \
50 adbg/src/adbg_enum.c \
51 adbg/src/adbg_expect.c \
52 adbg/src/adbg_log.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020053 adbg/src/adbg_run.c \
Jens Wiklandercbebdcf2016-12-27 22:06:51 +010054 adbg/src/security_utils_hex.c
Pascal Brandc639ac82015-07-02 08:53:34 +020055
Jerome Forissiere3688342015-09-24 10:45:17 -070056ifdef CFG_GP_PACKAGE_PATH
57CFLAGS += -DWITH_GP_TESTS
Pascal Brand8a74e362015-09-10 12:41:52 +020058
Pascal Brandc639ac82015-07-02 08:53:34 +020059srcs += xtest_7500.c \
60 xtest_8000.c \
61 xtest_8500.c \
62 xtest_9000.c
63endif
64
65objs := $(patsubst %.c,$(O)/%.o, $(srcs))
66
67CFLAGS += -I./
68CFLAGS += -I./adbg/include
69CFLAGS += -I./xml/include
70
71CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
72CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
73
74CFLAGS += -I../../ta/create_fail_test/include
75CFLAGS += -I../../ta/crypt/include
76CFLAGS += -I../../ta/enc_fs/include
77CFLAGS += -I../../ta/os_test/include
78CFLAGS += -I../../ta/rpc_test/include
79CFLAGS += -I../../ta/sims/include
80CFLAGS += -I../../ta/storage/include
James Kungdf1e6cf2015-09-14 22:42:24 +080081CFLAGS += -I../../ta/storage_benchmark/include
Jens Wiklanderac27ec12015-07-15 15:23:14 +020082CFLAGS += -I../../ta/concurrent/include
Jens Wiklander70672972016-04-06 00:01:45 +020083CFLAGS += -I../../ta/concurrent_large/include
Igor Opaniuk136644a2016-09-13 13:40:56 +030084CFLAGS += -I../../ta/sha_perf/include
Igor Opaniuk44aff4b2016-09-16 10:18:00 +030085CFLAGS += -I../../ta/aes_perf/include
Jens Wiklander02389a92016-12-16 11:13:38 +010086CFLAGS += -I../../ta/socket/include
Jerome Forissiere3688342015-09-24 10:45:17 -070087ifdef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020088CFLAGS += -I../../ta/GP_TTA_Arithmetical
89CFLAGS += -I../../ta/GP_TTA_Crypto
90CFLAGS += -I../../ta/GP_TTA_DS
91CFLAGS += -I../../ta/GP_TTA_TCF
92CFLAGS += -I../../ta/GP_TTA_TCF_ICA
93CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
94CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
95CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
96CFLAGS += -I../../ta/GP_TTA_Time
97CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
98CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
99CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
100CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
101CFLAGS += -I../../ta/GP_TTA_testingClientAPI
102
103# need more include: openssl
104CFLAGS += -Ifor_gp/include
105
Pascal Brandbaa291f2016-02-26 10:14:22 +0100106# by default, the client application is compiled as the kernel of optee-os
Pascal Brandfd1596a2015-07-10 15:02:17 +0200107ifeq ($(CFG_ARM32),y)
Pascal Brandbaa291f2016-02-26 10:14:22 +0100108COMPILE_NS_USER ?= 32
109else
110COMPILE_NS_USER ?= 64
111endif
112
113ifeq ($(COMPILE_NS_USER),32)
Pascal Brandfd1596a2015-07-10 15:02:17 +0200114LDFLAGS += ../lib/armv7/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200115else
Pascal Brandfd1596a2015-07-10 15:02:17 +0200116LDFLAGS += ../lib/armv8/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200117endif
118
Pascal Brandc639ac82015-07-02 08:53:34 +0200119endif
120
Jerome Forissierf9b89252016-08-23 18:30:43 +0200121# Include configuration file generated by OP-TEE OS (CFG_* macros)
122CFLAGS += -include conf.h
Pascal Brandc639ac82015-07-02 08:53:34 +0200123
Jerome Forissiere3688342015-09-24 10:45:17 -0700124ifndef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +0200125CFLAGS += -Wall -Wcast-align -Werror \
126 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
127 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
128 -Wmissing-declarations -Wmissing-format-attribute \
129 -Wmissing-include-dirs -Wmissing-noreturn \
130 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
131 -Wshadow -Wstrict-prototypes -Wswitch-default \
132 -Wwrite-strings \
133 -Wno-missing-field-initializers -Wno-format-zero-length
134endif
135
Jerome Forissiera8b78f12016-08-17 09:40:59 +0200136CFLAGS += -g3
137
Pascal Brandc639ac82015-07-02 08:53:34 +0200138LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
Igor Opaniuk136644a2016-09-13 13:40:56 +0300139LDFLAGS += -lpthread -lm
Pascal Brandc639ac82015-07-02 08:53:34 +0200140
141.PHONY: all
142all: xtest
143
144xtest: $(objs)
145 @echo " LD $(O)/$@"
146 $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
147
148$(O)/%.o: $(CURDIR)/%.c
149 $(q)mkdir -p $(O)/adbg/src
150 @echo ' CC $<'
151 $(q)$(CC) $(CFLAGS) -c $< -o $@
152
153.PHONY: clean
154clean:
155 @echo ' CLEAN $(O)'
156 $(q)rm -f $(O)/xtest
157 $(q)$(foreach obj,$(objs), rm -f $(obj))