-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (60 loc) · 3.26 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File: Makefile
# Author: Samuel Burtenshaw, Zachary Kaye
# Date: 5/10/2020
# Descr: Makefile for Paper, Scissors, Rock
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I. -I../../utils -I../../fonts -I../../drivers -I../../drivers/avr
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: game.out
# Compile: create object files from C source files.
game.o: game.c game.h game_display.h game_ir.h nav_tasks.h ../../drivers/avr/system.h ../../utils/task.h
$(CC) -c $(CFLAGS) $< -o $@
system.o: ../../drivers/avr/system.c ../../drivers/avr/system.h
$(CC) -c $(CFLAGS) $< -o $@
tinygl.o: ../../utils/tinygl.c ../../drivers/avr/system.h ../../drivers/display.h ../../utils/font.h ../../utils/tinygl.h
$(CC) -c $(CFLAGS) $< -o $@
navswitch.o: ../../drivers/navswitch.c ../../drivers/avr/delay.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/navswitch.h
$(CC) -c $(CFLAGS) $< -o $@
ir_uart.o: ../../drivers/avr/ir_uart.c ../../drivers/avr/ir_uart.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h ../../drivers/avr/usart1.h
$(CC) -c $(CFLAGS) $< -o $@
font.o: ../../utils/font.c ../../drivers/avr/system.h ../../utils/font.h
$(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h
$(CC) -c $(CFLAGS) $< -o $@
prescale.o: ../../drivers/avr/prescale.c ../../drivers/avr/prescale.h ../../drivers/avr/system.h
$(CC) -c $(CFLAGS) $< -o $@
timer.o: ../../drivers/avr/timer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h
$(CC) -c $(CFLAGS) $< -o $@
timer0.o: ../../drivers/avr/timer0.c ../../drivers/avr/bits.h ../../drivers/avr/prescale.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h
$(CC) -c $(CFLAGS) $< -o $@
usart1.o: ../../drivers/avr/usart1.c ../../drivers/avr/system.h ../../drivers/avr/usart1.h
$(CC) -c $(CFLAGS) $< -o $@
display.o: ../../drivers/display.c ../../drivers/avr/system.h ../../drivers/display.h ../../drivers/ledmat.h
$(CC) -c $(CFLAGS) $< -o $@
ledmat.o: ../../drivers/ledmat.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/ledmat.h
$(CC) -c $(CFLAGS) $< -o $@
task.o: ../../utils/task.c ../../utils/task.h ../../drivers/avr/system.h ../../drivers/avr/timer.h
$(CC) -c $(CFLAGS) $< -o $@
game_display.o: game_display.c game_display.h ../../utils/tinygl.h ../../fonts/font5x7_1.h ../../utils/task.h
$(CC) -c $(CFLAGS) $< -o $@
nav_tasks.o: nav_tasks.c nav_tasks.h game.h game_display.h game_ir.h ../../drivers/avr/system.h ../../drivers/navswitch.h ../../utils/tinygl.h
$(CC) -c $(CFLAGS) $< -o $@
game_ir.o: game_ir.c game_ir.h game_display.h ../../drivers/avr/ir_uart.h ../../drivers/navswitch.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create ELF output file from object files.
game.out: game.o system.o tinygl.o navswitch.o ir_uart.o font.o pio.o prescale.o timer.o timer0.o usart1.o display.o ledmat.o task.o game_display.o nav_tasks.o game_ir.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: game.out
$(OBJCOPY) -O ihex game.out game.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash game.hex; dfu-programmer atmega32u2 start