Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 1 | # 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. |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 4 | |
| 5 | include ../../scripts/common.mk |
| 6 | out-dir := $(call strip-trailing-slashes-and-dots,$(O)) |
| 7 | ifeq ($(out-dir),) |
| 8 | $(error invalid output directory (O=$(O))) |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 9 | endif |
| 10 | |
Cedric Chaumont | 1390f3a | 2015-08-31 13:55:16 +0200 | [diff] [blame] | 11 | include $(TA_DEV_KIT_DIR)/host_include/conf.mk |
| 12 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 13 | # By default we expect optee_client exported folder to be on a certain relative |
| 14 | # path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will |
| 15 | # be used instead. |
| 16 | OPTEE_CLIENT_EXPORT ?= ../../../optee_client/out/export |
| 17 | |
Sumit Garg | 0e00914 | 2015-11-04 15:34:07 -0500 | [diff] [blame] | 18 | CC ?= $(CROSS_COMPILE)gcc |
| 19 | CPP ?= $(CROSS_COMPILE)cpp |
| 20 | LD ?= $(CROSS_COMPILE)ld |
| 21 | AR ?= $(CROSS_COMPILE)ar |
| 22 | NM ?= $(CROSS_COMPILE)nm |
| 23 | OBJCOPY ?= $(CROSS_COMPILE)objcopy |
| 24 | OBJDUMP ?= $(CROSS_COMPILE)objdump |
| 25 | READELF ?= $(CROSS_COMPILE)readelf |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 26 | |
Jerome Forissier | c6aac93 | 2015-09-24 17:45:08 -0700 | [diff] [blame] | 27 | ifdef CFG_GP_PACKAGE_PATH |
| 28 | GP := _gp |
| 29 | endif |
| 30 | |
Jens Wiklander | 02389a9 | 2016-12-16 11:13:38 +0100 | [diff] [blame] | 31 | srcs := xtest_1000.c |
| 32 | |
| 33 | ifeq ($(CFG_GP_SOCKETS),y) |
| 34 | srcs += xtest_2000.c \ |
| 35 | sock_server.c \ |
| 36 | rand_stream.c |
| 37 | endif |
| 38 | |
| 39 | srcs += xtest_4000.c \ |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 40 | xtest_5000.c \ |
| 41 | xtest_6000.c \ |
Jerome Forissier | c6aac93 | 2015-09-24 17:45:08 -0700 | [diff] [blame] | 42 | xtest_7000$(GP).c \ |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 43 | xtest_10000.c \ |
Cedric Chaumont | 1390f3a | 2015-08-31 13:55:16 +0200 | [diff] [blame] | 44 | xtest_20000.c \ |
James Kung | 35b352d | 2015-09-07 18:01:16 +0800 | [diff] [blame] | 45 | xtest_benchmark_1000.c \ |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 46 | xtest_benchmark_2000.c \ |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 47 | xtest_helpers.c \ |
| 48 | xtest_main.c \ |
| 49 | xtest_test.c \ |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 50 | sha_perf.c \ |
Igor Opaniuk | 44aff4b | 2016-09-16 10:18:00 +0300 | [diff] [blame] | 51 | aes_perf.c \ |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 52 | adbg/src/adbg_case.c \ |
| 53 | adbg/src/adbg_enum.c \ |
| 54 | adbg/src/adbg_expect.c \ |
| 55 | adbg/src/adbg_log.c \ |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 56 | adbg/src/adbg_run.c \ |
Jens Wiklander | cbebdcf | 2016-12-27 22:06:51 +0100 | [diff] [blame] | 57 | adbg/src/security_utils_hex.c |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 58 | |
Etienne Carriere | 41343db | 2017-03-17 15:38:52 +0100 | [diff] [blame^] | 59 | ifeq ($(CFG_SECURE_DATA_PATH),y) |
| 60 | srcs += sdp_basic.c |
| 61 | endif |
| 62 | |
Jerome Forissier | e368834 | 2015-09-24 10:45:17 -0700 | [diff] [blame] | 63 | ifdef CFG_GP_PACKAGE_PATH |
| 64 | CFLAGS += -DWITH_GP_TESTS |
Pascal Brand | 8a74e36 | 2015-09-10 12:41:52 +0200 | [diff] [blame] | 65 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 66 | srcs += xtest_7500.c \ |
| 67 | xtest_8000.c \ |
| 68 | xtest_8500.c \ |
| 69 | xtest_9000.c |
| 70 | endif |
| 71 | |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 72 | objs := $(patsubst %.c,$(out-dir)/xtest/%.o, $(srcs)) |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 73 | |
| 74 | CFLAGS += -I./ |
| 75 | CFLAGS += -I./adbg/include |
| 76 | CFLAGS += -I./xml/include |
| 77 | |
| 78 | CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include |
| 79 | CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include |
| 80 | |
| 81 | CFLAGS += -I../../ta/create_fail_test/include |
| 82 | CFLAGS += -I../../ta/crypt/include |
| 83 | CFLAGS += -I../../ta/enc_fs/include |
| 84 | CFLAGS += -I../../ta/os_test/include |
| 85 | CFLAGS += -I../../ta/rpc_test/include |
| 86 | CFLAGS += -I../../ta/sims/include |
| 87 | CFLAGS += -I../../ta/storage/include |
James Kung | df1e6cf | 2015-09-14 22:42:24 +0800 | [diff] [blame] | 88 | CFLAGS += -I../../ta/storage_benchmark/include |
Jens Wiklander | ac27ec1 | 2015-07-15 15:23:14 +0200 | [diff] [blame] | 89 | CFLAGS += -I../../ta/concurrent/include |
Jens Wiklander | 7067297 | 2016-04-06 00:01:45 +0200 | [diff] [blame] | 90 | CFLAGS += -I../../ta/concurrent_large/include |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 91 | CFLAGS += -I../../ta/sha_perf/include |
Igor Opaniuk | 44aff4b | 2016-09-16 10:18:00 +0300 | [diff] [blame] | 92 | CFLAGS += -I../../ta/aes_perf/include |
Jens Wiklander | 02389a9 | 2016-12-16 11:13:38 +0100 | [diff] [blame] | 93 | CFLAGS += -I../../ta/socket/include |
Etienne Carriere | 41343db | 2017-03-17 15:38:52 +0100 | [diff] [blame^] | 94 | CFLAGS += -I../../ta/sdp_basic/include |
| 95 | |
Jerome Forissier | e368834 | 2015-09-24 10:45:17 -0700 | [diff] [blame] | 96 | ifdef CFG_GP_PACKAGE_PATH |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 97 | CFLAGS += -I../../ta/GP_TTA_Arithmetical |
| 98 | CFLAGS += -I../../ta/GP_TTA_Crypto |
| 99 | CFLAGS += -I../../ta/GP_TTA_DS |
| 100 | CFLAGS += -I../../ta/GP_TTA_TCF |
| 101 | CFLAGS += -I../../ta/GP_TTA_TCF_ICA |
| 102 | CFLAGS += -I../../ta/GP_TTA_TCF_ICA2 |
| 103 | CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA |
| 104 | CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA |
| 105 | CFLAGS += -I../../ta/GP_TTA_Time |
| 106 | CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke |
| 107 | CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession |
| 108 | CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke |
| 109 | CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters |
| 110 | CFLAGS += -I../../ta/GP_TTA_testingClientAPI |
| 111 | |
| 112 | # need more include: openssl |
| 113 | CFLAGS += -Ifor_gp/include |
| 114 | |
Pascal Brand | baa291f | 2016-02-26 10:14:22 +0100 | [diff] [blame] | 115 | # by default, the client application is compiled as the kernel of optee-os |
Pascal Brand | fd1596a | 2015-07-10 15:02:17 +0200 | [diff] [blame] | 116 | ifeq ($(CFG_ARM32),y) |
Pascal Brand | baa291f | 2016-02-26 10:14:22 +0100 | [diff] [blame] | 117 | COMPILE_NS_USER ?= 32 |
| 118 | else |
| 119 | COMPILE_NS_USER ?= 64 |
| 120 | endif |
| 121 | |
| 122 | ifeq ($(COMPILE_NS_USER),32) |
Pascal Brand | fd1596a | 2015-07-10 15:02:17 +0200 | [diff] [blame] | 123 | LDFLAGS += ../lib/armv7/libcrypto.a |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 124 | else |
Pascal Brand | fd1596a | 2015-07-10 15:02:17 +0200 | [diff] [blame] | 125 | LDFLAGS += ../lib/armv8/libcrypto.a |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 126 | endif |
| 127 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 128 | endif |
| 129 | |
Jerome Forissier | f9b8925 | 2016-08-23 18:30:43 +0200 | [diff] [blame] | 130 | # Include configuration file generated by OP-TEE OS (CFG_* macros) |
| 131 | CFLAGS += -include conf.h |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 132 | |
Jerome Forissier | e368834 | 2015-09-24 10:45:17 -0700 | [diff] [blame] | 133 | ifndef CFG_GP_PACKAGE_PATH |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 134 | CFLAGS += -Wall -Wcast-align -Werror \ |
| 135 | -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ |
| 136 | -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ |
| 137 | -Wmissing-declarations -Wmissing-format-attribute \ |
| 138 | -Wmissing-include-dirs -Wmissing-noreturn \ |
| 139 | -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ |
| 140 | -Wshadow -Wstrict-prototypes -Wswitch-default \ |
| 141 | -Wwrite-strings \ |
| 142 | -Wno-missing-field-initializers -Wno-format-zero-length |
| 143 | endif |
| 144 | |
Jerome Forissier | a8b78f1 | 2016-08-17 09:40:59 +0200 | [diff] [blame] | 145 | CFLAGS += -g3 |
| 146 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 147 | LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 148 | LDFLAGS += -lpthread -lm |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 149 | |
| 150 | .PHONY: all |
| 151 | all: xtest |
| 152 | |
| 153 | xtest: $(objs) |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 154 | @echo " LD $(out-dir)/xtest/$@" |
| 155 | $(q)@$(CC) -o $(out-dir)/xtest/$@ $+ $(LDFLAGS) |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 156 | |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 157 | $(out-dir)/xtest/%.o: $(CURDIR)/%.c |
| 158 | $(q)mkdir -p $(out-dir)/xtest/adbg/src |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 159 | @echo ' CC $<' |
| 160 | $(q)$(CC) $(CFLAGS) -c $< -o $@ |
| 161 | |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 162 | RMDIR := rmdir --ignore-fail-on-non-empty |
| 163 | define rm-build-dirs |
| 164 | $(q)for d in $1; do $(RMDIR) $(out-dir)/xtest/$$d 2> /dev/null; true; done |
| 165 | $(q)$(RMDIR) $(out-dir)/xtest 2> /dev/null; true |
| 166 | $(q)$(RMDIR) $(out-dir) 2> /dev/null; true |
| 167 | endef |
| 168 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 169 | .PHONY: clean |
| 170 | clean: |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 171 | @echo ' CLEAN $(out-dir)' |
| 172 | $(q)rm -f $(out-dir)/xtest/xtest |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 173 | $(q)$(foreach obj,$(objs), rm -f $(obj)) |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 174 | $(call rm-build-dirs,adbg/src adbg) |