blob: 5fd051cc6d58c5603bf98d4b72f58422a1bae756 [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
22srcs := xtest_1000.c \
23 xtest_4000.c \
24 xtest_5000.c \
25 xtest_6000.c \
26 xtest_7000.c \
27 xtest_10000.c \
28 xtest_helpers.c \
29 xtest_main.c \
30 xtest_test.c \
31 adbg/src/adbg_case.c \
32 adbg/src/adbg_enum.c \
33 adbg/src/adbg_expect.c \
34 adbg/src/adbg_log.c \
35 adbg/src/adbg_mts.c \
36 adbg/src/adbg_run.c \
37 adbg/src/adbg_util.c \
38 adbg/src/r_list_genutil.c \
39 adbg/src/security_utils_hex.c \
40 adbg/src/security_utils_mem.c
41
42ifeq ($(CFG_GP_TESTSUITE_ENABLE), y)
Pascal Brand8a74e362015-09-10 12:41:52 +020043CFLAGS += -DCFG_GP_TESTSUITE_ENABLE
44
Pascal Brandc639ac82015-07-02 08:53:34 +020045srcs += xtest_7500.c \
46 xtest_8000.c \
47 xtest_8500.c \
48 xtest_9000.c
49endif
50
51objs := $(patsubst %.c,$(O)/%.o, $(srcs))
52
53CFLAGS += -I./
54CFLAGS += -I./adbg/include
55CFLAGS += -I./xml/include
56
57CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
58CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
59
60CFLAGS += -I../../ta/create_fail_test/include
61CFLAGS += -I../../ta/crypt/include
62CFLAGS += -I../../ta/enc_fs/include
63CFLAGS += -I../../ta/os_test/include
64CFLAGS += -I../../ta/rpc_test/include
65CFLAGS += -I../../ta/sims/include
66CFLAGS += -I../../ta/storage/include
67ifeq ($(CFG_GP_TESTSUITE_ENABLE),y)
68CFLAGS += -I../../ta/GP_TTA_Arithmetical
69CFLAGS += -I../../ta/GP_TTA_Crypto
70CFLAGS += -I../../ta/GP_TTA_DS
71CFLAGS += -I../../ta/GP_TTA_TCF
72CFLAGS += -I../../ta/GP_TTA_TCF_ICA
73CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
74CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
75CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
76CFLAGS += -I../../ta/GP_TTA_Time
77CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
78CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
79CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
80CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
81CFLAGS += -I../../ta/GP_TTA_testingClientAPI
82
83# need more include: openssl
84CFLAGS += -Ifor_gp/include
85
86# need more libraries: openssl
Pascal Brandfd1596a2015-07-10 15:02:17 +020087ifeq ($(CFG_ARM32),y)
88LDFLAGS += ../lib/armv7/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +020089else
Pascal Brandfd1596a2015-07-10 15:02:17 +020090LDFLAGS += ../lib/armv8/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +020091endif
92
93# need more flags
94CFLAGS += -DXTEST_WITH_GP_TESTS
95
96endif
97
98# FIXME: Check if and why we need this flag?
99CFLAGS += -DUSER_SPACE
100
101ifneq ($(CFG_GP_TESTSUITE_ENABLE),y)
102CFLAGS += -Wall -Wcast-align -Werror \
103 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
104 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
105 -Wmissing-declarations -Wmissing-format-attribute \
106 -Wmissing-include-dirs -Wmissing-noreturn \
107 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
108 -Wshadow -Wstrict-prototypes -Wswitch-default \
109 -Wwrite-strings \
110 -Wno-missing-field-initializers -Wno-format-zero-length
111endif
112
113LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
114LDFLAGS += -lpthread
115
116.PHONY: all
117all: xtest
118
119xtest: $(objs)
120 @echo " LD $(O)/$@"
121 $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
122
123$(O)/%.o: $(CURDIR)/%.c
124 $(q)mkdir -p $(O)/adbg/src
125 @echo ' CC $<'
126 $(q)$(CC) $(CFLAGS) -c $< -o $@
127
128.PHONY: clean
129clean:
130 @echo ' CLEAN $(O)'
131 $(q)rm -f $(O)/xtest
132 $(q)$(foreach obj,$(objs), rm -f $(obj))