-
Notifications
You must be signed in to change notification settings - Fork 51
/
Makefile
38 lines (33 loc) · 896 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
PROGRAM = tapuino
ARDUINO_DIR = /usr/share/arduino
ROOT_DIR = $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SOURCE = $(ROOT_DIR)
TARGET = $(ROOT_DIR)/target
BUILDER = arduino-builder \
-compile \
-verbose \
-build-path $(TARGET) \
-fqbn arduino:avr:nano:cpu=atmega328 \
-hardware $(ARDUINO_DIR)/hardware \
-tools $(ARDUINO_DIR)/tools \
-tools $(ARDUINO_DIR)/tools-builder \
-tools $(ARDUINO_DIR)/hardware/tools/avr \
-built-in-libraries $(ARDUINO_DIR)/libraries
AVRDUDE = avrdude \
-v \
-patmega328p \
-carduino \
-P/dev/ttyUSB0 \
-b57600 \
-D \
-V
all: $(TARGET)/$(PROGRAM).ino.hex
$(TARGET)/$(PROGRAM).ino.hex: $(SOURCE)/$(PROGRAM).ino $(SOURCE)/*.c $(SOURCE)/*.h
mkdir -p $(TARGET)
$(BUILDER) $(SOURCE)/$(PROGRAM).ino
upload: $(TARGET)/$(PROGRAM).ino.hex
$(AVRDUDE) -v -U flash:w:$(TARGET)/$(PROGRAM).ino.hex
status:
$(AVRDUDE) -v
clean:
rm $(TARGET) -rf