blob: 85dd437c27244cbf43c051feb9120850f6ddedc4 [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
Jerome Forissiere3688342015-09-24 10:45:17 -070042ifdef CFG_GP_PACKAGE_PATH
43CFLAGS += -DWITH_GP_TESTS
Pascal Brand8a74e362015-09-10 12:41:52 +020044
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
Jerome Forissiere3688342015-09-24 10:45:17 -070067ifdef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020068CFLAGS += -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
Pascal Brandc639ac82015-07-02 08:53:34 +020093endif
94
95# FIXME: Check if and why we need this flag?
96CFLAGS += -DUSER_SPACE
97
Jerome Forissiere3688342015-09-24 10:45:17 -070098ifndef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020099CFLAGS += -Wall -Wcast-align -Werror \
100 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
101 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
102 -Wmissing-declarations -Wmissing-format-attribute \
103 -Wmissing-include-dirs -Wmissing-noreturn \
104 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
105 -Wshadow -Wstrict-prototypes -Wswitch-default \
106 -Wwrite-strings \
107 -Wno-missing-field-initializers -Wno-format-zero-length
108endif
109
110LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
111LDFLAGS += -lpthread
112
113.PHONY: all
114all: xtest
115
116xtest: $(objs)
117 @echo " LD $(O)/$@"
118 $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
119
120$(O)/%.o: $(CURDIR)/%.c
121 $(q)mkdir -p $(O)/adbg/src
122 @echo ' CC $<'
123 $(q)$(CC) $(CFLAGS) -c $< -o $@
124
125.PHONY: clean
126clean:
127 @echo ' CLEAN $(O)'
128 $(q)rm -f $(O)/xtest
129 $(q)$(foreach obj,$(objs), rm -f $(obj))