Makefile 1.8 KB

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