Rev Author Line No. Line
2116 paro 1 PRG = fluxgate
2 OBJ = main.o ./libs/usart.o ./libs/spi.o ./libs/mcp4922.o
3 MCU_TARGET = atmega8
4 AVRDUDE_PART = m8
5  
6 # OPTIMIZE = -O1
7 OPTIMIZE = -Os
8  
9 CC = avr-gcc
10 override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
11 OBJCOPY = avr-objcopy
12 OBJDUMP = avr-objdump
13  
14 all: hex
15  
16 #./libs/adc.o: ./libs/adc.h
17 ./libs/spi.o: ./libs/spi.h
18 ./libs/usart.o: ./libs/usart.h
19 ./libs/mcp4922.o: ./libs/mcp4922.h
20 #./libs/timer.o: ./libs/timer.h
21  
22 hex: $(PRG).hex
23  
24 %.hex: %.elf
25 $(OBJCOPY) -j .text -j .data -O ihex $< $@
26  
27 $(PRG).elf: $(OBJ)
28 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
29  
30 load: $(PRG).hex
31 avrdude -p $(AVRDUDE_PART) -c stk500v2 -P /dev/ttyUSB1 -B 1 -U flash:w:$<
32  
33 clean:
34 rm -rf *.o $(PRG).elf $(PRG).hex ./libs/*.o
35