# Arduboy project Makefile, by Spectere. # # Calling "make setup" will install the required components and libraries to # your system. # # Requires: arduino-cli, GNU make (probably) PROJECT_NAME = hello ARDUINO-CLI = arduino-cli RM = rm BIN = bin SRC = ${PROJECT_NAME} TARGET=$(shell ${ARDUINO-CLI} board list | grep arduino:avr:leonardo | awk '{print $$1}') # credit: kenorb # https://stackoverflow.com/questions/18136918/how-to-get-current-relative-directory-of-your-makefile CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) all: compile setup: # Platforms ${ARDUINO-CLI} core install arduino:avr # Libraries ${ARDUINO-CLI} lib install Arduboy ${ARDUINO-CLI} lib install Arduboy2 ${ARDUINO-CLI} lib install ArdBitmap ${ARDUINO-CLI} lib install ArdVoice ${ARDUINO-CLI} lib install ArduboyPlaytune ${ARDUINO-CLI} lib install Arduboy-TinyFont ${ARDUINO-CLI} lib install ArduboyTones ${ARDUINO-CLI} lib install FixedPoints # Fin ${ARDUINO-CLI} core update-index clean: ${RM} -r ${BIN} compile: cd ${CWD} ${ARDUINO-CLI} compile --fqbn arduino:avr:leonardo ${SRC} --output-dir ${CWD}/${BIN} upload: compile cd ${CWD} @if [ "$(strip ${TARGET})" = "" ]; then\ echo Arduboy could not be found. Is it plugged in and turned on\?;\ exit 1;\ else\ ${ARDUINO-CLI} upload --fqbn arduino:avr:leonardo --input-dir ${BIN} -p ${TARGET} ${PROJECT_NAME};\ fi