From e39eb807c99304df08ea3955444f3b22b1c1afb8 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 22 Jan 2016 00:01:03 -0800 Subject: [PATCH] New makefile that uses the wonderful new arduino-builder --- Makefile | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e73fd773..1845d83e 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,41 @@ BOARD = model01 PORT = /dev/cu.usbmodem1421 ARDUINO_LIBS = -THIRD_PARTY_HARDWARE=hardware/keyboardio/avr -#ARDUINO_CORE_PATH = hardware/keyboardio/cores/keyboardio -#ALTERNATE_CORE = keyboardio GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always) -include ./_Makefile.Master + +ARDUINO_PATH=/Applications/Arduino.app/Contents/Java/ + +FQBN=arduino:avr:leonardo +BUILD_PATH=./build +ABS_BUILD_PATH=`cd "$(BUILD_PATH)"; pwd` + +ARDUINO_LOCAL_LIB_PATH=~/Documents/Arduino/libraries +ARDUINO_IDE_VERSION=100607 + +SKETCH=KeyboardioFirmware.ino + astyle: - find . -type f -name \*.cpp |xargs -n 1 astyle --style=google - find . -type f -name \*.ino |xargs -n 1 astyle --style=google - find . -type f -name \*.h |xargs -n 1 astyle --style=google + find . -type f -name \*.cpp |xargs -n 1 astyle --style=google + find . -type f -name \*.ino |xargs -n 1 astyle --style=google + find . -type f -name \*.h |xargs -n 1 astyle --style=google generate-keymaps: -rm keymaps_generated.h cd layouts && ( find . -type f |xargs -n 1 -I % sh -c 'perl ../tools/generate_keymaps.pl < % >> ../keymaps_generated.h' ) cat keymaps_h-template >> keymaps_generated.h + +compile: + -mkdir $(ABS_BUILD_PATH) + $(ARDUINO_PATH)/arduino-builder \ + -hardware $(ARDUINO_PATH)/hardware \ + -tools $(ARDUINO_PATH)/hardware/tools \ + -tools $(ARDUINO_PATH)/tools-builder \ + -fqbn $(FQBN) \ + -libraries $(ARDUINO_LOCAL_LIB_PATH) \ + -verbose \ + -build-path $(ABS_BUILD_PATH) \ + -ide-version $(ARDUINO_IDE_VERSION) \ + $(SKETCH) + +clean: + rm -rf ./build/* # This should be BUILD_PATH, but without a decent guard, unsetting BUILD_PATH could wipe out /