1MBEDTLS_TEST_PATH:=../../tests/src 2MBEDTLS_TEST_OBJS:=$(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/*.c ${MBEDTLS_TEST_PATH}/drivers/*.c)) 3 4CFLAGS ?= -O2 5WARNING_CFLAGS ?= -Wall -Wextra 6LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../../tests/include -I../../include -D_FILE_OFFSET_BITS=64 7LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \ 8 -L../../library \ 9 -lmbedtls$(SHARED_SUFFIX) \ 10 -lmbedx509$(SHARED_SUFFIX) \ 11 -lmbedcrypto$(SHARED_SUFFIX) 12 13LOCAL_CFLAGS += $(patsubst -I../%,-I../../%,$(THIRDPARTY_INCLUDES)) 14 15ifndef SHARED 16DEP=../../library/libmbedcrypto.a ../../library/libmbedx509.a ../../library/libmbedtls.a 17else 18DEP=../../library/libmbedcrypto.$(DLEXT) ../../library/libmbedx509.$(DLEXT) ../../library/libmbedtls.$(DLEXT) 19endif 20 21 22DLEXT ?= so 23EXEXT= 24SHARED_SUFFIX= 25 26ifdef FUZZINGENGINE 27LOCAL_LDFLAGS += -lFuzzingEngine 28endif 29 30# A test application is built for each suites/test_suite_*.data file. 31# Application name is same as .data file's base name and can be 32# constructed by stripping path 'suites/' and extension .data. 33APPS = $(basename $(wildcard fuzz_*.c)) 34 35# Construct executable name by adding OS specific suffix $(EXEXT). 36BINARIES := $(addsuffix $(EXEXT),$(APPS)) 37 38.SILENT: 39 40.PHONY: all check test clean 41 42all: $(BINARIES) 43 44$(DEP): 45 $(MAKE) -C ../../library 46 47C_FILES := $(addsuffix .c,$(APPS)) 48 49%.o: %.c 50 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c $< -o $@ 51 52 53ifdef FUZZINGENGINE 54$(BINARIES): %$(EXEXT): %.o common.o $(DEP) 55 echo " $(CC) common.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@" 56 $(CXX) common.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ 57else 58$(BINARIES): %$(EXEXT): %.o common.o onefile.o $(DEP) 59 echo " $(CC) common.o onefile.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@" 60 $(CC) common.o onefile.o $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ 61endif 62 63clean: 64ifndef WINDOWS 65 rm -rf $(BINARIES) *.o 66else 67 if exist *.o del /Q /F *.o 68 if exist *.exe del /Q /F *.exe 69endif 70