From 053db696b37dfccb4e251ebd22c532438f92b0ef Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Fri, 5 Jan 2024 18:11:32 +0000 Subject: [PATCH] Allow programs/fuzz to be linked against pthread Use the same mechanisms used to link other programs against pthread with make, i.e. include common.make, and remove common code from programs/ fuzz/Makefile Signed-off-by: Paul Elliott --- programs/fuzz/Makefile | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/programs/fuzz/Makefile b/programs/fuzz/Makefile index 3b9b50df8..afe80b7d5 100644 --- a/programs/fuzz/Makefile +++ b/programs/fuzz/Makefile @@ -1,40 +1,17 @@ -MBEDTLS_TEST_PATH:=../../tests/src -MBEDTLS_TEST_OBJS:=$(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/*.c ${MBEDTLS_TEST_PATH}/drivers/*.c)) +MBEDTLS_TEST_PATH:=../../tests -CFLAGS ?= -O2 -WARNING_CFLAGS ?= -Wall -Wextra LOCAL_CFLAGS = $(WARNING_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) +MBEDTLS_PATH := ../.. +include ../../scripts/common.make LOCAL_CFLAGS += $(patsubst -I../%,-I../../%,$(THIRDPARTY_INCLUDES)) -ifndef SHARED -DEP=../../library/libmbedcrypto.a ../../library/libmbedx509.a ../../library/libmbedtls.a -else -DEP=../../library/libmbedcrypto.$(DLEXT) ../../library/libmbedx509.$(DLEXT) ../../library/libmbedtls.$(DLEXT) -endif - - -DLEXT ?= so -EXEXT= -SHARED_SUFFIX= +DEP=${MBEDLIBS} ifdef FUZZINGENGINE LOCAL_LDFLAGS += -lFuzzingEngine endif -ifdef WINDOWS_BUILD -LOCAL_LDFLAGS += -lbcrypt -else -ifeq ($(THREADING),pthread) -LOCAL_LDFLAGS += -lpthread -endif -endif - # A test application is built for each suites/test_suite_*.data file. # Application name is same as .data file's base name and can be # constructed by stripping path 'suites/' and extension .data. @@ -49,9 +26,6 @@ BINARIES := $(addsuffix $(EXEXT),$(APPS)) all: $(BINARIES) -$(DEP): - $(MAKE) -C ../../library - C_FILES := $(addsuffix .c,$(APPS)) %.o: %.c