Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. CFLAGS := -g -ggdb -Wall -Wextra -std=c11
  2. CINCS := -I. -I/usr/local/wolfssl
  3. CLIBS := -L/usr/local/lib
  4. CDEPS := -lc -lg -lm -lwolfssl
  5. WOLFSSL_BUILD=build
  6. MKDIR_P = mkdir -p
  7. ENABLE_DEBUG_UART_IO := off
  8. ENABLE_DEBUG_UART_IO_EXTRA := off
  9. ENABLE_SECRET_CALLBACK := off
  10. ifeq ($(ENABLE_DEBUG_UART_IO), on)
  11. CFLAGS+=-DDEBUG_UART_IO
  12. endif
  13. ifeq ($(ENABLE_DEBUG_UART_IO_EXTRA), on)
  14. CFLAGS+=-DDEBUG_UART_IO -DDEBUG_UART_IO_EXTRA_VERBOSE
  15. endif
  16. ifeq ($(ENABLE_SECRET_CALLBACK), on)
  17. CFLAGS+=-DUSE_SECRET_CALLBACK
  18. endif
  19. OBJS:=$(WOLFSSL_BUILD)/main.o $(WOLFSSL_BUILD)/client-tls13.o
  20. default: all
  21. .PHONY: all clean help
  22. define run-help =
  23. echo "Run 'make TARGET* OPTION*'"
  24. echo ""
  25. echo "TARGET (specify 0 or more):"
  26. echo " all (default target)"
  27. echo " Build main.bin executable"
  28. echo " main.bin"
  29. echo " Build main.bin executable"
  30. echo " main.o"
  31. echo " Build main.o"
  32. echo " client-tls13.o"
  33. echo " Build client-tls13.o"
  34. echo " clean"
  35. echo " Clean *.o and *.bin"
  36. echo " help"
  37. echo " This help"
  38. echo ""
  39. echo "OPTION (specify 0 or more):"
  40. echo " ENABLE_DEBUG_UART_IO=on|off (default off)"
  41. echo " Enable printing ASCII characters sent and received by the UART"
  42. echo " ENABLE_DEBUG_UART_IO_EXTRA=on|off (default off)"
  43. echo " Enable more printing hex characters sent and received by the UART"
  44. echo " Setting this on implicitly sets ENABLE_DEBUG_UART_IO=on"
  45. echo " ENABLE_SECRET_CALLBACK=on|off (default off)"
  46. echo " Enable secret callback for TLS 1.3 handshaking, which can be useful for wireshark sniffing"
  47. echo ""
  48. echo "Example:"
  49. echo " make all ENABLE_DEBUG_UART_IO_EXTRA=on"
  50. echo ""
  51. endef
  52. help:
  53. @$(run-help)
  54. all: directories main.bin
  55. directories: $(WOLFSSL_BUILD)
  56. $(WOLFSSL_BUILD):
  57. ${MKDIR_P} $(WOLFSSL_BUILD)
  58. main.bin: $(OBJS)
  59. $(CC) $(CFLAGS) $(CINCS) $(CLIBS) -o $@ $^ $(CDEPS)
  60. $(WOLFSSL_BUILD)/main.o: main.c
  61. $(CC) $(CFLAGS) $(CINCS) $(CLIBS) -c -o $@ $^ $(CDEPS)
  62. $(WOLFSSL_BUILD)/client-tls13.o: client-tls13.c
  63. $(CC) $(CFLAGS) $(CINCS) $(CLIBS) -c -o $@ $^ $(CDEPS)
  64. clean:
  65. rm -f *.o *.bin
  66. rm -rf build