blob: f891ddf401ae46de8301e3d3c4b5e08d1c6313e3 [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
8# By default we expect optee_client exported folder to be on a certain relative
9# path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will
10# be used instead.
11OPTEE_CLIENT_EXPORT ?= ../../../optee_client/out/export
12
13CC := $(CROSS_COMPILE)gcc
14CPP := $(CROSS_COMPILE)cpp
15LD := $(CROSS_COMPILE)ld
16AR := $(CROSS_COMPILE)ar
17NM := $(CROSS_COMPILE)nm
18OBJCOPY := $(CROSS_COMPILE)objcopy
19OBJDUMP := $(CROSS_COMPILE)objdump
20READELF := $(CROSS_COMPILE)readelf
21
Jerome Forissierc6aac932015-09-24 17:45:08 -070022ifdef CFG_GP_PACKAGE_PATH
23GP := _gp
24endif
25
Pascal Brandc639ac82015-07-02 08:53:34 +020026srcs := xtest_1000.c \
27 xtest_4000.c \
28 xtest_5000.c \
29 xtest_6000.c \
Jerome Forissierc6aac932015-09-24 17:45:08 -070030 xtest_7000$(GP).c \
Pascal Brandc639ac82015-07-02 08:53:34 +020031 xtest_10000.c \
32 xtest_helpers.c \
33 xtest_main.c \
34 xtest_test.c \
35 adbg/src/adbg_case.c \
36 adbg/src/adbg_enum.c \
37 adbg/src/adbg_expect.c \
38 adbg/src/adbg_log.c \
39 adbg/src/adbg_mts.c \
40 adbg/src/adbg_run.c \
41 adbg/src/adbg_util.c \
42 adbg/src/r_list_genutil.c \
43 adbg/src/security_utils_hex.c \
44 adbg/src/security_utils_mem.c
45
Jerome Forissiere3688342015-09-24 10:45:17 -070046ifdef CFG_GP_PACKAGE_PATH
47CFLAGS += -DWITH_GP_TESTS
Pascal Brand8a74e362015-09-10 12:41:52 +020048
Pascal Brandc639ac82015-07-02 08:53:34 +020049srcs += xtest_7500.c \
50 xtest_8000.c \
51 xtest_8500.c \
52 xtest_9000.c
53endif
54
55objs := $(patsubst %.c,$(O)/%.o, $(srcs))
56
57CFLAGS += -I./
58CFLAGS += -I./adbg/include
59CFLAGS += -I./xml/include
60
61CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
62CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
63
64CFLAGS += -I../../ta/create_fail_test/include
65CFLAGS += -I../../ta/crypt/include
66CFLAGS += -I../../ta/enc_fs/include
67CFLAGS += -I../../ta/os_test/include
68CFLAGS += -I../../ta/rpc_test/include
69CFLAGS += -I../../ta/sims/include
70CFLAGS += -I../../ta/storage/include
Jerome Forissiere3688342015-09-24 10:45:17 -070071ifdef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020072CFLAGS += -I../../ta/GP_TTA_Arithmetical
73CFLAGS += -I../../ta/GP_TTA_Crypto
74CFLAGS += -I../../ta/GP_TTA_DS
75CFLAGS += -I../../ta/GP_TTA_TCF
76CFLAGS += -I../../ta/GP_TTA_TCF_ICA
77CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
78CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
79CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
80CFLAGS += -I../../ta/GP_TTA_Time
81CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
82CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
83CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
84CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
85CFLAGS += -I../../ta/GP_TTA_testingClientAPI
86
87# need more include: openssl
88CFLAGS += -Ifor_gp/include
89
90# need more libraries: openssl
Pascal Brandfd1596a2015-07-10 15:02:17 +020091ifeq ($(CFG_ARM32),y)
92LDFLAGS += ../lib/armv7/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +020093else
Pascal Brandfd1596a2015-07-10 15:02:17 +020094LDFLAGS += ../lib/armv8/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +020095endif
96
Pascal Brandc639ac82015-07-02 08:53:34 +020097endif
98
99# FIXME: Check if and why we need this flag?
100CFLAGS += -DUSER_SPACE
101
Jerome Forissiere3688342015-09-24 10:45:17 -0700102ifndef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +0200103CFLAGS += -Wall -Wcast-align -Werror \
104 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
105 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
106 -Wmissing-declarations -Wmissing-format-attribute \
107 -Wmissing-include-dirs -Wmissing-noreturn \
108 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
109 -Wshadow -Wstrict-prototypes -Wswitch-default \
110 -Wwrite-strings \
111 -Wno-missing-field-initializers -Wno-format-zero-length
112endif
113
114LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
115LDFLAGS += -lpthread
116
117.PHONY: all
118all: xtest
119
120xtest: $(objs)
121 @echo " LD $(O)/$@"
122 $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
123
124$(O)/%.o: $(CURDIR)/%.c
125 $(q)mkdir -p $(O)/adbg/src
126 @echo ' CC $<'
127 $(q)$(CC) $(CFLAGS) -c $< -o $@
128
129.PHONY: clean
130clean:
131 @echo ' CLEAN $(O)'
132 $(q)rm -f $(O)/xtest
133 $(q)$(foreach obj,$(objs), rm -f $(obj))