Makefile.arduino 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. all: lib package
  31. package: $(ARDUINO_PACKAGE)
  32. $(ARDUINO_PACKAGE):
  33. 7z a -tzip -mx=9 -r $(ARDUINO_PACKAGE) $(SRC) library.properties
  34. lib: libhydrogen.a
  35. $(OBJ): $(SRC)
  36. libhydrogen.a: $(OBJ)
  37. $(AR) -ar cr $@ $^
  38. $(RANLIB) $@
  39. .PHONY: clean
  40. clean:
  41. rm -f libhydrogen.a $(OBJ)
  42. rm -f tests/tests
  43. rm -f $(ARDUINO_PACKAGE)