blob: 368d82663af4cabf543e7a565765828f771acc2e [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
Pascal Brandc639ac82015-07-02 08:53:34 +020028srcs := xtest_1000.c \
29 xtest_4000.c \
30 xtest_5000.c \
31 xtest_6000.c \
Jerome Forissierc6aac932015-09-24 17:45:08 -070032 xtest_7000$(GP).c \
Pascal Brandc639ac82015-07-02 08:53:34 +020033 xtest_10000.c \
Cedric Chaumont1390f3a2015-08-31 13:55:16 +020034 xtest_20000.c \
James Kung35b352d2015-09-07 18:01:16 +080035 xtest_benchmark_1000.c \
Igor Opaniuk136644a2016-09-13 13:40:56 +030036 xtest_benchmark_2000.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020037 xtest_helpers.c \
38 xtest_main.c \
39 xtest_test.c \
Igor Opaniuk136644a2016-09-13 13:40:56 +030040 sha_perf.c \
Igor Opaniuk44aff4b2016-09-16 10:18:00 +030041 aes_perf.c \
Pascal Brandc639ac82015-07-02 08:53:34 +020042 adbg/src/adbg_case.c \
43 adbg/src/adbg_enum.c \
44 adbg/src/adbg_expect.c \
45 adbg/src/adbg_log.c \
46 adbg/src/adbg_mts.c \
47 adbg/src/adbg_run.c \
48 adbg/src/adbg_util.c \
49 adbg/src/r_list_genutil.c \
50 adbg/src/security_utils_hex.c \
51 adbg/src/security_utils_mem.c
52
Jerome Forissiere3688342015-09-24 10:45:17 -070053ifdef CFG_GP_PACKAGE_PATH
54CFLAGS += -DWITH_GP_TESTS
Pascal Brand8a74e362015-09-10 12:41:52 +020055
Pascal Brandc639ac82015-07-02 08:53:34 +020056srcs += xtest_7500.c \
57 xtest_8000.c \
58 xtest_8500.c \
59 xtest_9000.c
60endif
61
62objs := $(patsubst %.c,$(O)/%.o, $(srcs))
63
64CFLAGS += -I./
65CFLAGS += -I./adbg/include
66CFLAGS += -I./xml/include
67
68CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
69CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
70
71CFLAGS += -I../../ta/create_fail_test/include
72CFLAGS += -I../../ta/crypt/include
73CFLAGS += -I../../ta/enc_fs/include
74CFLAGS += -I../../ta/os_test/include
75CFLAGS += -I../../ta/rpc_test/include
76CFLAGS += -I../../ta/sims/include
77CFLAGS += -I../../ta/storage/include
James Kungdf1e6cf2015-09-14 22:42:24 +080078CFLAGS += -I../../ta/storage_benchmark/include
Jens Wiklanderac27ec12015-07-15 15:23:14 +020079CFLAGS += -I../../ta/concurrent/include
Jens Wiklander70672972016-04-06 00:01:45 +020080CFLAGS += -I../../ta/concurrent_large/include
Igor Opaniuk136644a2016-09-13 13:40:56 +030081CFLAGS += -I../../ta/sha_perf/include
Igor Opaniuk44aff4b2016-09-16 10:18:00 +030082CFLAGS += -I../../ta/aes_perf/include
Jerome Forissiere3688342015-09-24 10:45:17 -070083ifdef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020084CFLAGS += -I../../ta/GP_TTA_Arithmetical
85CFLAGS += -I../../ta/GP_TTA_Crypto
86CFLAGS += -I../../ta/GP_TTA_DS
87CFLAGS += -I../../ta/GP_TTA_TCF
88CFLAGS += -I../../ta/GP_TTA_TCF_ICA
89CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
90CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
91CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
92CFLAGS += -I../../ta/GP_TTA_Time
93CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
94CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
95CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
96CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
97CFLAGS += -I../../ta/GP_TTA_testingClientAPI
98
99# need more include: openssl
100CFLAGS += -Ifor_gp/include
101
Pascal Brandbaa291f2016-02-26 10:14:22 +0100102# by default, the client application is compiled as the kernel of optee-os
Pascal Brandfd1596a2015-07-10 15:02:17 +0200103ifeq ($(CFG_ARM32),y)
Pascal Brandbaa291f2016-02-26 10:14:22 +0100104COMPILE_NS_USER ?= 32
105else
106COMPILE_NS_USER ?= 64
107endif
108
109ifeq ($(COMPILE_NS_USER),32)
Pascal Brandfd1596a2015-07-10 15:02:17 +0200110LDFLAGS += ../lib/armv7/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200111else
Pascal Brandfd1596a2015-07-10 15:02:17 +0200112LDFLAGS += ../lib/armv8/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +0200113endif
114
Pascal Brandc639ac82015-07-02 08:53:34 +0200115endif
116
117# FIXME: Check if and why we need this flag?
118CFLAGS += -DUSER_SPACE
Jerome Forissierf9b89252016-08-23 18:30:43 +0200119# Include configuration file generated by OP-TEE OS (CFG_* macros)
120CFLAGS += -include conf.h
Pascal Brandc639ac82015-07-02 08:53:34 +0200121
Jerome Forissiere3688342015-09-24 10:45:17 -0700122ifndef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +0200123CFLAGS += -Wall -Wcast-align -Werror \
124 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
125 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
126 -Wmissing-declarations -Wmissing-format-attribute \
127 -Wmissing-include-dirs -Wmissing-noreturn \
128 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
129 -Wshadow -Wstrict-prototypes -Wswitch-default \
130 -Wwrite-strings \
131 -Wno-missing-field-initializers -Wno-format-zero-length
132endif
133
Jerome Forissiera8b78f12016-08-17 09:40:59 +0200134CFLAGS += -g3
135
Pascal Brandc639ac82015-07-02 08:53:34 +0200136LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
Igor Opaniuk136644a2016-09-13 13:40:56 +0300137LDFLAGS += -lpthread -lm
Pascal Brandc639ac82015-07-02 08:53:34 +0200138
139.PHONY: all
140all: xtest
141
142xtest: $(objs)
143 @echo " LD $(O)/$@"
144 $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
145
146$(O)/%.o: $(CURDIR)/%.c
147 $(q)mkdir -p $(O)/adbg/src
148 @echo ' CC $<'
149 $(q)$(CC) $(CFLAGS) -c $< -o $@
150
151.PHONY: clean
152clean:
153 @echo ' CLEAN $(O)'
154 $(q)rm -f $(O)/xtest
155 $(q)$(foreach obj,$(objs), rm -f $(obj))