mca-pendel/sketches/led-driver/Makefile
2018-03-16 05:30:47 +01:00

24 lines
481 B
Makefile

CFLAGS = -O3 -Wall --std=c11
CHIP = atmega328p
SOURCE_FILES = $(wildcard *.c)
OBJ_FILES = $(SOURCE_FILES:%.c=%.o)
BIN = led-driver.bin
HEX = led-driver.hex
default: $(HEX)
%.o: %.c
avr-gcc $(CFLAGS) -mmcu=$(CHIP) -o $@ $<
$(BIN): $(OBJ_FILES)
avr-gcc $(CFLAGS) -o $@ $^
$(HEX): $(BIN)
avr-objcopy -O ihex -j .text -j .data $^ $@
flash: $(HEX)
avrdude -p $(CHIP) -c arduino -B 115200 -P /dev/ttyACM1 -v -v -e -Uflash:w:$(HEX):a
clean:
$(RM) $(OBJ_FILES) $(BIN) $(HEX)