Initial commit
[brmpsu.git] / Makefile
blob85d3286bd8da98bcc2269b23cc7575a92abf8a73
1 PRG = brmpsu
2 OBJ = brmpsu.o
3 MCU_TARGET = atmega16
4 OPTIMIZE = -Os
5 PROG = dragon_jtag
6 PORT = usb
8 CC = avr-gcc
10 override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) -L/usr/x86_64-pc-linux-gnu/avr/lib
12 OBJCOPY = avr-objcopy
13 OBJDUMP = avr-objdump
15 all: hex
17 $(PRG).elf: $(OBJ)
18 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
20 clean:
21 rm -rf *.o $(PRG).elf $(PRG).hex
23 hex: $(PRG).hex
25 %.hex: %.elf
26 $(OBJCOPY) -j .text -j .data -O ihex $< $@
28 install: load
30 load: $(PRG).hex
31 avrdude -p m16 -c $(PROG) -P $(PORT) -U flash:w:$<