mib_neuralizer/Makefile

33 lines
692 B
Makefile
Raw Permalink Normal View History

2022-07-12 20:14:59 +02:00
PREFIX := avr-
CFLAGS_COMMON := -I/usr/avr/include/
2022-07-14 18:12:49 +02:00
CFLAGS_CPU := -DF_CPU=16000000UL -mmcu=atmega328p -Os
2022-07-12 20:14:59 +02:00
CFLAGS := $(CFLAGS_COMMON) $(CFLAGS_CPU)
LDFLAGS_COMMON := -I/usr/avr/include/
LDFLAGS_CPU := -mmcu=atmega328p
LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_CPU)
CC := $(PREFIX)gcc
build: main.hex
flash: main.hex
sudo avrdude -FV -c arduino -p ATmega328p -P /dev/ttyUSB0 -b 57600 -U flash:w:$<
clean:
$(RM) *.hex *.elf *.o
bear: compile_commands.json
compile_commands.json: clean
bear -- make build
main.hex: main.elf
$(PREFIX)objcopy -O ihex -R .eeprom $< $@
main.elf: main.o
$(CC) -w $(LDFLAGS) -o $@ $<
%.o: %.c %.h
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: build flash clean bear