-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
32 lines (27 loc) · 1021 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
#we makefile now
#no seriously I just read about makefiles like 5 minutes ago
GCC = gcc
AVR_GCC = C:\WinAVR-20100110\bin\avr-gcc
AVR_SIZE = C:\WinAVR-20100110\bin\avr-size
CFLAGS = -Wall -Os
MCU = atmega328p
INCLUDE = include
SOURCES = main.c src\dpad.c src\matrix.c src\snake.c
SOURCES_CLI = cli.c src\snake.c
EXE = main
HEX = main.c
build: compile eeprom size
compile: $(SOURCES)
cls #makefiles on windows ? blasphemy !
echo Compiling for the $(MCU) microcontroller
$(AVR_GCC) -I$(INCLUDE) -mmcu=$(MCU) $(CFLAGS) $(SOURCES) -o $(EXE)
#since snake.c doesn't depend on MCU-related functions, it is possible to use it with another front-end
#front-end being of course a fancy word for "input and output". in this case, respectively, keyboard and CLI.
build_cli: $(SOURCES)
cls
echo Compiling for the command line
$(GCC) -I$(INCLUDE) $(CFLAGS) $(SOURCES_CLI) -o $(EXE)
eeprom: $(EXE) $(HEX)
C:\WinAVR-20100110\bin\avr-objcopy -O ihex -R .eeprom main main.hex
size: $(EXE)
$(AVR_SIZE) -C --mcu=$(MCU) $(EXE)