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