Skip to content
Snippets Groups Projects
Makefile 600 B
Newer Older
leo's avatar
leo committed


PORT=/dev/ttyUSB0
MCU=atmega2560
Leo's avatar
Leo committed
CFLAGS=-g -Werror -mcall-prologues -mmcu=$(MCU) -O2 -I ./
leo's avatar
leo committed
LDFLAGS=-Wl,-gc-sections -Wl,-relax
CC=avr-gcc
TARGET=main
Paul's avatar
Paul committed
OBJECT_FILES=main.o draw.o uart.o helpMath.o
leo's avatar
leo committed

all: $(TARGET).hex

clear:
Leo's avatar
Leo committed
	rm -f *.o *.hex *.obj *.hex a.out
	clear
leo's avatar
leo committed

%.hex: %.obj
	avr-objcopy -R .eeprom -O ihex $< $@

%.obj: $(OBJECT_FILES)
	$(CC) $(CFLAGS) $(OBJECT_FILES) $(LDFLAGS) -o $@

flash: $(TARGET).hex
	avrdude -p $(MCU) -P $(PORT) -c avrisp -b 19200 -U flash:w:$(TARGET).hex
Leo's avatar
Leo committed

sim:
Paul's avatar
Paul committed
	gcc main.c gol.c draw.c helpMath.c sim.c -g -D SIMULATION -lpthread -lglut -lGL -lm -lGLU -Wall -Wextra