Makefile.arduino 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. TARGET_DEVICE ?= atmega328p
  2. HWTYPE ?= HYDRO_TARGET_DEVICE_ATMEGA328
  3. ARDUINO_HOME ?= /Applications/Arduino.app/Contents/Java
  4. ARDUINO_TOOLS ?= $(ARDUINO_HOME)/hardware/tools/avr/bin
  5. AR = $(ARDUINO_TOOLS)/avr-gcc-ar
  6. CC = $(ARDUINO_TOOLS)/avr-gcc
  7. RANLIB = $(ARDUINO_TOOLS)/avr-gcc-ranlib
  8. WFLAGS ?= -Wall -Wextra -Wmissing-prototypes -Wdiv-by-zero -Wbad-function-cast -Wcast-align -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wnested-externs -Wno-unknown-pragmas -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wno-type-limits
  9. CFLAGS ?= -mmcu=$(TARGET_DEVICE) -Os -mcall-prologues -fno-exceptions -ffunction-sections -fdata-sections -flto $(WFLAGS)
  10. CFLAGS += -I. -I$(ARDUINO_HOME)/hardware/arduino/avr/cores/arduino -I$(ARDUINO_HOME)/hardware/arduino/avr/variants/standard
  11. CFLAGS += -DHYDRO_HWTYPE=$(HYDRO_HWTYPE)
  12. OBJ = hydrogen.o
  13. ARDUINO_PACKAGE ?= hydrogen-crypto.zip
  14. SRC = \
  15. hydrogen.c \
  16. hydrogen.h \
  17. impl/common.h \
  18. impl/core.h \
  19. impl/gimli-core.h \
  20. impl/hash.h \
  21. impl/hydrogen_p.h \
  22. impl/kdf.h \
  23. impl/kx.h \
  24. impl/pwhash.h \
  25. impl/random.h \
  26. impl/secretbox.h \
  27. impl/sign.h \
  28. impl/x25519.h \
  29. impl/gimli-core/portable.h \
  30. impl/random/*.h
  31. all: lib package
  32. package: $(ARDUINO_PACKAGE)
  33. $(ARDUINO_PACKAGE):
  34. 7z a -tzip -mx=9 -r $(ARDUINO_PACKAGE) $(SRC) library.properties
  35. lib: libhydrogen.a
  36. $(OBJ): $(SRC)
  37. libhydrogen.a: $(OBJ)
  38. $(AR) -ar cr $@ $^
  39. $(RANLIB) $@
  40. .PHONY: clean
  41. clean:
  42. rm -f libhydrogen.a $(OBJ)
  43. rm -f tests/tests
  44. rm -f $(ARDUINO_PACKAGE)