1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

programs: Link to tests common code

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron
2020-06-05 16:00:22 +02:00
parent ddaf99c9d4
commit 8dc0af2d4b
66 changed files with 259 additions and 232 deletions

View File

@@ -7,9 +7,13 @@ WARNING_CFLAGS ?= -Wall -Wextra
WARNING_CXXFLAGS ?= -Wall -Wextra
LDFLAGS ?=
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64
MBEDTLS_TEST_PATH:=../tests/src
MBEDTLS_TEST_OBJS:=$(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/*.c))
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../tests/include -I../include -D_FILE_OFFSET_BITS=64
LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) -I../include -D_FILE_OFFSET_BITS=64
LOCAL_LDFLAGS = -L../library \
LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \
-L../library \
-lmbedtls$(SHARED_SUFFIX) \
-lmbedx509$(SHARED_SUFFIX) \
-lmbedcrypto$(SHARED_SUFFIX)
@@ -18,10 +22,11 @@ include ../3rdparty/Makefile.inc
LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES)
ifndef SHARED
DEP=../library/libmbedcrypto.a ../library/libmbedx509.a ../library/libmbedtls.a
MBEDLIBS=../library/libmbedcrypto.a ../library/libmbedx509.a ../library/libmbedtls.a
else
DEP=../library/libmbedcrypto.$(DLEXT) ../library/libmbedx509.$(DLEXT) ../library/libmbedtls.$(DLEXT)
MBEDLIBS=../library/libmbedcrypto.$(DLEXT) ../library/libmbedx509.$(DLEXT) ../library/libmbedtls.$(DLEXT)
endif
DEP=${MBEDLIBS} ${MBEDTLS_TEST_OBJS}
ifdef DEBUG
LOCAL_CFLAGS += -g3
@@ -127,12 +132,15 @@ ifndef WINDOWS
all: fuzz
endif
fuzz:
fuzz: ${MBEDTLS_TEST_OBJS}
$(MAKE) -C fuzz THIRDPARTY_INCLUDES=$(THIRDPARTY_INCLUDES)
$(DEP):
$(MBEDLIBS):
$(MAKE) -C ../library
${MBEDTLS_TEST_OBJS}:
$(MAKE) -C ../tests mbedtls_test
ifdef WINDOWS
EXTRA_GENERATED += psa\psa_constant_names_generated.c
else

View File

@@ -4,7 +4,7 @@ set(executables
)
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} mbedcrypto)
endforeach()

View File

@@ -32,7 +32,7 @@ set(executables_with_common_c
foreach(exe IN LISTS executables_no_common_c executables_with_common_c)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
if (NOT FUZZINGENGINE_LIB)
target_link_libraries(${exe} ${libs})

View File

@@ -1,6 +1,9 @@
MBEDTLS_TEST_PATH:=../../tests/src
MBEDTLS_TEST_OBJS:=$(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/*.c))
LOCAL_CFLAGS = -I../../include -D_FILE_OFFSET_BITS=64
LOCAL_LDFLAGS = -L../../library \
LOCAL_CFLAGS = -I../../tests/include -I../../include -D_FILE_OFFSET_BITS=64
LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \
-L../../library \
-lmbedtls$(SHARED_SUFFIX) \
-lmbedx509$(SHARED_SUFFIX) \
-lmbedcrypto$(SHARED_SUFFIX)

View File

@@ -4,7 +4,7 @@ set(executables
)
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} mbedcrypto)
endforeach()

View File

@@ -4,7 +4,7 @@ set(executables_mbedtls
)
foreach(exe IN LISTS executables_mbedtls)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} mbedtls)
endforeach()
@@ -30,7 +30,7 @@ set(executables_mbedcrypto
)
foreach(exe IN LISTS executables_mbedcrypto)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} mbedcrypto)
endforeach()

View File

@@ -5,8 +5,9 @@ set(executables
)
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} mbedtls)
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()
target_include_directories(psa_constant_names PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

View File

@@ -5,7 +5,7 @@ set(executables
)
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} mbedcrypto)
endforeach()

View File

@@ -27,15 +27,16 @@ set(executables
)
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} ${libs})
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
endforeach()
target_sources(ssl_client2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
target_sources(ssl_server2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
if(THREADS_FOUND)
add_executable(ssl_pthread_server ssl_pthread_server.c)
add_executable(ssl_pthread_server ssl_pthread_server.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT})
list(APPEND executables ssl_pthread_server)
endif(THREADS_FOUND)

View File

@@ -26,7 +26,7 @@ if(TEST_CPP)
endif()
foreach(exe IN LISTS executables_libs executables_mbedcrypto)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
# This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3
list(FIND executables_libs ${exe} exe_index)

View File

@@ -8,7 +8,7 @@ set(executables
)
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} ${libs})
endforeach()

View File

@@ -19,7 +19,7 @@ set(executables
)
foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
target_link_libraries(${exe} ${libs})
endforeach()