-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (29 loc) · 753 Bytes
/
Makefile
File metadata and controls
47 lines (29 loc) · 753 Bytes
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
39
40
41
42
43
44
45
46
47
TARGET = odoconv
SOURCES = odoconv.ino
OBJECTS = $(SOURCES:.ino=.o)
# microcontroller and clockspeed [Hz]
MCU = attiny85
F_CPU ?= 1000000ul
# default settings for ArduinoAsISP programmer
PROGRAMMER ?= avrisp
PORT ?= /dev/ttyACM0
BAUD ?= 19200
CC = avr-gcc
CFLAGS = -mmcu=$(MCU) -Os -Wall -Wextra -Wpedantic -Werror
CCFLAGS = -DF_CPU=$(F_CPU)
LDFLAGS =
PRGFLAGS = -p $(MCU) -P $(PORT) -B $(BAUD) -c $(PROGRAMMER)
all: $(TARGET).hex
%.hex: %.elf
avr-objcopy -O ihex -j .data -j .text $< $@
$(TARGET).elf: $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
%.o: %.ino
$(CC) $(CFLAGS) $(CCFLAGS) -c -o $@ -x c++ $<
program: $(TARGET).hex
avrdude $(PRGFLAGS) -U flash:w:$^
clean:
rm -f *.o
rm -f *.elf
rm -f *.hex
.PHONY: clean program