Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. CFLAGS += -g -O0 -std=gnu99 -fPIC -Wall -Wextra -Werror \
  2. -Wno-unused-parameter -Wno-missing-field-initializers
  3. CPPFLAGS += -I./ext
  4. ifdef WITH_ASAN
  5. LDFLAGS += -fsanitize=address
  6. CFLAGS += -fsanitize=address
  7. endif
  8. ifdef WITH_COVERAGE
  9. LDFLAGS += -coverage
  10. CFLAGS += -coverage
  11. endif
  12. ifdef WITH_VALGRIND
  13. VALGRIND := valgrind --leak-check=full --show-reachable=yes --track-origins=yes
  14. TEST_OPT := --no-exec
  15. endif
  16. TARGETS = testaes testmodes testsha1 testsha2 testsha3 testsalsa20 \
  17. testcurve25519 testpoly1305 testnorx testchacha20poly1305 \
  18. testdrbg
  19. all: $(TARGETS)
  20. SOURCES = aes.o sha256.o sha512.o chash.o hmac.o pbkdf2.o modes.o eax.o \
  21. gf128.o blockwise.o cmac.o salsa20.o chacha20.o curve25519.o \
  22. gcm.o cbcmac.o ccm.o sha3.o sha1.o poly1305.o \
  23. norx.o chacha20poly1305.o drbg.o ocb.o
  24. testaes: $(SOURCES) testaes.o
  25. testmodes: $(SOURCES) testmodes.o
  26. testsha1: $(SOURCES) testsha1.o
  27. testsha2: $(SOURCES) testsha2.o
  28. testsha3: $(SOURCES) testsha3.o
  29. testsalsa20: $(SOURCES) testsalsa20.o
  30. testcurve25519: $(SOURCES) testcurve25519.o
  31. testpoly1305: $(SOURCES) testpoly1305.o
  32. testnorx: $(SOURCES) testnorx.o
  33. testchacha20poly1305: $(SOURCES) testchacha20poly1305.o
  34. testdrbg: $(SOURCES) testdrbg.o
  35. clean:
  36. rm -f *.o *.pyc $(TARGETS) *.gcov *.gcda *.gcno
  37. test: $(TARGETS)
  38. for x in $(TARGETS) ; do \
  39. echo "Running $$x" ; \
  40. $(VALGRIND) ./$$x $(TEST_OPT) ; \
  41. done
  42. cover: test
  43. gcov *.c
  44. echo 'Lines with missing coverage:'
  45. grep '#####' *.gcov | grep -vE '(cutest|testutil).h.gcov'