blob: fa71d83920030f546901377c1b811e837cb7a8fc [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 \
Pascal Brandc639ac82015-07-02 08:53:34 +020035 xtest_helpers.c \
36 xtest_main.c \
37 xtest_test.c \
38 adbg/src/adbg_case.c \
39 adbg/src/adbg_enum.c \
40 adbg/src/adbg_expect.c \
41 adbg/src/adbg_log.c \
42 adbg/src/adbg_mts.c \
43 adbg/src/adbg_run.c \
44 adbg/src/adbg_util.c \
45 adbg/src/r_list_genutil.c \
46 adbg/src/security_utils_hex.c \
47 adbg/src/security_utils_mem.c
48
Jerome Forissiere3688342015-09-24 10:45:17 -070049ifdef CFG_GP_PACKAGE_PATH
50CFLAGS += -DWITH_GP_TESTS
Pascal Brand8a74e362015-09-10 12:41:52 +020051
Pascal Brandc639ac82015-07-02 08:53:34 +020052srcs += xtest_7500.c \
53 xtest_8000.c \
54 xtest_8500.c \
55 xtest_9000.c
56endif
57
58objs := $(patsubst %.c,$(O)/%.o, $(srcs))
59
60CFLAGS += -I./
61CFLAGS += -I./adbg/include
62CFLAGS += -I./xml/include
63
64CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
65CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
66
67CFLAGS += -I../../ta/create_fail_test/include
68CFLAGS += -I../../ta/crypt/include
69CFLAGS += -I../../ta/enc_fs/include
70CFLAGS += -I../../ta/os_test/include
71CFLAGS += -I../../ta/rpc_test/include
72CFLAGS += -I../../ta/sims/include
73CFLAGS += -I../../ta/storage/include
Jens Wiklanderac27ec12015-07-15 15:23:14 +020074CFLAGS += -I../../ta/concurrent/include
Jerome Forissiere3688342015-09-24 10:45:17 -070075ifdef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +020076CFLAGS += -I../../ta/GP_TTA_Arithmetical
77CFLAGS += -I../../ta/GP_TTA_Crypto
78CFLAGS += -I../../ta/GP_TTA_DS
79CFLAGS += -I../../ta/GP_TTA_TCF
80CFLAGS += -I../../ta/GP_TTA_TCF_ICA
81CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
82CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
83CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
84CFLAGS += -I../../ta/GP_TTA_Time
85CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
86CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
87CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
88CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
89CFLAGS += -I../../ta/GP_TTA_testingClientAPI
90
91# need more include: openssl
92CFLAGS += -Ifor_gp/include
93
94# need more libraries: openssl
Pascal Brandfd1596a2015-07-10 15:02:17 +020095ifeq ($(CFG_ARM32),y)
96LDFLAGS += ../lib/armv7/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +020097else
Pascal Brandfd1596a2015-07-10 15:02:17 +020098LDFLAGS += ../lib/armv8/libcrypto.a
Pascal Brandc639ac82015-07-02 08:53:34 +020099endif
100
Pascal Brandc639ac82015-07-02 08:53:34 +0200101endif
102
103# FIXME: Check if and why we need this flag?
104CFLAGS += -DUSER_SPACE
Cedric Chaumont1390f3a2015-08-31 13:55:16 +0200105ifeq ($(CFG_ENC_FS),y)
106CFLAGS += -DCFG_ENC_FS
107endif
Pascal Brandc639ac82015-07-02 08:53:34 +0200108
Jerome Forissiere3688342015-09-24 10:45:17 -0700109ifndef CFG_GP_PACKAGE_PATH
Pascal Brandc639ac82015-07-02 08:53:34 +0200110CFLAGS += -Wall -Wcast-align -Werror \
111 -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
112 -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
113 -Wmissing-declarations -Wmissing-format-attribute \
114 -Wmissing-include-dirs -Wmissing-noreturn \
115 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
116 -Wshadow -Wstrict-prototypes -Wswitch-default \
117 -Wwrite-strings \
118 -Wno-missing-field-initializers -Wno-format-zero-length
119endif
120
121LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
122LDFLAGS += -lpthread
123
124.PHONY: all
125all: xtest
126
127xtest: $(objs)
128 @echo " LD $(O)/$@"
129 $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
130
131$(O)/%.o: $(CURDIR)/%.c
132 $(q)mkdir -p $(O)/adbg/src
133 @echo ' CC $<'
134 $(q)$(CC) $(CFLAGS) -c $< -o $@
135
136.PHONY: clean
137clean:
138 @echo ' CLEAN $(O)'
139 $(q)rm -f $(O)/xtest
140 $(q)$(foreach obj,$(objs), rm -f $(obj))